Attachment 'include.py'

Download

   1 --- Include(2).py	2010-11-17 12:39:24.227340200 +0100
   2 +++ Include.py	2010-11-17 12:39:04.758714800 +0100
   3 @@ -21,6 +21,7 @@
   4  import re, StringIO
   5  from MoinMoin import wikiutil
   6  from MoinMoin.Page import Page
   7 +from MoinMoin.search import searchPages
   8  
   9  
  10  _sysmsg = '<p><strong class="%s">%s</strong></p>'
  11 @@ -30,13 +31,14 @@
  12  _arg_level = r',\s*(?P<level>\d*)'
  13  _arg_from = r'(,\s*from=(?P<fquote>[\'"])(?P<from>.+?)(?P=fquote))?'
  14  _arg_to = r'(,\s*to=(?P<tquote>[\'"])(?P<to>.+?)(?P=tquote))?'
  15 +_arg_cat = r'(,\s*cat=(?P<cquote>[\'"])(?P<cat>.+?)(?P=cquote))?'
  16  _arg_sort = r'(,\s*sort=(?P<sort>(ascending|descending)))?'
  17  _arg_items = r'(,\s*items=(?P<items>\d+))?'
  18  _arg_skipitems = r'(,\s*skipitems=(?P<skipitems>\d+))?'
  19  _arg_titlesonly = r'(,\s*(?P<titlesonly>titlesonly))?'
  20  _arg_editlink = r'(,\s*(?P<editlink>editlink))?'
  21 -_args_re_pattern = r'^(?P<name>[^,]+)(%s(%s)?%s%s%s%s%s%s%s)?$' % (
  22 -    _arg_heading, _arg_level, _arg_from, _arg_to, _arg_sort, _arg_items,
  23 +_args_re_pattern = r'^(?P<name>[^,]+)(%s(%s)?%s%s%s%s%s%s%s%s)?$' % (
  24 +    _arg_heading, _arg_level, _arg_from, _arg_to, _arg_cat,_arg_sort, _arg_items,
  25      _arg_skipitems, _arg_titlesonly, _arg_editlink)
  26  
  27  _title_re = r"^(?P<heading>\s*(?P<hmarker>=+)\s.*\s(?P=hmarker))$"
  28 @@ -72,17 +74,14 @@
  29      if not hasattr(this_page, '_macroInclude_pagelist'):
  30          this_page._macroInclude_pagelist = {}
  31  
  32 -    # get list of pages to include
  33 -    inc_name = wikiutil.AbsPageName(this_page.page_name, args.group('name'))
  34 -    pagelist = [inc_name]
  35 -    if inc_name.startswith("^"):
  36 -        try:
  37 -            inc_match = re.compile(inc_name)
  38 -        except re.error:
  39 -            pass # treat as plain page name
  40 -        else:
  41 -            # Get user filtered readable page list
  42 -            pagelist = request.rootpage.getPageList(filter=inc_match.match)
  43 +    # create search string
  44 +    # TODO: without Categories, REGEX enabled, Performance Testing
  45 +    needle = """title:"%(title)s" mimetype:wiki cat:"%(category)s" """ % {"title": args.group('name'),  "category" : args.group('cat') }
  46 +    # search and add them to the pagelist
  47 +    pagelist = []
  48 +    searchresult =  searchPages(request, needle)
  49 +    for title in searchresult.hits:
  50 +        pagelist.append(title.page_name)
  51  
  52      # sort and limit page list
  53      pagelist.sort()
  54 @@ -229,6 +228,7 @@
  55          # XXX page.link_to is wrong now, it escapes the edit_icon html as it escapes normal text
  56  
  57      # return include text
  58 +
  59      return ''.join(result)
  60  
  61 -# vim:ts=4:sw=4:et
  62 +# vim:ts=4:sw=4:et
  63 \ No newline at end of file

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2012-06-26 21:26:32, 1.6 KB) [[attachment:GlamMetalRadio.py]]
  • [get | view] (2010-06-02 22:02:32, 8.2 KB) [[attachment:RSSReader.py]]
  • [get | view] (2010-11-17 11:48:56, 2.5 KB) [[attachment:include.py]]
  • [get | view] (2011-09-07 11:55:07, 1.9 KB) [[attachment:moin.wsgi]]
  • [get | view] (2011-09-08 17:49:41, 2.8 KB) [[attachment:moinmoin.sh]]
  • [get | view] (2011-09-07 11:54:54, 1.0 KB) [[attachment:nginx.conf]]
  • [get | view] (2009-01-09 14:12:23, 136.3 KB) [[attachment:screenshot-piwik.png]]
  • [get | view] (2011-09-07 11:54:59, 0.5 KB) [[attachment:uwsgi.xml]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.