for name in pages:
letter = string.lower(name[0])
if letter != current_letter:
- s = s + '<a name="%s"><h3>%s</h3></a>' % (letter, letter)
+ s += '<a name="%s"><h3>%s</h3></a>' % (letter, letter)
current_letter = letter
else:
- s = s + '<br />'
- s = s + Page(name).link_to()
+ s += '<br />'
+ s += Page(name).link_to()
return s
return ''
def _hi_repl(self, word):
- if word == 'FIXME':
- cl = 'error'
- elif word == 'DONE':
- cl = 'success'
- elif word == 'TODO':
- cl = 'notice'
- return '<strong class="highlight ' + cl + '">' + word + '</strong>'
+ return '<strong class="highlight ' + word + '">' + word + '</strong>'
def _tr_repl(self, word):
out = ''
pre_re = re.compile(
r"(?:"
+ r"(?P<pre>\s*\}\}\})"
+ + r"|(?P<ent>[<>&])"
+ r")")
blank_re = re.compile(r"^\s*$")
indent_re = re.compile(r"^\s*")
return path.join(data_dir, self.page_name)
def _tmp_filename(self):
- return path.join(data_dir, ('#' + self.page_name + '.' + `os.getpid()` + '#'))
+ return path.join(data_dir, ('#' + self.page_name.replace('/','_') + '.' + `os.getpid()` + '#'))
def exists(self):
try:
except OSError, er:
if er.errno == errno.ENOENT:
return False
- else:
- raise er
+ raise er
def link_to(self):
word = self.page_name
return self.attrs
def get_attr(self, name, default):
- if self.get_attrs().has_key(name):
- return self.get_attrs()[name]
- else:
- return default
+ return self.get_attrs().get(name, default)
def can(self, action, default=True):
try:
for rule in acl.split():
(user,perms) = rule.split(':')
if user == remote_user() or user == "All":
- if action in perms.split(','):
- return True
- else:
- return False
+ return action in perms.split(',')
return False
except Exception, er:
pass