Attachment 'PackagePages.py-1.8.patch'
Download 1 --- PackagePages.py.old 2009-01-07 01:26:50.000000000 +0100
2 +++ PackagePages.py 2009-03-26 17:50:59.000000000 +0100
3 @@ -69,6 +69,7 @@
4
5 # Get new name from form and normalize.
6 pagelist = form.get('pagelist', [u''])[0]
7 + searchpattern = form.get('searchpattern', [u''])[0]
8 packagename = form.get('packagename', [u''])[0]
9 include_attachments = form.get('include_attachments', [False])[0]
10
11 @@ -92,7 +93,16 @@
12
13 # Generate a package
14 output = open(fpath, "wb")
15 - package = self.collectpackage(unpackLine(pagelist, ","), output, 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, ","), output,
20 + target, include_attachments)
21 + else:
22 + searchpages = self.searchpackage(self.request, searchpattern)
23 + package = self.collectpackage(searchpages, output, target,
24 + include_attachments)
25 + pagelist = "".join([item.join(" ,") for item in searchpages]).strip(",")
26
27 if package:
28 self.request.theme.add_msg(self.makeform(), "dialog")
29 @@ -100,7 +110,7 @@
30
31 _addLogEntry(self.request, 'ATTNEW', self.pagename, target)
32
33 - self.request.theme.add_msg(_("Created the package %s containing the pages %s.") % (wikiutil.escape(target), wikiutil.escape(pagelist)))
34 + self.request.theme.add_msg(_("Created the package %s containing the pages:<br> %s.") % (wikiutil.escape(target), wikiutil.escape(pagelist)))
35 raise ActionError
36
37 def makeform(self, error=""):
38 @@ -125,6 +135,7 @@
39 'cancel': _('Cancel'),
40 'newname_label': _("Package name"),
41 'list_label': _("List of page names - separated by a comma"),
42 + 'searchpattern_label': _("Search pattern - takes priority over list of page names if specified"),
43 }
44 form = '''
45 %(error)s
46 @@ -138,15 +149,22 @@
47 </td>
48 </tr>
49 <tr>
50 + <td class="label"><label>%(searchpattern_label)s</label></td>
51 + <td class="content">
52 + <input type="text" name="searchpattern" size="80" maxlength="200" value="">
53 + </td>
54 + </tr>
55 + <tr>
56 <td class="label"><label>%(list_label)s</label></td>
57 <td class="content">
58 <input type="text" name="pagelist" size="80" maxlength="200" value="%(pagename)s">
59 </td>
60 </tr>
61 <tr>
62 - <td class="label">
63 - %(include_attachments_label)s<input type="checkbox" name="include_attachments" value="0" %(include_attachments_label)s>
64 - </td>
65 + <td class="label"> %(include_attachments_label)s </td>
66 + <td class="content">
67 + <input type="checkbox" name="include_attachments" value="0" %(include_attachments_label)s>
68 + </td>
69 </tr>
70 <tr>
71 <td></td>
72 @@ -163,7 +181,8 @@
73 def searchpackage(self, request, searchkey):
74 """ Search MoinMoin for the string specified and return a list of
75 matching pages, provided they are not system pages and not
76 - present in the underlay.
77 + present in the underlay. The search is being performed only based on
78 + titles
79
80 @param request: current request
81 @param searchkey: string to search for
82 @@ -171,7 +190,7 @@
83 @return: list of pages matching searchkey
84 """
85
86 - pagelist = searchPages(request, searchkey)
87 + pagelist = searchPages(request, searchkey, titlesearch=1)
88
89 titles = []
90 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.You are not allowed to attach a file to this page.