Mercurial > libervia-web
changeset 1145:29eb15062416
pages: set __name__ for imported pages
line wrap: on
line diff
--- a/libervia/pages/blog/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/blog/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from libervia.server import session_iface from sat.core.log import getLogger -log = getLogger("pages/blog") +log = getLogger(__name__) name = u"blog" access = C.PAGES_ACCESS_PUBLIC
--- a/libervia/pages/blog/view/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/blog/view/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -13,7 +13,7 @@ import re import cgi from sat.core.log import getLogger -log = getLogger('pages/blog/view') +log = getLogger(__name__) """generic blog (with service/node provided)""" name = u'blog_view'
--- a/libervia/pages/chat/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/chat/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -5,7 +5,7 @@ from twisted.internet import defer from sat.core.log import getLogger -log = getLogger("pages/chat") +log = getLogger(__name__) from sat.tools.common import data_objects from twisted.words.protocols.jabber import jid from libervia.server.constants import Const as C
--- a/libervia/pages/chat/select/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/chat/select/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -8,7 +8,7 @@ from sat.tools.common import data_objects from sat.core.log import getLogger -log = getLogger("pages/chat_select") +log = getLogger(__name__) name = u"chat_select" access = C.PAGES_ACCESS_PROFILE
--- a/libervia/pages/events/admin/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/events/admin/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -15,7 +15,7 @@ name = u"event_admin" access = C.PAGES_ACCESS_PROFILE template = u"event/admin.html" -log = getLogger(u"pages/" + name) +log = getLogger(__name__) REG_EMAIL_RE = re.compile(C.REG_EMAIL_RE, re.IGNORECASE)
--- a/libervia/pages/events/new/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/events/new/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -11,7 +11,7 @@ name = u"event_new" access = C.PAGES_ACCESS_PROFILE template = u"event/create.html" -log = getLogger(u"pages/" + name) +log = getLogger(__name__) @defer.inlineCallbacks
--- a/libervia/pages/events/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/events/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -6,7 +6,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"events"
--- a/libervia/pages/events/rsvp/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/events/rsvp/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -15,7 +15,7 @@ name = u"event_rsvp" access = C.PAGES_ACCESS_PROFILE template = u"event/invitation.html" -log = getLogger(u"pages/" + name) +log = getLogger(__name__) def parse_url(self, request):
--- a/libervia/pages/events/view/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/events/view/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -15,7 +15,7 @@ name = u"event_view" access = C.PAGES_ACCESS_PROFILE template = u"event/invitation.html" -log = getLogger(u"pages/" + name) +log = getLogger(__name__) @defer.inlineCallbacks
--- a/libervia/pages/files/list/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/files/list/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -11,7 +11,7 @@ import json import os -log = getLogger("pages/files/list") +log = getLogger(__name__) """files handling pages""" name = u"files_list"
--- a/libervia/pages/files/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/files/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -6,7 +6,7 @@ from twisted.words.protocols.jabber import jid from sat.core.log import getLogger -log = getLogger("pages/files") +log = getLogger(__name__) """files handling pages""" name = u"files"
--- a/libervia/pages/files/view/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/files/view/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -11,7 +11,7 @@ import os.path from sat.core.log import getLogger -log = getLogger("pages/files/view") +log = getLogger(__name__) """files handling pages""" name = u"files_view"
--- a/libervia/pages/forums/list/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/forums/list/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from sat.core.i18n import _ from sat.tools.common import uri as xmpp_uri -log = getLogger("pages/forum") +log = getLogger(__name__) import json """forum handling pages"""
--- a/libervia/pages/forums/topics/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/forums/topics/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from sat.core.log import getLogger from sat.tools.common import uri as xmpp_uri -log = getLogger("pages/forums/topics") +log = getLogger(__name__) name = u"forum_topics" access = C.PAGES_ACCESS_PUBLIC
--- a/libervia/pages/forums/view/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/forums/view/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -6,7 +6,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger -log = getLogger("pages/forums/view") +log = getLogger(__name__) name = u"forum_view" access = C.PAGES_ACCESS_PUBLIC
--- a/libervia/pages/g/e/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/g/e/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -12,7 +12,7 @@ import cgi from sat.core.log import getLogger -log = getLogger("pages/g/e") +log = getLogger(__name__) access = C.PAGES_ACCESS_PROFILE template = u"event/invitation.html"
--- a/libervia/pages/g/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/g/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from libervia.server import session_iface from sat.core.log import getLogger -log = getLogger("pages/g") +log = getLogger(__name__) access = C.PAGES_ACCESS_PUBLIC template = u"invitation/welcome.html"
--- a/libervia/pages/login/logged/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/login/logged/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -4,7 +4,7 @@ from libervia.server import session_iface from sat.core.log import getLogger -log = getLogger("pages/login") +log = getLogger(__name__) """SàT log-in page, with link to create an account"""
--- a/libervia/pages/login/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/login/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -8,7 +8,7 @@ from twisted.internet import defer from sat.core.log import getLogger -log = getLogger("pages/login") +log = getLogger(__name__) """SàT log-in page, with link to create an account"""
--- a/libervia/pages/merge-requests/disco/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/merge-requests/disco/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -5,7 +5,7 @@ from twisted.words.protocols.jabber import jid from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"merge-requests_disco"
--- a/libervia/pages/merge-requests/edit/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/merge-requests/edit/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -12,7 +12,7 @@ name = u"merge-requests_edit" access = C.PAGES_ACCESS_PROFILE template = u"merge-request/edit.html" -log = getLogger("pages/" + name) +log = getLogger(__name__) def parse_url(self, request):
--- a/libervia/pages/merge-requests/new/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/merge-requests/new/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -4,7 +4,7 @@ from libervia.server.constants import Const as C from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"merge-requests_new"
--- a/libervia/pages/merge-requests/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/merge-requests/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from sat.tools.common import data_objects from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"merge-requests"
--- a/libervia/pages/merge-requests/view/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/merge-requests/view/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -15,7 +15,7 @@ name = u"merge-requests_view" access = C.PAGES_ACCESS_PUBLIC template = u"merge-request/item.html" -log = getLogger(u"pages/" + name) +log = getLogger(__name__) def parse_url(self, request):
--- a/libervia/pages/photos/album/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/photos/album/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -4,7 +4,7 @@ from libervia.server.constants import Const as C from sat.core.log import getLogger -log = getLogger("pages/photo/album") +log = getLogger(__name__) name = u"photos_album" access = C.PAGES_ACCESS_PROFILE
--- a/libervia/pages/register/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/register/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -6,7 +6,7 @@ from twisted.internet import defer from sat.core.log import getLogger -log = getLogger("pages/register") +log = getLogger(__name__) """SàT account registration page"""
--- a/libervia/pages/tickets/disco/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/tickets/disco/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -5,7 +5,7 @@ from twisted.words.protocols.jabber import jid from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"tickets_disco"
--- a/libervia/pages/tickets/edit/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/tickets/edit/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from sat.tools.common import template_xmlui from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"tickets_edit"
--- a/libervia/pages/tickets/new/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/tickets/new/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -6,7 +6,7 @@ from sat.tools.common import template_xmlui from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"tickets_new"
--- a/libervia/pages/tickets/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/tickets/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -7,7 +7,7 @@ from sat.tools.common import data_objects from sat.core.log import getLogger -log = getLogger("pages/ticket") +log = getLogger(__name__) """ticket handling pages""" name = u"tickets"
--- a/libervia/pages/tickets/view/page_meta.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/pages/tickets/view/page_meta.py Fri Jan 25 08:41:43 2019 +0100 @@ -12,7 +12,7 @@ from sat.tools.common import data_objects from sat.core.log import getLogger -log = getLogger("pages/tickets/view") +log = getLogger(__name__) """ticket handling pages""" name = u"tickets_view"
--- a/libervia/server/pages.py Sat Jan 19 11:44:49 2019 +0100 +++ b/libervia/server/pages.py Fri Jan 25 08:41:43 2019 +0100 @@ -28,7 +28,6 @@ from sat.tools.common import date_utils from sat.core.log import getLogger -log = getLogger(__name__) from libervia.server.constants import Const as C from libervia.server import session_iface from libervia.server.utils import quote, SubPage @@ -40,6 +39,8 @@ import time import hashlib +log = getLogger(__name__) + WebsocketMeta = namedtuple("WebsocketMeta", ("url", "token", "debug")) @@ -280,12 +281,12 @@ if not os.path.isdir(dir_path): continue if _extra_pages and d in _parent.children: - log.debug(_(u"[{host_name}] {path} is already present, ignoring it").format( - host_name=vhost_root.host_name, path=u'/'.join(_path+[d]))) + log.debug(_(u"[{host_name}] {path} is already present, ignoring it") + .format(host_name=vhost_root.host_name, path=u'/'.join(_path+[d]))) continue meta_path = os.path.join(dir_path, C.PAGES_META_FILE) if os.path.isfile(meta_path): - page_data = {} + page_data = {"__name__": u".".join([u"page"] + _path + [d])} new_path = _path + [d] # we don't want to force the presence of __init__.py # so we use execfile instead of import. @@ -1108,7 +1109,7 @@ return self.host.renderer.render( self.template, - media_path="/" + C.MEDIA_DIR, + media_path=u"/" + C.MEDIA_DIR, cache_path=session_data.cache_dir, main_menu=self.main_menu, **template_data)