Attachment 'moin-1.2.3-attachfuncs.patch'
Download 1 # This is a patch for moin-1.2.3.orig to update it to moin-1.2.3
2 #
3 # To apply this patch:
4 # STEP 1: Chdir to the source directory.
5 # STEP 2: Run the 'applypatch' program with this patch file as input.
6 #
7 # If you do not have 'applypatch', it is part of the 'makepatch' package
8 # that you can fetch from the Comprehensive Perl Archive Network:
9 # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
10 # In the above URL, 'x' should be 2 or higher.
11 #
12 # To apply this patch without the use of 'applypatch':
13 # STEP 1: Chdir to the source directory.
14 # If you have a decent Bourne-type shell:
15 # STEP 2: Run the shell with this file as input.
16 # If you don't have such a shell, you may need to manually create
17 # the files as shown below.
18 # STEP 3: Run the 'patch' program with this file as input.
19 #
20 # These are the commands needed to create/delete files/directories:
21 #
22 touch 'MoinMoin/macro/AttachInfo.py'
23 chmod 0664 'MoinMoin/macro/AttachInfo.py'
24 touch 'MoinMoin/macro/AttachList.py'
25 chmod 0664 'MoinMoin/macro/AttachList.py'
26 #
27 # This command terminates the shell and need not be executed manually.
28 exit
29 #
30 #### End of Preamble ####
31
32 #### Patch data follows ####
33 diff -u 'moin-1.2.3.orig/MoinMoin/action/AttachFile.py' 'moin-1.2.3/MoinMoin/action/AttachFile.py'
34 Index: ./MoinMoin/action/AttachFile.py
35 --- ./MoinMoin/action/AttachFile.py Wed Jul 21 21:02:15 2004
36 +++ ./MoinMoin/action/AttachFile.py Thu Sep 23 12:45:11 2004
37 @@ -124,7 +124,7 @@
38 'count': len(files),
39 'link': Page(pagename).url(request, "action=AttachFile")
40 }
41 - request.write("\n<p>\n%s\n</p>\n" % attach_info)
42 + return "\n<p>\n%s\n</p>\n" % attach_info
43
44
45 #############################################################################
46 @@ -165,7 +165,7 @@
47 return (None, None)
48
49
50 -def _get_filelist(request, pagename):
51 +def _build_filelist(request, pagename, showheader, readonly):
52 _ = request.getText
53
54 # access directory
55 @@ -177,12 +177,13 @@
56
57 str = ""
58 if files:
59 - str = str + _("<p>"
60 - "To refer to attachments on a page, use <strong><tt>attachment:filename</tt></strong>, \n"
61 - "as shown below in the list of files. \n"
62 - "Do <strong>NOT</strong> use the URL of the <tt>[get]</tt> link, \n"
63 - "since this is subject to change and can break easily.</p>"
64 - )
65 + if showheader:
66 + str = str + _("<p>"
67 + "To refer to attachments on a page, use <strong><tt>attachment:filename</tt></strong>, \n"
68 + "as shown below in the list of files. \n"
69 + "Do <strong>NOT</strong> use the URL of the <tt>[get]</tt> link, \n"
70 + "since this is subject to change and can break easily.</p>"
71 + )
72 str = str + "<ul>"
73
74 label_del = _("del")
75 @@ -209,7 +210,7 @@
76 'pagename': pagename}
77
78 del_link = ''
79 - if request.user.may.delete(pagename):
80 + if request.user.may.delete(pagename) and not readonly:
81 del_link = '<a href="%(baseurl)s/%(urlpagename)s' \
82 '?action=%(action)s&do=del&target=%(urlfile)s">%(label_del)s</a> | ' % parmdict
83
84 @@ -225,11 +226,16 @@
85 ' (%(fsize)g KB) attachment:<strong>%(file)s</strong></li>') % parmdict
86 str = str + "</ul>"
87 else:
88 - str = '%s<p>%s</p>' % (str, _("No attachments stored for %(pagename)s") % {'pagename': pagename})
89 + if showheader:
90 + str = '%s<p>%s</p>' % (str, _("No attachments stored for %(pagename)s") % {'pagename': pagename})
91
92 return str
93 -
94 -
95 +
96 +
97 +def _get_filelist(request, pagename):
98 + return _build_filelist(request, pagename, 1, 0)
99 +
100 +
101 def error_msg(pagename, request, msg):
102 Page(pagename).send_page(request, msg=msg)
103
104 diff -u /dev/null 'moin-1.2.3/MoinMoin/macro/AttachInfo.py'
105 Index: ./MoinMoin/macro/AttachInfo.py
106 --- ./MoinMoin/macro/AttachInfo.py Thu Jan 1 01:00:00 1970
107 +++ ./MoinMoin/macro/AttachInfo.py Thu Sep 23 12:43:42 2004
108 @@ -0,0 +1,20 @@
109 +"""
110 + MoinMoin - AttachList Macro
111 +
112 + Written by Jacob Cohen.
113 + Rehashed & renamed by Nigel Metheringham
114 +
115 + A macro to produce information about attached pages
116 +
117 + Usage: [[AttachInfo]]
118 +
119 +"""
120 +
121 +from MoinMoin.action.AttachFile import info
122 +
123 +def execute(macro, args):
124 + pagename = macro.formatter.page.page_name
125 + if args:
126 + pagename = args
127 + result = info(pagename, macro.request);
128 + return result
129 diff -u /dev/null 'moin-1.2.3/MoinMoin/macro/AttachList.py'
130 Index: ./MoinMoin/macro/AttachList.py
131 --- ./MoinMoin/macro/AttachList.py Thu Jan 1 01:00:00 1970
132 +++ ./MoinMoin/macro/AttachList.py Thu Sep 23 12:43:40 2004
133 @@ -0,0 +1,20 @@
134 +"""
135 + MoinMoin - AttachList Macro
136 +
137 + Written by Jacob Cohen.
138 + Rehashed & renamed by Nigel Metheringham
139 +
140 + A macro to produce a list of attached pages
141 +
142 + Usage: [[AttachList]]
143 +
144 +"""
145 +
146 +from MoinMoin.action.AttachFile import _build_filelist
147 +
148 +def execute(macro, args):
149 + pagename = macro.formatter.page.page_name
150 + if args:
151 + pagename = args
152 + result = _build_filelist(macro.request, pagename, 0, 1);
153 + return result
154 diff -u 'moin-1.2.3.orig/MoinMoin/wikiaction.py' 'moin-1.2.3/MoinMoin/wikiaction.py'
155 Index: ./MoinMoin/wikiaction.py
156 --- ./MoinMoin/wikiaction.py Wed Jul 21 21:02:16 2004
157 +++ ./MoinMoin/wikiaction.py Thu Sep 23 12:45:17 2004
158 @@ -348,7 +348,8 @@
159
160 # show attachments (if allowed)
161 attachment_info = getHandler('AttachFile', 'info')
162 - if attachment_info: attachment_info(pagename, request)
163 + if attachment_info:
164 + request.write(attachment_info(pagename, request))
165
166 # show subscribers
167 subscribers = page.getSubscribers(request, include_self=1, return_users=1)
168 #### End of Patch data ####
169
170 #### ApplyPatch data follows ####
171 # Data version : 1.0
172 # Date generated : Thu Sep 23 12:45:24 2004
173 # Generated by : makepatch 2.00_07*
174 # Recurse directories : Yes
175 # Excluded files : (\A|/).*\~\Z
176 # (\A|/).*\.a\Z
177 # (\A|/).*\.bak\Z
178 # (\A|/).*\.BAK\Z
179 # (\A|/).*\.elc\Z
180 # (\A|/).*\.exe\Z
181 # (\A|/).*\.gz\Z
182 # (\A|/).*\.ln\Z
183 # (\A|/).*\.o\Z
184 # (\A|/).*\.obj\Z
185 # (\A|/).*\.olb\Z
186 # (\A|/).*\.old\Z
187 # (\A|/).*\.orig\Z
188 # (\A|/).*\.rej\Z
189 # (\A|/).*\.so\Z
190 # (\A|/).*\.Z\Z
191 # (\A|/)\.del\-.*\Z
192 # (\A|/)\.make\.state\Z
193 # (\A|/)\.nse_depinfo\Z
194 # (\A|/)core\Z
195 # (\A|/)tags\Z
196 # (\A|/)TAGS\Z
197 # (\A|/)\.\#.*\Z
198 # (\A|/)\#.*\Z
199 # (\A|/)_\$.*\Z
200 # (\A|/).*\$\Z
201 # (\A|/)CVS\Z
202 # (\A|/)CVS\.adm\Z
203 # (\A|/)cvslog\..*\Z
204 # (\A|/)\,.*\Z
205 # (\A|/).*\,v\Z
206 # (\A|/)RCS\Z
207 # (\A|/)RCSLOG\Z
208 # (\A|/)p\..*\Z
209 # (\A|/)s\..*\Z
210 # (\A|/)SCCS\Z
211 # p 'MoinMoin/action/AttachFile.py' 22090 1095939911 0100644
212 # c 'MoinMoin/macro/AttachInfo.py' 0 1095939822 0100664
213 # c 'MoinMoin/macro/AttachList.py' 0 1095939820 0100664
214 # p 'MoinMoin/wikiaction.py' 32803 1095939917 0100644
215 #### End of ApplyPatch data ####
216
217 #### End of Patch kit [created: Thu Sep 23 12:45:24 2004] ####
218 #### Patch checksum: 186 6673 729 ####
219 #### Checksum: 218 7851 35037 ####
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.