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.You are not allowed to attach a file to this page.