Details

Applies to

MoinMoin core ( PageEditor.py ) v1.8.2, 1.9beta2

Purpose
To allow for @PARENT@ variable expansion, to allow for @PAGENAME@ variable expansion
Description

Patch adds new variables definition, @PARENT@ and @PAGENAME@. @PARENT@ expands to the parent page name. The application area is very huge - from creating absolute backlinks in templates to better ACL's (e.g. ../ReadWriteGroup page ACL allows for ../AdminGroup members to edit it). @PAGENAME@ expands to the abbreviated page name (the MoinMoinPatch/ParentVariable without parent page part) - it will allow to create much better templates

Patch

   1 --- PageEditor.py.orig	2009-03-14 14:22:44.000000000 +0100
   2 +++ PageEditor.py	2009-03-27 04:17:51.000000000 +0100
   3 @@ -765,8 +765,12 @@
   4          u = request.user
   5          obfuscated_email_address = encodeSpamSafeEmail(u.email)
   6          signature = u.signature()
   7 +        parent_page = Page(self.request, self.page_name).getParentPage() 
   8 +
   9          variables = {
  10 +            'PARENT': (parent_page.page_name if parent_page is not None else ''),
  11              'PAGE': self.page_name,
  12 +            'PAGENAME': self.page_name[self.page_name.rfind('/')+1:],
  13              'TIME': "<<DateTime(%s)>>" % now,
  14              'DATE': "<<Date(%s)>>" % now,
  15              'ME': u.name,

PageEditor.py-1.8-1.9.patch

   1 --- PageEditor.py.dist	2010-06-26 23:46:40.000000000 +0200
   2 +++ PageEditor.py	2010-09-01 13:53:58.000000000 +0200
   3 @@ -779,8 +779,11 @@
   4          u = request.user
   5          obfuscated_email_address = encodeSpamSafeEmail(u.email)
   6          signature = u.signature()
   7 +        parent_page = Page(self.request, self.page_name).getParentPage() 
   8          variables = {
   9              'PAGE': self.page_name,
  10 +            'PAGENAME': self.page_name[self.page_name.rfind('/')+1:],
  11 +            'PARENT': (parent_page.page_name if parent_page is not None else ''),
  12              'TIMESTAMP': now,
  13              'TIME': "<<DateTime(%s)>>" % now,
  14              'DATE': "<<Date(%s)>>" % now,
PageEditor.py-1.9.3.patch

Discussion

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/ParentVariable (last edited 2010-09-01 15:45:08 by StellarsHenson)