diff sat/plugins/plugin_misc_static_blog.py @ 2624:56f94936df1e

code style reformatting using black
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 20:14:46 +0200
parents 26edcf3a30eb
children ab2696e34d29
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_static_blog.py	Wed Jun 27 07:51:29 2018 +0200
+++ b/sat/plugins/plugin_misc_static_blog.py	Wed Jun 27 20:14:46 2018 +0200
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.log import getLogger
+
 log = getLogger(__name__)
 
 from sat.core.i18n import _, D_
@@ -35,10 +36,12 @@
     C.PI_TYPE: "MISC",
     C.PI_PROTOCOLS: [],
     C.PI_DEPENDENCIES: [],
-    C.PI_RECOMMENDATIONS: ['MISC-ACCOUNT'],  # TODO: remove when all blogs can be retrieved
+    C.PI_RECOMMENDATIONS: [
+        "MISC-ACCOUNT"
+    ],  # TODO: remove when all blogs can be retrieved
     C.PI_MAIN: "StaticBlog",
     C.PI_HANDLER: "no",
-    C.PI_DESCRIPTION: _("""Plugin for static blogs""")
+    C.PI_DESCRIPTION: _("""Plugin for static blogs"""),
 }
 
 
@@ -57,23 +60,23 @@
     </individual>
     </params>
     """.format(
-        category_name = C.STATIC_BLOG_KEY,
-        category_label = D_(C.STATIC_BLOG_KEY),
-        title_name = C.STATIC_BLOG_PARAM_TITLE,
-        title_label = D_('Page title'),
-        banner_name = C.STATIC_BLOG_PARAM_BANNER,
-        banner_label = D_('Banner URL'),
-        background_name = u"Background",
-        background_label = D_(u"Background image URL"),
-        keywords_name = C.STATIC_BLOG_PARAM_KEYWORDS,
-        keywords_label = D_('Keywords'),
-        description_name = C.STATIC_BLOG_PARAM_DESCRIPTION,
-        description_label = D_('Description'),
+        category_name=C.STATIC_BLOG_KEY,
+        category_label=D_(C.STATIC_BLOG_KEY),
+        title_name=C.STATIC_BLOG_PARAM_TITLE,
+        title_label=D_("Page title"),
+        banner_name=C.STATIC_BLOG_PARAM_BANNER,
+        banner_label=D_("Banner URL"),
+        background_name=u"Background",
+        background_label=D_(u"Background image URL"),
+        keywords_name=C.STATIC_BLOG_PARAM_KEYWORDS,
+        keywords_label=D_("Keywords"),
+        description_name=C.STATIC_BLOG_PARAM_DESCRIPTION,
+        description_label=D_("Description"),
     )
 
     def __init__(self, host):
         try:  # TODO: remove this attribute when all blogs can be retrieved
-            self.domain = host.plugins['MISC-ACCOUNT'].getNewAccountDomain()
+            self.domain = host.plugins["MISC-ACCOUNT"].getNewAccountDomain()
         except KeyError:
             self.domain = None
         host.memory.updateParams(self.params)
@@ -89,7 +92,7 @@
         # FIXME: "public_blog" key has been removed
         # TODO: replace this with a more generic widget call with URIs
         try:
-            user_jid = jid.JID(menu_data['jid'])
+            user_jid = jid.JID(menu_data["jid"])
         except KeyError:
             log.error(_("jid key is not present !"))
             return defer.fail(exceptions.DataError)
@@ -97,7 +100,9 @@
         # TODO: remove this check when all blogs can be retrieved
         if self.domain and user_jid.host != self.domain:
             info_ui = xml_tools.XMLUI("popup", title=D_("Not available"))
-            info_ui.addText(D_("Retrieving a blog from an external domain is not implemented yet."))
-            return {'xmlui': info_ui.toXml()}
+            info_ui.addText(
+                D_("Retrieving a blog from an external domain is not implemented yet.")
+            )
+            return {"xmlui": info_ui.toXml()}
 
         return {"public_blog": user_jid.userhost()}