code style reformatting using black
This commit is contained in:
parent
4127bcffd0
commit
744cb0c503
1 changed files with 21394 additions and 10488 deletions
|
|
@ -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 @@ PLUGIN_INFO = {
|
|||
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 @@ class StaticBlog(object):
|
|||
</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 @@ class StaticBlog(object):
|
|||
# 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 @@ class StaticBlog(object):
|
|||
# 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()}
|
||||
|
|
|
|||
Loading…
Reference in a new issue