Attachment 'Page.py.patch'

Download

   1 46,47d45
   2 < from werkzeug import redirect
   3 < 
   4 220c218
   5 <             currentRevision = "%08d" % self.get_real_rev()
   6 ---
   7 >             currentRevision = "%08d" % page.get_real_rev()
   8 230c228
   9 <         approvedFile = os.path.join(self.getPagePath(), "approved")
  10 ---
  11 >         approvedFile = os.path.join(page.getPagePath(), "approved")
  12 243,306d240
  13 <     def getApprovalMessage(self):
  14 <         pi = self.parse_processing_instructions()
  15 <         if pi['review'] == None:
  16 <             return ""
  17 <         currentRevision = self.get_real_rev()
  18 <         approvedFile = os.path.join(self.getPagePath(), "approved")
  19 <         approvedRevision = []
  20 <         approvers = []
  21 <         approvedDateTime = []
  22 <         approvedURL = []
  23 <         boxtype = "warning"
  24 <         history = ""
  25 <         if os.path.isfile(approvedFile):
  26 <             for line in open(approvedFile).readlines():
  27 <                 tmp = line.split("\t")
  28 <                 approvedRevision.append(int(tmp[0]))
  29 <                 approvers.append(tmp[1])
  30 <                 #thatTime = datetime.strptime(tmp[2], "%Y/%m/%d %H:%M:S")
  31 <                 #approvedDateTime.append(thatTime.isoformat())
  32 <                 approvedDateTime.append(tmp[2])
  33 <                 approvedURL.append( '%s/%s?action=show&rev=%d' % ( 
  34 <                     self.request.getScriptname(), 
  35 <                     wikiutil.quoteWikinameURL(self.page_name), 
  36 <                     int(tmp[0])) )
  37 < 
  38 <             history = ""
  39 <             for i in range(len(approvedRevision)):
  40 <                 history = ("<a href=\"%s\">Version %d: approved on %s by %s\n<br>\n%s</a>") % (approvedURL[i], approvedRevision[i], approvedDateTime[i], approvers[i], history )
  41 < 
  42 <             if (currentRevision == len(self.getRevList())) and (not currentRevision == max(approvedRevision)):
  43 <                 # most recent version, not yet approved
  44 <                 status = "Draft"
  45 <                 boxtype = "caution"
  46 <             elif currentRevision == max(approvedRevision):
  47 <                 # latest approved version (could but need not be most recent version of all)
  48 <                 status = "Valid"
  49 <                 boxtype = "important"
  50 <             elif currentRevision in approvedRevision:
  51 <                 # any approved version (not the latest because of previous block)
  52 <                 status = "Invalid (approved, but outdated)!"
  53 <                 boxtype = "warning"
  54 <             else:
  55 <                 # some in-between version, never approved
  56 <                 status = "Invalid"
  57 <                 boxtype = "warning"
  58 <         else:
  59 <             # no approval history yet, so this is a draft
  60 <             status = "Draft"
  61 <             boxtype = "caution"
  62 < 
  63 <         return '''
  64 < <div id="content">
  65 < <div class="%s">
  66 < <dl>Version: <strong>%d</strong> Status: <strong>%s</strong><dd>
  67 < <small>
  68 <   %s
  69 < </small>
  70 < </dd></dl>
  71 < </div>
  72 < </div>
  73 < ''' % (boxtype, currentRevision, status, history)
  74 < 
  75 < 
  76 < 
  77 1005d938
  78 <         pi['review'] = None
  79 1061,1063d993
  80 <             elif verb == "review":
  81 <                 # this page can be reviewed (and approved)
  82 <                 pi['review'] = args
  83 1184d1113
  84 <         unapproved = 0
  85 1193,1207d1121
  86 <                         # before sending anything check if we need to redirect to the last approved version
  87 <                         if (pi['review'] != None) and (not self.isApprovedPage()) and (not request.user.may.review(self.page_name)):
  88 <                             lastApprovedRevision = self.getLastApprovedVersion()
  89 <                             if (lastApprovedRevision != None):
  90 <                               # redirect to last approved version
  91 <                               rev = int(lastApprovedRevision)
  92 <                               url_str = '%s/%s?action=show&rev=%d' % (
  93 <                                   request.getScriptname(),
  94 <                                   wikiutil.quoteWikinameURL(self.page_name),
  95 <                                   rev)
  96 <                               request.http_redirect(url_str)
  97 <                               return
  98 <                             else:
  99 <                               # TODO check how to display "You are not allowed to view..." or "Not yes approved"
 100 <                               unapproved = 1
 101 1302,1303d1215
 102 <             elif unapproved == 1:
 103 <                 special = 'denied'

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] (2010-02-05 17:13:18, 2.6 KB) [[attachment:ApprovePage-191.py]]
  • [get | view] (2005-10-18 14:16:34, 2.8 KB) [[attachment:ApprovePage.py]]
  • [get | view] (2005-11-08 14:48:57, 2.9 KB) [[attachment:ApprovePage.py-20050811]]
  • [get | view] (2005-11-08 14:51:44, 2.9 KB) [[attachment:ApprovePage.py-20050811-2]]
  • [get | view] (2010-11-18 09:43:04, 7.1 KB) [[attachment:Page.diff-v193-18112010]]
  • [get | view] (2010-02-05 17:15:25, 78.1 KB) [[attachment:Page.py]]
  • [get | view] (2010-11-18 09:41:22, 79.2 KB) [[attachment:Page.py-v193-18112010]]
  • [get | view] (2010-02-05 17:15:58, 4.3 KB) [[attachment:Page.py.patch]]
  • [get | view] (2008-02-12 01:09:14, 4.3 KB) [[attachment:PageApproval.diff]]
  • [get | view] (2010-02-05 17:25:50, 21.4 KB) [[attachment:approval-history.png]]
  • [get | view] (2010-11-18 10:19:10, 2.4 KB) [[attachment:approvePage.py-v193-18112010]]
  • [get | view] (2006-12-04 21:40:20, 3.0 KB) [[attachment:approvepage2.py]]
  • [get | view] (2005-10-18 14:17:03, 4.5 KB) [[attachment:modern.py]]
  • [get | view] (2010-11-18 09:42:23, 3.8 KB) [[attachment:modern_iso.diff-v193-18112010]]
  • [get | view] (2005-11-08 14:48:07, 4.6 KB) [[attachment:modern_iso.py]]
  • [get | view] (2010-11-18 09:40:06, 6.2 KB) [[attachment:modern_iso.py-v193-18112010]]
  • [get | view] (2006-12-04 21:40:00, 4.9 KB) [[attachment:modern_iso2.py]]
  • [get | view] (2010-11-18 09:40:39, 15.0 KB) [[attachment:modernized_iso.py-v193-18112010]]
  • [get | view] (2006-12-04 21:40:39, 1.5 KB) [[attachment:page.diff]]
  • [get | view] (2010-11-18 10:10:42, 7.2 KB) [[attachment:rightsidebar_iso.py-v193-18112010]]
  • [get | view] (2010-02-05 17:13:56, 29.0 KB) [[attachment:solenoid_iso-191.py]]
  • [get | view] (2010-02-05 17:15:05, 1.4 KB) [[attachment:solenoid_iso-191.py.patch]]
 All files | Selected Files: delete move to page copy to page

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