Attachment 'PackagePages.py-1.9.patch'

Download

   1 --- PackagePages.old.py	2009-03-14 14:22:44.000000000 +0100
   2 +++ PackagePages.py	2009-03-27 04:05:33.000000000 +0100
   3 @@ -69,6 +69,7 @@
   4          # Get new name from form and normalize.
   5          pagelist = self.request.values.get('pagelist', u'')
   6          packagename = self.request.values.get('packagename', u'')
   7 +        searchpattern = self.request.values.get('searchpattern', [u''])
   8          include_attachments = self.request.values.get('include_attachments', False)
   9  
  10          if not self.request.values.get('submit'):
  11 @@ -83,7 +84,15 @@
  12  
  13          request = self.request
  14          filelike = cStringIO.StringIO()
  15 -        package = self.collectpackage(unpackLine(pagelist, ","), filelike, target, include_attachments)
  16 +
  17 +        # Determine where to get pages from - list or pattern search
  18 +        if not searchpattern:
  19 +            package = self.collectpackage(unpackLine(pagelist, ","), filelike, target, include_attachments)
  20 +        else:
  21 +            searchpages = self.searchpackage(self.request, searchpattern)
  22 +            package = self.collectpackage(searchpages, filelike, target, include_attachments)
  23 +            pagelist = "".join([item.join(" ,") for item in searchpages]).strip(",")
  24 +
  25          request.content_type = 'application/zip'
  26          request.content_length = filelike.tell()
  27          request.headers.add('Content-Disposition', 'inline; filename="%s"' % target)
  28 @@ -111,6 +120,7 @@
  29              'cancel': _('Cancel'),
  30              'newname_label': _("Package name"),
  31              'list_label': _("List of page names - separated by a comma"),
  32 +            'searchpattern_label': _("Search pattern - takes priority over list of page names if specified"),
  33          }
  34          form = '''
  35  %(error)s
  36 @@ -124,15 +134,23 @@
  37          </td>
  38      </tr>
  39      <tr>
  40 +        <td class="label"><label>%(searchpattern_label)s</label></td>
  41 +        <td class="content">
  42 +            <input type="text" name="searchpattern" size="80" maxlength="200" value="">
  43 +        </td>
  44 +    </tr>
  45 +    <tr>
  46 +
  47          <td class="label"><label>%(list_label)s</label></td>
  48          <td class="content">
  49              <input type="text" name="pagelist" size="80" maxlength="200" value="%(pagename)s">
  50          </td>
  51      </tr>
  52      <tr>
  53 -        <td class="label">
  54 -        %(include_attachments_label)s<input type="checkbox" name="include_attachments" value="0" %(include_attachments_label)s>
  55 -    </td>
  56 +        <td class="label"> %(include_attachments_label)s </td>
  57 +        <td class="content">
  58 +           <input type="checkbox" name="include_attachments" value="0" %(include_attachments_label)s>
  59 +        </td>
  60      </tr>
  61      <tr>
  62          <td></td>
  63 @@ -149,7 +167,9 @@
  64      def searchpackage(self, request, searchkey):
  65          """ Search MoinMoin for the string specified and return a list of
  66          matching pages, provided they are not system pages and not
  67 -        present in the underlay.
  68 +        present in the underlay. The search is being performed only based on
  69 +        titles
  70 +
  71  
  72          @param request: current request
  73          @param searchkey: string to search for
  74 @@ -157,7 +177,7 @@
  75          @return: list of pages matching searchkey
  76          """
  77  
  78 -        pagelist = searchPages(request, searchkey)
  79 +        pagelist = searchPages(request, searchkey, titlesearch=1)
  80  
  81          titles = []
  82          for title in pagelist.hits:

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] (2009-03-26 16:52:56, 3.5 KB) [[attachment:PackagePages.py-1.8.patch]]
  • [get | view] (2009-03-27 03:07:27, 3.3 KB) [[attachment:PackagePages.py-1.9.patch]]
 All files | Selected Files: delete move to page copy to page

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