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


Python Page.isUnderlayPage方法代码示例

本文整理汇总了Python中MoinMoin.Page.Page.isUnderlayPage方法的典型用法代码示例。如果您正苦于以下问题:Python Page.isUnderlayPage方法的具体用法?Python Page.isUnderlayPage怎么用?Python Page.isUnderlayPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MoinMoin.Page.Page的用法示例。


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

示例1: testBasicPackageThings

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isUnderlayPage [as 别名]
 def testBasicPackageThings(self):
     become_superuser(self.request)
     myPackage = DebugPackage(self.request, 'test')
     myPackage.installPackage()
     assert myPackage.msg == u'foo\nFooPage added \n'
     testseite2 = Page(self.request, 'TestSeite2')
     assert testseite2.getPageText() == "Hello world, I am the file testdatei"
     assert testseite2.isUnderlayPage()
开发者ID:steveyen,项目名称:moingo,代码行数:10,代码来源:test_packages.py

示例2: testBasicPackageThings

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isUnderlayPage [as 别名]
 def testBasicPackageThings(self):
     myPackage = DebugPackage(self.request, 'test')
     myPackage.installPackage()
     self.assertEqual(myPackage.msg, "foo\n")
     testseite2 = Page(self.request, 'TestSeite2')
     self.assertEqual(testseite2.getPageText(), "Hello world, I am the file testdatei")
     self.assert_(testseite2.isUnderlayPage())
     self.assert_(not Page(self.request, 'FooPage').exists())
开发者ID:imosts,项目名称:flume,代码行数:10,代码来源:test_packages.py

示例3: execute

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isUnderlayPage [as 别名]
def execute(macro, args):

   request = macro.request

   # get params
   if args:
      args = args.split(',')
   else:
      args = []

   kw = {}
   for arg in args :
      if '=' in arg:
         key, value = arg.split('=', 1)
         kw[str(key.strip())] = value.strip()

   try:
      maxTags = int( kw["maxTags"] )
   except (KeyError, ValueError):
      maxTags = 50

   try:
      autoCreate = kw["autoCreate"]
      if autoCreate == "true" or autoCreate == "True":
         autoCreate = True
      else:
         autoCreate = False

   except (KeyError):
      autoCreate = False

   #{level:hits , level:hits , ...}
   level = { 0 : 4 , 1 : 7 , 2 : 12 , 3 : 18 , 4 : 25 , 5 : 35 , 6 : 50 , 7 : 60 , 8 : 90 }

   args = r'regex:((\r)?\n----(\r)?\n[a-zA-Z])'

   # Search the pages
   query = search.QueryParser().parse_query(args)
   results = search.searchPages(request, query)
   pages = [hit.page_name for hit in results.hits]

   tags = []

   for page in pages:
      page = Page(request, page)
      if page.isStandardPage() and not page.isUnderlayPage():
         body = page.get_raw_body()
         match = re.search(r'----(\r)?\n(?P<tags>.*)(\r)?\n', body)
         match = match.group('tags')
         match = match.split(',')
         for tag in match:
            tags.insert(0, (str(tag)).strip())

   taglist = []
   taglist = list(frozenset(tags))

   def sort(t):
      return t[1]

   show = []
   for tag in taglist:
      show.append( (tag, tags.count(tag)) )
   show.sort(key=sort, reverse=True)
   show = show[0:maxTags]
   show.sort()

   html = []

   for tag in show:

      pagename = tag[0]
      hits = tag[1]

      # auto create tag page if not exist
      if autoCreate:
         page = Page(request, pagename)
         if page.isStandardPage(includeDeleted=False) == False and page.isUnderlayPage() == False:

            from MoinMoin.security import Permissions
            class SecurityPolicy(Permissions):
               def write(*args, **kw):
                  return True
               def save(*args, **kw):
                  return True
            request.user.may = SecurityPolicy(request.user)

            PageEditor(request, pagename).saveText(ur"[[FullSearch(regex:(-{4}(\r)?\n(.*)%s))]]"%(tag[0]), 0)

      #level0
      if hits < level[0]:
         html.append(u'<span  style="font-size:0.65em;"><a href="%s"> %s</a></span>'%(pagename, tag[0]))
      #level1
      elif hits < level[1]:
         html.append(u'<span  style="font-size:0.75em;"><a href="%s"> %s</a></span>'%(pagename, tag[0]))
      #level2
      elif hits < level[2]:
         html.append(u'<span  style="font-size:0.9em;"><a href="%s"> %s</a></span>'%(pagename, tag[0]))
      #level3
      elif hits < level[3]:
         html.append(u'<span  style="font-size:1.0em;"><a href="%s"> %s</a></span>'%(pagename, tag[0]))
#.........这里部分代码省略.........
开发者ID:3100,项目名称:MoinMacro,代码行数:103,代码来源:TagCloud.py

示例4: filter

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isUnderlayPage [as 别名]
 def filter(name):
     page = Page(self.request, name)
     return (page.isStandardPage(includeDeleted=0) and
             page.isUnderlayPage(includeDeleted=0))
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:6,代码来源:EditedSystemPages.py

示例5: Page

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isUnderlayPage [as 别名]
    #{level:hits , level:hits , ...}
    level = {0: 4, 1: 7, 2: 12, 3: 18, 4: 25, 5: 35, 6: 50, 7: 60, 8: 90}

    #fetch all pages, except underlays
    pages = request.rootpage.getPageList(exists=1, include_underlay=False, )
    if not pages:
        errorMsg.append(fmt.div(True, css_class="error"))
        errorMsg.append(_("No pages exist or you have not enough rights to view them"))
        errorMsg.append(fmt.div(False))
        return ''.join(errorMsg)

    #find CategoryFoo tags and count them

    for page in pages:
        page = Page(request, page)
        if page.isStandardPage() and not page.isUnderlayPage():
            body = page.get_raw_body()
            #match = re.search(ur'----(\r)?\n(.*)(?P<all>' + categoryKey + ur'(?P<category>\S+))', body)
            match = re.search(ur'(?m)(^-----*\s*\r?\n)(^##.*\r?\n)*^(?!##)(.*)(?P<all>' + categoryKey + ur'(?P<category>[^ \s\]]+))', body)
            if match == None:
                continue
            match = match.group('category')
            match = match.split(tagSplit)
            for tag in match:
                tags.insert(0, (str(tag.encode('utf8'))).strip())
    taglist = list(frozenset(tags))

    #sorting the taglist and output as show
    def sort(t):
        return t[1]
开发者ID:3100,项目名称:MoinMacro,代码行数:32,代码来源:CategoryCloud.py


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