Attachment 'DeleteTemplateCategories.patch'
Download 1 --- PageEditor.py.orig 2005-07-14 14:29:57.000000000 +0100
2 +++ PageEditor.py 2005-07-14 15:03:57.000000000 +0100
3 @@ -18,6 +18,7 @@
4 import MoinMoin.util.mail
5 import MoinMoin.util.datetime
6
7 +re_ct = re.compile("Category.*Template")
8
9 #############################################################################
10 ### Javascript code for editor page
11 @@ -156,6 +157,22 @@
12
13 return False
14
15 + def stripCategoryTemplate(self, raw_body):
16 + bits = raw_body.split('\n----\n', 1)
17 + if len(bits) == 1:
18 + return raw_body
19 + else:
20 + start = '\n----\n'.join(bits[:-1])
21 + end = bits[-1]
22 +
23 + end = re_ct.sub("", end)
24 + end = end.strip()
25 +
26 + if end:
27 + return "%s\n----\n%s\n" % (start, end)
28 + else:
29 + return start
30 +
31 def sendEditor(self, **kw):
32 """
33 Send the editor form page.
34 @@ -292,6 +309,7 @@
35 if self.request.user.may.read(template_page):
36 raw_body = Page(self.request, template_page).get_raw_body()
37 if raw_body:
38 + raw_body = self.stripCategoryTemplate(raw_body)
39 self.request.write(_("[Content of new page loaded from %s]") % (template_page,), '<br>')
40 else:
41 self.request.write(_("[Template %s not found]") % (template_page,), '<br>')
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.