当前位置: 首页>>代码示例>>Python>>正文


Python wikiutil.getFrontPage函数代码示例

本文整理汇总了Python中MoinMoin.wikiutil.getFrontPage函数的典型用法代码示例。如果您正苦于以下问题:Python getFrontPage函数的具体用法?Python getFrontPage怎么用?Python getFrontPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getFrontPage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: logo

    def logo(self):
        """ Assemble logo with link to front page

        Changed: * we don't need a div wrapper for the textlogo
                 * append text "FrontPage" to the logo string
        
        @rtype: unicode
        @return: logo html
        """
        _ = self.request.getText
        html = u''
        if self.cfg.logo_string:
            page = wikiutil.getFrontPage(self.request)
            logo_string = self.cfg.logo_string
            logo_append = '<span class="screenreader_info"> %s</span>' % _('FrontPage', formatted=False) 
            logo_string = logo_string + logo_append
            # Try..except for backwards compatibility of Moin versions only
            try:
                logo = page.link_to_raw(self.request, logo_string)
            except:
                pagename = wikiutil.getFrontPage(self.request).page_name
                pagename = wikiutil.quoteWikinameURL(pagename)
                logo = wikiutil.link_tag(self.request, pagename, logo_string)
            html = u'%s' % logo
        return html
开发者ID:Glottotopia,项目名称:aagd,代码行数:25,代码来源:simplemente.py

示例2: logo

 def logo(self):
     html = u''
     if self.cfg.logo_string:
         page = wikiutil.getFrontPage(self.request)
         logo = page.link_to_raw(self.request, self.cfg.logo_string)
         html = u'<h1>%s</h1>' %logo
     return html
开发者ID:AnishShah,项目名称:roundup,代码行数:7,代码来源:roundup.py

示例3: bs_breadcrumb

    def bs_breadcrumb(self, d):
        html = [u'<ul class="breadcrumb">']

        try:
            _var = self.cfg.bs_breadcrumb
            for text, url in self.cfg.bs_breadcrumb:
                markup = u'<li><a href="%s">%s</a> <span class="divider">&raquo;</span></li>' % (url, text)
                html.append(markup)
        except AttributeError:
            pass

        if self.request.action not in [u'show', u'', u'refresh']:
            action = self.request.action
        else:
            action = False
        page = wikiutil.getFrontPage(self.request)
        frontpage = page.link_to_raw(self.request, text=self.request.cfg.sitename)
        html.append(u'<li>%s <span class="divider">&raquo;</span></li>' % frontpage)
        segments = d['page_name'].split('/')
        if action:
            segments.append(action)
        curpage = ''
        for s in segments[:-1]:
            curpage += s
            html.append(u'<li>%s  <span class="divider">&raquo;</span></li>' % Page(self.request, curpage).link_to(self.request, s))
            curpage += '/'

        html.append(u'<li class="active">%s</li>' % segments[-1])
        html.append(u'<li class="pull-right">%s</li>' % self.username(d))
        html.append(u'</ul>')
        return '\n'.join(html)
开发者ID:dmiyakawa,项目名称:moinmoin-bootstrap,代码行数:31,代码来源:bootstrap.py

示例4: logo

    def logo(self):
        """ Assemble logo with link to front page

        The logo contain an image and or text or any html markup the
        admin inserted in the config file. Everything it enclosed inside
        a div with id="logo".

        @rtype: unicode
        @return: logo html
        """
        html = u''
        page = wikiutil.getFrontPage(self.request)
        html = page.link_to_raw(self.request, '<img src="%s/FrontPage?action=AttachFile&do=get&target=logo.png" valign="bottom" alt="MoinMoin Logo">' % self.request.script_root)

        # page = wikiutil.getFrontPage(self.request)
        # #text = random.choice(['#','|','+','-','~','`','^','*','=','_',';',':',',','.'])#self.request.cfg.interwikiname or 'Self'
        # text = "%02d" % datetime.today().day
        # link = page.link_to(self.request, text=text, rel='nofollow')

        # #randomcolor
        # a = map(str, range(0,9))
        # a.extend(list('abcdef'))

        # color_str = []
        # for i in range(0,6):
        #     color_str.append(random.choice(a))
        # html = u'<span id="logo" style="background-color:#%s;">%s</span>' % (''.join(color_str), link)

        return html
开发者ID:happytk,项目名称:moin,代码行数:29,代码来源:c2wiki.py

示例5: logo

 def logo(self):
     logo = u''
     if self.cfg.logo_string:
         pagename = wikiutil.getFrontPage(self.request).page_name
         pagename = wikiutil.quoteWikinameURL(pagename)
         logo = wikiutil.link_tag(self.request, pagename, self.cfg.logo_string, css_class="logo")
     return logo
开发者ID:miguelmarco,项目名称:sage-wiki,代码行数:7,代码来源:solenoid.py

示例6: username

    def username(self, d):
        """ Assemble the username / userprefs link

        @param d: parameter dictionary
        @rtype: unicode
        @return: username html
        """

        if not self.is_mobile:
            return ThemeBase.username(self, d)

        request = self.request
        _ = request.getText

        if self.request.cfg.show_interwiki:
            page = wikiutil.getFrontPage(self.request)
            text = self.request.cfg.interwikiname or 'Self'
            link = page.link_to(self.request, text=text, rel='nofollow')
            # html = u'<span id="interwiki">%s<span class="sep">: </span></span>' % link
            userlinks = [link]
        else:
            userlinks = []

        # Add username/homepage link for registered users. We don't care
        # if it exists, the user can create it.
        if request.user.valid and request.user.name:
            interwiki = wikiutil.getInterwikiHomePage(request)
            name = request.user.name
            aliasname = request.user.aliasname
            if not aliasname:
                aliasname = name
            title = "%s @ %s" % (aliasname, interwiki[0])
            # link to (interwiki) user homepage
            homelink = (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki) +
                        request.formatter.text(name) +
                        request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
            userlinks.append(homelink)
            # link to userprefs action
            if 'userprefs' not in self.request.cfg.actions_excluded:
                userlinks.append(d['page'].link_to(request, text=_('Settings'),
                                               querystr={'action': 'userprefs'}, id='userprefs', rel='nofollow'))

        if request.user.valid:
            if request.user.auth_method in request.cfg.auth_can_logout:
                userlinks.append(d['page'].link_to(request, text=_('Logout'),
                                                   querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow'))
        else:
            query = {'action': 'login'}
            # special direct-login link if the auth methods want no input
            if request.cfg.auth_login_inputs == ['special_no_input']:
                query['login'] = '1'
            if request.cfg.auth_have_login:
                userlinks.append(d['page'].link_to(request, text=_("Login"),
                                                   querystr=query, id='login', rel='nofollow'))

        userlinks_html = u'<span class="sep"> | </span>'.join(userlinks)
        html = u'<div id="username">%s</div>' % userlinks_html
        return html
开发者ID:happytk,项目名称:moin,代码行数:58,代码来源:modernized_mobile.py

示例7: handle_action

def handle_action(context, pagename, action_name='show'):
    """ Actual dispatcher function for non-XMLRPC actions.

    Also sets up the Page object for this request, normalizes and
    redirects to canonical pagenames and checks for non-allowed
    actions.
    """
    _ = context.getText
    cfg = context.cfg

    # pagename could be empty after normalization e.g. '///' -> ''
    # Use localized FrontPage if pagename is empty
    if not pagename:
        context.page = wikiutil.getFrontPage(context)
    else:
        context.page = Page(context, pagename)
        if '_' in pagename and not context.page.exists():
            pagename = pagename.replace('_', ' ')
            page = Page(context, pagename)
            if page.exists():
                url = page.url(context)
                return context.http_redirect(url)

    msg = None
    # Complain about unknown actions
    if not action_name in get_names(cfg):
        msg = _("Unknown action %(action_name)s.") % {
                'action_name': wikiutil.escape(action_name), }

    # Disallow non available actions
    elif action_name[0].isupper() and not action_name in \
            get_available_actions(cfg, context.page, context.user):
        msg = _("You are not allowed to do %(action_name)s on this page.") % {
                'action_name': wikiutil.escape(action_name), }
        if not context.user.valid:
            # Suggest non valid user to login
            msg += " " + _("Login and try again.")

    if msg:
        context.theme.add_msg(msg, "error")
        context.page.send_page()
    # Try action
    else:
        from MoinMoin import action
        handler = action.getHandler(context, action_name)
        if handler is None:
            msg = _("You are not allowed to do %(action_name)s on this page.") % {
                    'action_name': wikiutil.escape(action_name), }
            if not context.user.valid:
                # Suggest non valid user to login
                msg += " " + _("Login and try again.")
            context.theme.add_msg(msg, "error")
            context.page.send_page()
        else:
            handler(context.page.page_name, context)

    return context
开发者ID:happytk,项目名称:moin,代码行数:57,代码来源:wsgiapp.py

示例8: interwiki

 def interwiki(self, d):
     """ Assemble the interwiki name display, linking to page_front_page
     
     @param d: parameter dictionary
     @rtype: string
     @return: interwiki html
     """
     html = u''
     if self.request.cfg.show_interwiki:
         # Show our interwikiname or Self (and link to page_front_page)
         pagename = wikiutil.getFrontPage(self.request).page_name
         pagename = wikiutil.quoteWikinameURL(pagename)
         link = wikiutil.link_tag(self.request, pagename, self.request.cfg.interwikiname or 'Self')
         html = u'<div id="interwiki"><span>%s</span></div>' % link
     return html
开发者ID:imosts,项目名称:flume,代码行数:15,代码来源:__init__.py

示例9: interwiki

    def interwiki(self, d):
        """ Assemble the interwiki name display, linking to page_front_page

        @param d: parameter dictionary
        @rtype: string
        @return: interwiki html
        """
        if self.request.cfg.show_interwiki:
            page = wikiutil.getFrontPage(self.request)
            text = self.request.cfg.interwikiname or 'Self'
            link = page.link_to(self.request, text=text, rel='nofollow')
            html = u'<span id="interwiki">%s<span class="sep">:</span></span>' % link
        else:
            html = u''
        return html
开发者ID:Kartstig,项目名称:engineering-inventions-wiki,代码行数:15,代码来源:memodump.py

示例10: redirect_last_visited

def redirect_last_visited(request):
    pagetrail = request.user.getTrail()
    if pagetrail:
        # Redirect to last page visited
        last_visited = pagetrail[-1]
        wikiname, pagename = wikiutil.split_interwiki(last_visited)
        if wikiname != request.cfg.interwikiname and wikiname != 'Self':
            wikitag, wikiurl, wikitail, error = wikiutil.resolve_interwiki(request, wikiname, pagename)
            url = wikiurl + wikiutil.quoteWikinameURL(wikitail)
        else:
            url = Page(request, pagename).url(request)
    else:
        # Or to localized FrontPage
        url = wikiutil.getFrontPage(request).url(request)
    url = request.getQualifiedURL(url)
    return abort(redirect(url))
开发者ID:happyxgang,项目名称:hd-moin,代码行数:16,代码来源:utils.py

示例11: logo

    def logo(self):
        """ Assemble logo with link to front page

        The logo contain an image and or text or any html markup the
        admin inserted in the config file. Everything it enclosed inside
        a div with id="logo".
        
        @rtype: unicode
        @return: logo html
        """
        html = u''
        if self.cfg.logo_string:
            pagename = wikiutil.getFrontPage(self.request).page_name
            pagename = wikiutil.quoteWikinameURL(pagename)
            logo = wikiutil.link_tag(self.request, pagename, self.cfg.logo_string)
            html = u'''<div id="logo">%s</div>''' % logo
        return html
开发者ID:imosts,项目名称:flume,代码行数:17,代码来源:__init__.py

示例12: _verify_endpoint_identity

    def _verify_endpoint_identity(self, identity):
        """
           Verify that the given identity matches the current endpoint.

           We always serve out /UserName?action=... for the UserName
           OpenID and this is pure paranoia to make sure it is that way
           on incoming data.

           Also verify that the given identity is allowed to have an OpenID.
        """
        request = self.request
        cfg = request.cfg

        # we can very well split on the last slash since usernames
        # must not contain slashes
        base, received_name = rsplit(identity, '/', 1)
        check_name = received_name

        if received_name == '':
            pg = wikiutil.getFrontPage(request)
            if pg:
                received_name = pg.page_name
                check_name = received_name
                if 'openid.user' in pg.pi:
                    received_name = pg.pi['openid.user']

        # some sanity checking
        # even if someone goes to http://johannes.sipsolutions.net/
        # we'll serve out http://johannes.sipsolutions.net/JohannesBerg?action=serveopenid
        # (if JohannesBerg is set as page_front_page)
        # For the #OpenIDUser PI, we need to allow the page that includes the PI,
        # hence use check_name here (see above for how it is assigned)
        fullidentity = '/'.join([base, check_name])
        thisurl = request.getQualifiedURL(request.page.url(request))
        if not thisurl == fullidentity:
            return False

        # again, we never put an openid.server link on this page...
        # why are they here?
        if cfg.openid_server_restricted_users_group:
            request.dicts.addgroup(request, cfg.openid_server_restricted_users_group)
            if not request.dicts.has_member(cfg.openid_server_restricted_users_group, received_name):
                return False

        return True
开发者ID:steveyen,项目名称:moingo,代码行数:45,代码来源:serveopenid.py

示例13: logo

    def logo(self):
        """ Assemble logo with link to front page
        Using <a> tag only instead of wrapping with div

        The logo may contain an image and or text or any html markup.
        Just note that everything is enclosed in <a> tag.

        @rtype: unicode
        @return: logo html
        """
        html = u''
        if self.cfg.logo_string:
            page = wikiutil.getFrontPage(self.request)
            html = page.link_to_raw(self.request, self.cfg.logo_string, css_class="navbar-brand")
            html = u'''
          <div class="navbar-brand-wrapper">
            %s
          </div>
          ''' % html
        return html
开发者ID:Kartstig,项目名称:engineering-inventions-wiki,代码行数:20,代码来源:memodump.py

示例14: header

    def header(self, d, **kw):
        """ Assemble wiki header

        @param d: parameter dictionary
        @rtype: unicode
        @return: page header html
        """
        html = [
            # Pre header custom html
            self.emit_custom_html(self.cfg.page_header1),
            self.username(d),
            # '<div id="header">%s</div>' % self.logo(), 
            u'<div id="header"><div id="logo">%s %s</div></div>' % (wikiutil.getFrontPage(self.request).link_to_raw(self.request, 'PineTri'),  u'오라클모니터링/튜닝도구'),

            # Start of left panels. 
            u'<div id="sidebar">',

            self.menubarpanel(d),

            # Rick: rebuild below so we can put a cute little box around it:  self.navibar(d),
            self.navibarpanel(d),

            # Rick: rebuild below so we can put a cute little box around it:  self.searchform(d),
            self.searchpanel(d),

            # Rick: rebuild below so we can put a cute little box around it:  self.trail(d),
            self.trailpanel(d),
            
            # Rick: rebuild below so we can put a cute little box around it:  self.navibar(d),
            self.editbarpanel(d),
            u'</div>',

            # Post header custom html (not recommended)
            self.emit_custom_html(self.cfg.page_header2),

            # Start of page
            self.msg(d),
            self.startPage(),
            self.title_with_separators(d),
        ]
        return u'\n'.join(html)
开发者ID:happytk,项目名称:moin,代码行数:41,代码来源:moniker19.py

示例15: menu

    def menu(self, d):
        """
        Build dropdown menu html. Incompatible with original actionsMenu() method.

        Menu can be customized by adding a config variable 'memodump_menuoverride'.
        The variable will override the default menu set.
        Additional menu definitions are given via config method 'memodump_menu_def(request)'.
        See the code below or project wiki for details.

        @param d: parameter dictionary
        @rtype: string
        @return: menu html
        """
        request = self.request
        _ = request.getText
        rev = request.rev
        page = d['page']

        page_recent_changes = wikiutil.getLocalizedPage(request, u'RecentChanges')
        page_find_page = wikiutil.getLocalizedPage(request, u'FindPage')
        page_help_contents = wikiutil.getLocalizedPage(request, u'HelpContents')
        page_help_formatting = wikiutil.getLocalizedPage(request, u'HelpOnFormatting')
        page_help_wikisyntax = wikiutil.getLocalizedPage(request, u'HelpOnMoinWikiSyntax')
        page_title_index = wikiutil.getLocalizedPage(request, u'TitleIndex')
        page_word_index = wikiutil.getLocalizedPage(request, u'WordIndex')
        page_front_page = wikiutil.getFrontPage(request)
        page_sidebar = Page(request, request.getPragma('sidebar', u'SideBar'))
        quicklink = self.menuQuickLink(page)
        subscribe = self.menuSubscribe(page)

        try:
            menu = request.cfg.memodump_menuoverride
        except AttributeError:
            # default list of items in dropdown menu.
            # menu items are assembled in this order.
            # see wiki for detailed info on customization.
            menu = [
                '===== Navigation =====',
                'RecentChanges',
                'FindPage',
                'LocalSiteMap',
                '__separator__',
                '===== Help =====',
                'HelpContents',
                'HelpOnMoinWikiSyntax',
                '__separator__',
                '===== Display =====',
                'AttachFile',
                'info',
                'raw',
                'print',
                '__separator__',
                '===== Edit =====',
                'RenamePage',
                'DeletePage',
                'revert',
                'CopyPage',
                'Load',
                'Save',
                'Despam',
                'editSideBar',
                '__separator__',
                '===== User =====',
                'quicklink',
                'subscribe',
            ]

        # menu element definitions
        menu_def = {
            'raw': {
                # Title for this menu entry
                'title': _('Raw Text'),
                # href and args are for normal entries ('special': False), otherwise ignored.
                # 'href': Nonexistent or empty for current page
                'href': '',
                # 'args': {'query1': 'value1', 'query2': 'value2', }
                # Optionally specify this for <a href="href?query1=value1&query2=value2">
                # If href and args are both nonexistent or empty, key is automatically interpreted to be an action name
                # and href and args are automatically set.
                'args': '',
                # 'special' can be:
                #   'disabled', 'removed', 'separator' or 'header' for whatever they say,
                #    False, None or nonexistent for normal menu display.
                # 'separator' and 'header' are automatically removed when there are no entries to show among them.
                'special': False,
            },
            'print': {'title': _('Print View'), },
            'refresh': {
                'title': _('Delete Cache'),
                'special': not (self.memodumpIsAvailableAction(page, 'refresh') and page.canUseCache()) and 'removed',
            },
            'SpellCheck': {'title': _('Check Spelling'), },
            'RenamePage': {'title': _('Rename Page'), },
            'CopyPage':   {'title': _('Copy Page'), },
            'DeletePage': {'title': _('Delete Page'), },
            'LikePages':  {'title': _('Like Pages'), },
            'LocalSiteMap': {'title': _('Local Site Map'), },
            'MyPages':    {'title': _('My Pages'), },
            'SubscribeUser': {
                'title': _('Subscribe User'),
#.........这里部分代码省略.........
开发者ID:Kartstig,项目名称:engineering-inventions-wiki,代码行数:101,代码来源:memodump.py


注:本文中的MoinMoin.wikiutil.getFrontPage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。