Mercurial > moin > 1.9
changeset 950:4eb66637ccd0
whitespace-only cleanup, small style changes
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Mon, 17 Jul 2006 04:27:24 +0200 |
parents | cbbde07e00c4 |
children | b8c1bb917748 |
files | MoinMoin/macro/Action.py MoinMoin/macro/AttachInfo.py MoinMoin/macro/AttachList.py MoinMoin/macro/EditTemplates.py MoinMoin/macro/EditedSystemPages.py MoinMoin/macro/EmbedObject.py MoinMoin/macro/FootNote.py MoinMoin/macro/FullSearch.py MoinMoin/macro/ImageLink.py MoinMoin/macro/LikePages.py MoinMoin/macro/MonthCalendar.py MoinMoin/macro/NewPage.py MoinMoin/macro/OrphanedPages.py MoinMoin/macro/PageHits.py MoinMoin/macro/RandomPage.py MoinMoin/macro/RandomQuote.py MoinMoin/macro/RecentChanges.py MoinMoin/macro/SystemAdmin.py MoinMoin/macro/SystemInfo.py MoinMoin/macro/TableOfContents.py MoinMoin/macro/TeudView.py MoinMoin/macro/WantedPages.py MoinMoin/macro/__init__.py |
diffstat | 23 files changed, 161 insertions(+), 155 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/macro/Action.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/Action.py Mon Jul 17 04:27:24 2006 +0200 @@ -32,16 +32,16 @@ self.request = macro.request self.args = self.getArgs(args) - def getArgs(self, string): + def getArgs(self, argstr): """ Temporary function until Oliver Graf args parser is finished @param string: string from the wiki markup [[NewPage(string)]] @rtype: dict @return: dictionary with macro options """ - if not string: + if not argstr: return {} - args = [s.strip() for s in string.split(',')] + args = [s.strip() for s in argstr.split(',')] args = dict(zip(self.arguments, args)) return args @@ -56,10 +56,10 @@ # Default to show page instead of an error message (too lazy to # do an error message now). action = self.args.get('action', 'show') - + # Use translated text or action name text = self.args.get('text', action) - text = _(text, formatted=False) + text = _(text, formatted=False) # Escape user input action = wikiutil.escape(action, 1)
--- a/MoinMoin/macro/AttachInfo.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/AttachInfo.py Mon Jul 17 04:27:24 2006 +0200 @@ -15,6 +15,6 @@ pagename = macro.formatter.page.page_name if args: pagename = args - result = info(pagename, macro.request); + result = info(pagename, macro.request) return result
--- a/MoinMoin/macro/AttachList.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/AttachList.py Mon Jul 17 04:27:24 2006 +0200 @@ -15,6 +15,6 @@ pagename = macro.formatter.page.page_name if args: pagename = args - result = _build_filelist(macro.request, pagename, 0, 1); + result = _build_filelist(macro.request, pagename, 0, 1) return result
--- a/MoinMoin/macro/EditTemplates.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/EditTemplates.py Mon Jul 17 04:27:24 2006 +0200 @@ -32,5 +32,6 @@ result = result + self.formatter.bullet_list(0) return result - + return '' +
--- a/MoinMoin/macro/EditedSystemPages.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/EditedSystemPages.py Mon Jul 17 04:27:24 2006 +0200 @@ -31,7 +31,7 @@ # Get page filtered page list. We don't need to filter by # exists, because our filter check this already. pages = self.request.rootpage.getPageList(filter=filter, exists=0) - + # Format as numberd list, sorted by page name pages.sort() result = [] @@ -44,7 +44,7 @@ result.append(f.pagelink(0, name)) result.append(f.listitem(0)) result.append(f.number_list(0)) - + return ''.join(result)
--- a/MoinMoin/macro/EmbedObject.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/EmbedObject.py Mon Jul 17 04:27:24 2006 +0200 @@ -89,7 +89,7 @@ kw["loop"] = "true" kw["quality"] = "high" - for arg in args : + for arg in args: if '=' in arg: kw_count += 1 key, value = arg.split('=', 1) @@ -139,7 +139,7 @@ "quality": kw["quality"], "file": url, } - elif mime_type == "image/svg+xml": + elif mime_type == "image/svg+xml": return ''' <OBJECT CLASSID="" WIDTH="%(width)s" @@ -188,7 +188,7 @@ <PARAM NAME="Zoom" VALUE="-1"> <PARAM NAME = "SRC" VALUE = "%(file)s">Your browser cannot display Visio</OBJECT>''' % { "width": kw['width'], - "height": kw['height'], + "height": kw['height'], "file": url, } else:
--- a/MoinMoin/macro/FootNote.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/FootNote.py Mon Jul 17 04:27:24 2006 +0200 @@ -19,7 +19,7 @@ # create storage for footnotes if not hasattr(macro.request, 'footnotes'): macro.request.footnotes = [] - + if not args: return emit_footnotes(macro.request, macro.formatter) else: @@ -29,7 +29,7 @@ macro.request.footnotes.append((args, fn_id)) return "%s%s%s%s%s" % ( macro.formatter.sup(1), - macro.formatter.anchorlink(1, 'fndef' + fn_id, id = 'fnref' + fn_id), + macro.formatter.anchorlink(1, 'fndef' + fn_id, id='fnref' + fn_id), macro.formatter.text(str(idx+1)), macro.formatter.anchorlink(0), macro.formatter.sup(0),) @@ -51,15 +51,15 @@ # Add item result.append(formatter.listitem(1)) result.append(formatter.paragraph(1)) # see [1] - + fn_id = request.footnotes[idx][1] result.append(formatter.anchorlink(1, 'fnref' + fn_id, id='fndef' + fn_id)) result.append(formatter.text(str(idx + 1))) result.append(formatter.anchorlink(0)) result.append(formatter.text(" ")) - - out=StringIO.StringIO() + + out = StringIO.StringIO() request.redirect(out) parser = WikiParser(request.footnotes[idx][0], request, line_anchors=False) @@ -69,7 +69,7 @@ del out # [1] paragraph is automagically closed by wiki parser! result.append(formatter.listitem(0)) - + result.append(formatter.bullet_list(0)) # Finish div
--- a/MoinMoin/macro/FullSearch.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/FullSearch.py Mon Jul 17 04:27:24 2006 +0200 @@ -48,7 +48,7 @@ # TODO: search should implement those errors message for clients elif needle.isspace(): err = _('Please use a more selective search term instead of ' - '{{{"%s"}}}') % needle + '{{{"%s"}}}') % needle return '<span class="error">%s</span>' % err needle = needle.strip()
--- a/MoinMoin/macro/ImageLink.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/ImageLink.py Mon Jul 17 04:27:24 2006 +0200 @@ -113,7 +113,7 @@ argc = len(args) kw_count = 0 kw = {} # create a dictionary for the formatter.image call - for arg in args : + for arg in args: if '=' in arg: kw_count += 1 key, value = arg.split('=', 1) @@ -132,7 +132,7 @@ target = AttachFile.getAttachUrl(pagename, image, request) else: target = None - + if _is_URL(image): kw['src'] = image else: @@ -159,11 +159,11 @@ if target is None: target = kw['src'] - + if argc == 1: return "%s%s%s" % (formatter.url(1, kw['src']), formatter.image(**kw), - formatter.url(0)) + formatter.url(0)) if _is_URL(target): return "%s%s%s" % (formatter.url(1, target),
--- a/MoinMoin/macro/LikePages.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/LikePages.py Mon Jul 17 04:27:24 2006 +0200 @@ -13,7 +13,7 @@ def execute(macro, args): request = macro.request pagename = macro.formatter.page.page_name - + # Get matches start, end, matches = LikePages.findMatches(pagename, request) @@ -22,3 +22,4 @@ return request.redirectedOutput(LikePages.showMatches, pagename, request, start, end, matches, False) return args +
--- a/MoinMoin/macro/MonthCalendar.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/MonthCalendar.py Mon Jul 17 04:27:24 2006 +0200 @@ -145,7 +145,7 @@ [[MonthCalendar(,,,,,,MonthCalendarTemplate)]] """ -Dependencies = ['namespace','time'] +Dependencies = ['namespace', 'time', ] from MoinMoin import wikiutil from MoinMoin.Page import Page @@ -158,13 +158,13 @@ # XXX change here ----------------vvvvvv calendar.setfirstweekday(calendar.MONDAY) -def cliprgb(r,g,b): # don't use 255! - if r < 0: r=0 - if r > 254: r=254 - if b < 0: b=0 - if b > 254: b=254 - if g < 0: g=0 - if g > 254: g=254 +def cliprgb(r, g, b): # don't use 255! + if r < 0: r = 0 + if r > 254: r = 254 + if b < 0: b = 0 + if b > 254: b = 254 + if g < 0: g = 0 + if g > 254: g = 254 return r, g, b def yearmonthplusoffset(year, month, offset): @@ -198,7 +198,7 @@ parmmonth = int(strmonth) else: parmmonth = defmonth - + stroffset = args.group('offset') if stroffset: parmoffset = int(stroffset) @@ -229,7 +229,7 @@ else: parmtemplate = deftemplate return parmpagename, parmyear, parmmonth, parmoffset, parmoffset2, parmheight6, parmanniversary, parmtemplate - + # FIXME: vvvvvv is there a better way for matching a pagename ? _arg_basepage = r'\s*(?P<basepage>[^, ]+)?\s*' _arg_year = r',\s*(?P<year>\d+)?\s*' @@ -237,11 +237,11 @@ _arg_offset = r',\s*(?P<offset>[+-]?\d+)?\s*' _arg_offset2 = r',\s*(?P<offset2>[+-]?\d+)?\s*' _arg_height6 = r',\s*(?P<height6>[+-]?\d+)?\s*' -_arg_anniversary = r',\s*(?P<anniversary>[+-]?\d+)?\s*' +_arg_anniversary = r',\s*(?P<anniversary>[+-]?\d+)?\s*' _arg_template = r',\s*(?P<template>[^, ]+)?\s*' # XXX see basepage comment _args_re_pattern = r'^(%s)?(%s)?(%s)?(%s)?(%s)?(%s)?(%s)?(%s)?$' % \ - (_arg_basepage,_arg_year,_arg_month, \ - _arg_offset,_arg_offset2,_arg_height6,_arg_anniversary,_arg_template) + (_arg_basepage, _arg_year, _arg_month, \ + _arg_offset, _arg_offset2, _arg_height6, _arg_anniversary, _arg_template) def execute(macro, text): @@ -254,7 +254,7 @@ return '' args_re = re.compile(_args_re_pattern) - + currentyear, currentmonth, currentday, h, m, s, wd, yd, ds = request.user.getTime(time.time()) thispage = formatter.page.page_name # does the url have calendar params (= somebody has clicked on prev/next links in calendar) ? @@ -285,20 +285,20 @@ # does url have calendar params and is THIS the right calendar to modify (we can have multiple # calendars on the same page)? #if has_calparms and (cparmpagename,cparmyear,cparmmonth,cparmoffset) == (parmpagename,parmyear,parmmonth,parmoffset): - + # move all calendars when using the navigation: if has_calparms and cparmpagename == parmpagename: - year,month = yearmonthplusoffset(parmyear, parmmonth, parmoffset + cparmoffset2) + year, month = yearmonthplusoffset(parmyear, parmmonth, parmoffset + cparmoffset2) parmoffset2 = cparmoffset2 parmtemplate = cparmtemplate else: - year,month = yearmonthplusoffset(parmyear, parmmonth, parmoffset) + year, month = yearmonthplusoffset(parmyear, parmmonth, parmoffset) # get the calendar monthcal = calendar.monthcalendar(year, month) # european / US differences - months = ('January','February','March','April','May','June','July','August','September','October','November','December') + months = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') # Set things up for Monday or Sunday as the first day of the week if calendar.firstweekday() == calendar.MONDAY: wkend = (5, 6) @@ -312,15 +312,15 @@ qpagenames = '*'.join(map(wikiutil.quoteWikinameURL, parmpagename)) qtemplate = wikiutil.quoteWikinameURL(parmtemplate) querystr = "calparms=%%s,%d,%d,%d,%%d,%%s" % (parmyear, parmmonth, parmoffset) - prevlink = p.url(request, querystr % (qpagenames, parmoffset2 - 1, qtemplate), 0) - nextlink = p.url(request, querystr % (qpagenames, parmoffset2 + 1, qtemplate), 0) + prevlink = p.url(request, querystr % (qpagenames, parmoffset2 - 1, qtemplate), 0) + nextlink = p.url(request, querystr % (qpagenames, parmoffset2 + 1, qtemplate), 0) prevylink = p.url(request, querystr % (qpagenames, parmoffset2 - 12, qtemplate), 0) nextylink = p.url(request, querystr % (qpagenames, parmoffset2 + 12, qtemplate), 0) prevmonth = formatter.url(1, prevlink, 'cal-link') + '<' + formatter.url(0) nextmonth = formatter.url(1, nextlink, 'cal-link') + '>' + formatter.url(0) - prevyear = formatter.url(1, prevylink, 'cal-link') + '<<' + formatter.url(0) - nextyear = formatter.url(1, nextylink, 'cal-link') + '>>' + formatter.url(0) - + prevyear = formatter.url(1, prevylink, 'cal-link') + '<<' + formatter.url(0) + nextyear = formatter.url(1, nextylink, 'cal-link') + '>>' + formatter.url(0) + if parmpagename != [thispage]: pagelinks = '' r, g, b = (255, 0, 0) @@ -336,14 +336,14 @@ r, g, b = cliprgb(r, g, b) pagelinks = pagelinks + '<a style="%s" href="%s">%s</a>' % \ ('background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % \ - (r,g,b), Page(request, parmpagename[0]).url(request), ch) + (r, g, b), Page(request, parmpagename[0]).url(request), ch) r, g, b = (r, g+colorstep, b) st = st + chstep r, g, b = (255-colorstep, 255, 255-colorstep) for page in parmpagename[1:]: pagelinks = pagelinks + '*<a style="%s" href="%s">%s</a>' % \ ('background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % \ - (r,g,b), Page(request, page).url(request), page) + (r, g, b), Page(request, page).url(request), page) showpagename = ' %s<BR>\n' % pagelinks else: showpagename = '' @@ -369,10 +369,10 @@ cssday = "cal-workday" restd2.append(' <td class="%s" width="14%%">%s</td>\n' % (cssday, wday)) restr2 = ' <tr>\n%s </tr>\n' % "".join(restd2) - + if parmheight6: while len(monthcal) < 6: - monthcal = monthcal + [[0,0,0,0,0,0,0]] + monthcal = monthcal + [[0, 0, 0, 0, 0, 0, 0]] maketip_js = [] restrn = [] @@ -399,14 +399,14 @@ for match in header1_re.finditer(daycontent): if match: title = match.group(1) - title = wikiutil.escape(title).replace("'","\\'") + title = wikiutil.escape(title).replace("'", "\\'") titletext.append(title) tipname = link tiptitle = link tiptext = '<br>'.join(titletext) maketip_js.append("maketip('%s','%s','%s');" % (tipname, tiptitle, tiptext)) onmouse = {'onMouseOver': "tip('%s')" % tipname, - 'onMouseOut': "untip()"} + 'onMouseOut': "untip()"} else: csslink = "cal-emptyday" if parmtemplate:
--- a/MoinMoin/macro/NewPage.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/NewPage.py Mon Jul 17 04:27:24 2006 +0200 @@ -49,7 +49,7 @@ self.formatter = macro.formatter self.args = self.getArgs(args) - def getArgs(self, string): + def getArgs(self, argstr): """ Temporary function until Oliver Graf args parser is finished @param string: string from the wiki markup [[NewPage(string)]] @@ -58,7 +58,7 @@ """ if not string: return {} - args = [s.strip() for s in string.split(',')] + args = [s.strip() for s in argstr.split(',')] args = dict(zip(self.arguments, args)) return args @@ -75,28 +75,28 @@ template = self.args.get('template') or '' label = self.args.get('buttonLabel') nametemplate = self.args.get('nameTemplate') or u'%s' - + if parent == '@ME' and self.request.user.valid: parent = self.request.user.name - + requires_input = nametemplate.find('%s') != -1 - + if label: # Try to get a translation, this will probably not work in # most case, but better than nothing. label = _(label) else: label = _("Create New Page") - + # TODO: better abstract this using the formatter html = [ u'<form class="macro" method="get" action=""><div>', u'<input type="hidden" name="action" value="newpage">', u'<input type="hidden" name="parent" value="%s">' % wikiutil.escape(parent, 1), u'<input type="hidden" name="template" value="%s">' % wikiutil.escape(template, 1), - u'<input type="hidden" name="nametemplate" value="%s">' % wikiutil.escape(nametemplate,1), + u'<input type="hidden" name="nametemplate" value="%s">' % wikiutil.escape(nametemplate, 1), ] - + if requires_input: html += [ u'<input type="text" name="pagename" size="30">', @@ -106,7 +106,7 @@ u'</div></form>', ] return self.formatter.rawHTML('\n'.join(html)) - + def execute(macro, args): """ Temporary glue code to use with moin current macro system """ return NewPage(macro, args).renderInPage()
--- a/MoinMoin/macro/OrphanedPages.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/OrphanedPages.py Mon Jul 17 04:27:24 2006 +0200 @@ -13,7 +13,7 @@ if macro.request.mode_getpagelinks: # prevent recursion return '' - + # delete all linked pages from a dict of all pages pages = macro.request.rootpage.getPageDict() orphaned = {}
--- a/MoinMoin/macro/PageHits.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/PageHits.py Mon Jul 17 04:27:24 2006 +0200 @@ -21,7 +21,7 @@ class PageHits: - + def __init__(self, macro, args): self.macro = macro self.request = macro.request @@ -36,10 +36,10 @@ hits.sort() hits.reverse() return self.format(hits) - + def cachedHits(self): """ Return tuple (cache date, cached hits) for all pages """ - date, hits = 0, {} + date, hits = 0, {} if self.cache.exists(): try: date, hits = pickle.loads(self.cache.content()) @@ -54,7 +54,7 @@ logDate = event_log.date() except logfile.LogMissing: return - + changed = False event_log.set_filter(['VIEWPAGE']) for event in event_log.reverse(): @@ -64,13 +64,13 @@ if page: hits[page] = hits.get(page, 0) + 1 changed = True - + if changed: - self.updateCache(logDate, hits) - + self.updateCache(logDate, hits) + def updateCache(self, date, hits): self.cache.update(pickle.dumps((date, hits), PICKLE_PROTOCOL)) - + def filterReadableHits(self, hits): """ Filter out hits the user many not see """ userMayRead = self.request.user.may.read @@ -96,9 +96,10 @@ formatter.pagelink(0, pagename), formatter.listitem(0), ]) - result.append(formatter.number_list(0)) + result.append(formatter.number_list(0)) return ''.join(result) def execute(macro, args): return PageHits(macro, args).execute() +
--- a/MoinMoin/macro/RandomPage.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/RandomPage.py Mon Jul 17 04:27:24 2006 +0200 @@ -15,7 +15,7 @@ def execute(macro, args): request = macro.request - + # get number of wanted links try: links = max(int(args), 1) @@ -33,13 +33,13 @@ # Take one random page from the list pagename = random.choice(all_pages) all_pages.remove(pagename) - + # Filter out deleted pages or pages the user may not read. page = Page(request, pagename) if page.exists() and request.user.may.read(pagename): pages.append(pagename) found += 1 - + if not pages: return ''
--- a/MoinMoin/macro/RandomQuote.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/RandomQuote.py Mon Jul 17 04:27:24 2006 +0200 @@ -39,12 +39,12 @@ quotes = raw.splitlines() quotes = [quote.strip() for quote in quotes] quotes = [quote[2:] for quote in quotes if quote.startswith('* ')] - + if not quotes: return (macro.formatter.highlight(1) + _('No quotes on %(pagename)s.') % {'pagename': pagename} + macro.formatter.highlight(0)) - + quote = random.choice(quotes) page.set_raw_body(quote, 1) quote = macro.request.redirectedOutput(page.send_page,
--- a/MoinMoin/macro/RecentChanges.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/RecentChanges.py Mon Jul 17 04:27:24 2006 +0200 @@ -87,10 +87,10 @@ # print name of page, with a link to it force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH - + d['icon_html'] = html_link d['pagelink_html'] = page.link_to(request, text=page.split_title(request, force=force_split)) - + # print time of change d['time_html'] = None if request.cfg.changed_time_fmt: @@ -100,7 +100,7 @@ 'mins': tdiff} else: d['time_html'] = time.strftime(request.cfg.changed_time_fmt, line.time_tuple) - + # print editor name or IP d['editors'] = None if request.cfg.show_names: @@ -111,7 +111,7 @@ if not name in counters: counters[name] = [] counters[name].append(idx+1) - poslist = map(None, counters.values(), counters.keys()) + poslist = map(None, counters.values(), counters.keys()) poslist.sort() ##request.write(repr(counters.items())) d['editors'] = [] @@ -126,7 +126,7 @@ comment = format_comment(request, lines[idx]) if comment: comments.append((idx+1, wikiutil.escape(comment))) - + d['changecount'] = len(lines) d['comments'] = comments @@ -135,9 +135,9 @@ wikiutil.quoteWikinameURL(line.pagename) + "?action=info", img, formatter=macro.formatter, rel="nofollow") d['info_html'] = info_html - + return request.theme.recentchanges_entry(d) - + def cmp_lines(first, second): return cmp(first[0], second[0]) @@ -174,22 +174,22 @@ if not max_days: max_days = _MAX_DAYS d['rc_max_days'] = max_days - + # give known user the option to extend the normal display if request.user.valid: d['rc_days'] = _DAYS_SELECTION else: d['rc_days'] = None - + d['rc_update_bookmark'] = None request.write(request.theme.recentchanges_header(d)) length = len(last_edits) - + index = 0 last_index = 0 day_count = 0 - + if length > 0: line = last_edits[index] line.time_tuple = request.user.getTime(wikiutil.version2timestamp(line.ed_time_usecs)) @@ -200,20 +200,20 @@ index += 1 - if (index>length): - break + if index > length: + break if index < length: line = last_edits[index] line.time_tuple = request.user.getTime(wikiutil.version2timestamp(line.ed_time_usecs)) day = line.time_tuple[0:3] - if (day != this_day) or (index==length): + if (day != this_day) or (index == length): d['bookmark_link_html'] = None d['date'] = request.user.getFormattedDate(wikiutil.version2timestamp(last_edits[last_index].ed_time_usecs)) request.write(request.theme.recentchanges_daybreak(d)) this_day = day - + for page in last_edits[last_index:index]: request.write(format_page_edits(macro, [page], None)) last_index = index @@ -223,7 +223,7 @@ d['rc_msg'] = msg request.write(request.theme.recentchanges_footer(d)) - + def execute(macro, args, **kw): # handle abandoned keyword if kw.get('abandoned', 0): @@ -235,7 +235,7 @@ user = request.user page = macro.formatter.page pagename = page.page_name - + d = {} d['q_page_name'] = wikiutil.quoteWikinameURL(pagename) @@ -256,7 +256,7 @@ currentBookmark = wikiutil.version2timestamp(bookmark_usecs) currentBookmark = user.getFormattedDateTime(currentBookmark) currentBookmark = _('(currently set to %s)') % currentBookmark - + url = wikiutil.quoteWikinameURL(pagename) + "?action=bookmark&time=del" deleteBookmark = wikiutil.link_tag(request, url, _("Delete Bookmark"), formatter=macro.formatter, rel="nofollow") @@ -267,14 +267,14 @@ "?action=bookmark&time=%d" % version d['rc_update_bookmark'] = wikiutil.link_tag(request, url, _("Set bookmark"), formatter=macro.formatter, rel="nofollow") - + # set max size in days max_days = min(int(request.form.get('max_days', [0])[0]), _DAYS_SELECTION[-1]) # default to _MAX_DAYS for useres without bookmark if not max_days and not bookmark_usecs: max_days = _MAX_DAYS d['rc_max_days'] = max_days - + # give known user the option to extend the normal display if request.user.valid: d['rc_days'] = _DAYS_SELECTION @@ -282,7 +282,7 @@ d['rc_days'] = [] request.write(request.theme.recentchanges_header(d)) - + pages = {} ignore_pages = {} @@ -298,7 +298,7 @@ line.time_tuple = request.user.getTime(wikiutil.version2timestamp(line.ed_time_usecs)) day = line.time_tuple[0:3] hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs) - + if ((this_day != day or (not hilite and not max_days))) and len(pages) > 0: # new day or bookmark reached: print out stuff this_day = day @@ -307,7 +307,7 @@ pages = pages.values() pages.sort(cmp_lines) pages.reverse() - + if request.user.valid: d['bookmark_link_html'] = wikiutil.link_tag( request, @@ -319,7 +319,7 @@ d['bookmark_link_html'] = None d['date'] = request.user.getFormattedDate(wikiutil.version2timestamp(pages[0][0].ed_time_usecs)) request.write(request.theme.recentchanges_daybreak(d)) - + for page in pages: request.write(format_page_edits(macro, page, bookmark_usecs)) pages = {} @@ -333,7 +333,7 @@ if line.pagename in ignore_pages: continue - + # end listing by default if user has a bookmark and we reached it if not max_days and not hilite: msg = _('[Bookmark reached]') @@ -353,7 +353,7 @@ pages = pages.values() pages.sort(cmp_lines) pages.reverse() - + if request.user.valid: d['bookmark_link_html'] = wikiutil.link_tag( request, @@ -365,10 +365,10 @@ d['bookmark_link_html'] = None d['date'] = request.user.getFormattedDate(wikiutil.version2timestamp(pages[0][0].ed_time_usecs)) request.write(request.theme.recentchanges_daybreak(d)) - + for page in pages: request.write(format_page_edits(macro, page, bookmark_usecs)) - + d['rc_msg'] = msg request.write(request.theme.recentchanges_footer(d))
--- a/MoinMoin/macro/SystemAdmin.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/SystemAdmin.py Mon Jul 17 04:27:24 2006 +0200 @@ -18,7 +18,7 @@ def execute(macro, args): _ = macro.request.getText request = macro.request - + # do not show system admin to users not in superuser list if not request.user.isSuperUser(): return ''
--- a/MoinMoin/macro/SystemInfo.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/SystemInfo.py Mon Jul 17 04:27:24 2006 +0200 @@ -45,7 +45,7 @@ _ = Macro._ request = Macro.request - + # check for 4XSLT try: import Ft @@ -96,24 +96,24 @@ eventlogger = eventlog.EventLog(request) nonestr = _("NONE") row('Event log', _formatInReadableUnits(eventlogger.size())) - + row(_('Global extension macros'), ', '.join(macro.extension_macros) or nonestr) - row(_('Local extension macros'), + row(_('Local extension macros'), ', '.join(wikiutil.wikiPlugins('macro', Macro.cfg)) or nonestr) - + ext_actions = [x for x in action.extension_actions if not x in request.cfg.actions_excluded] row(_('Global extension actions'), ', '.join(ext_actions) or nonestr) - row(_('Local extension actions'), + row(_('Local extension actions'), ', '.join(action.getPlugins(request)[1]) or nonestr) - + row(_('Global parsers'), ', '.join(parser.modules) or nonestr) - row(_('Local extension parsers'), + row(_('Local extension parsers'), ', '.join(wikiutil.wikiPlugins('parser', Macro.cfg)) or nonestr) - + state = (_('Disabled'), _('Enabled')) row(_('Xapian search'), state[request.cfg.xapian_search]) - + row(_('Active threads'), t_count or 'N/A') buf.write(u'</dl>')
--- a/MoinMoin/macro/TableOfContents.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/TableOfContents.py Mon Jul 17 04:27:24 2006 +0200 @@ -39,12 +39,12 @@ def __init__(self, macro, args): self.macro = macro self._ = self.macro.request.getText - + self.inc_re = re.compile(r"^\[\[Include\((.*)\)\]\]") self.arg_re = re.compile(_args_re_pattern) self.head_re = re.compile(_title_re) # single lines only self.pre_re = re.compile(r'\{\{\{.+?\}\}\}', re.S) - + self.result = [] self.baseindent = 0 self.indent = 0 @@ -67,7 +67,7 @@ if self.include_macro is None: self.include_macro = wikiutil.importPlugin(self.macro.request.cfg, 'macro', "Include") - return self.pre_re.sub('',apply(self.include_macro, args, kwargs)).split('\n') + return self.pre_re.sub('', apply(self.include_macro, args, kwargs)).split('\n') def run(self): _ = self._ @@ -76,7 +76,7 @@ self.result.append(self.macro.formatter.escapedText(_('Contents'))) self.result.append(self.macro.formatter.paragraph(0)) - self.process_lines(self.pre_re.sub('',self.macro.parser.raw).split('\n'), + self.process_lines(self.pre_re.sub('', self.macro.parser.raw).split('\n'), self.macro.formatter.page.page_name) # Close pending lists for i in range(self.baseindent, self.indent): @@ -110,12 +110,12 @@ level = int(tmp.group("level")) else: level = 1 - inc_page_lines = ["%s %s %s" %("=" * level, heading, "=" * level)] + inc_page_lines = ["%s %s %s" % ("=" * level, heading, "=" * level)] else: inc_page_lines = [] inc_page_lines = inc_page_lines + self.IncludeMacro(self.macro, match.group(1), called_by_toc=1) - + self.process_lines(inc_page_lines, inc_pagename) else: self.parse_line(line, pagename) @@ -138,12 +138,12 @@ self.indent = self.baseindent # Close lists - for i in range(0,self.indent-newindent): + for i in range(0, self.indent-newindent): self.result.append(self.macro.formatter.listitem(0)) self.result.append(self.macro.formatter.number_list(0)) # Open Lists - for i in range(0,newindent-self.indent): + for i in range(0, newindent-self.indent): self.result.append(self.macro.formatter.number_list(1)) self.result.append(self.macro.formatter.listitem(1)) @@ -155,7 +155,7 @@ # close last listitem if same level if self.indent == newindent: self.result.append(self.macro.formatter.listitem(0)) - + if self.indent >= newindent: self.result.append(self.macro.formatter.listitem(1)) self.result.append(self.macro.formatter.anchorlink(1, @@ -167,5 +167,6 @@ self.indent = newindent def execute(macro, args): - toc=TableOfContents(macro,args) + toc = TableOfContents(macro, args) return toc.run() +
--- a/MoinMoin/macro/TeudView.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/TeudView.py Mon Jul 17 04:27:24 2006 +0200 @@ -63,7 +63,7 @@ processor.appendStylesheetFile(xslfile) try: result = processor.runString(xmlstr, - topLevelParams = { + topLevelParams={ 'uri-prefix': pagename + "?module=", 'uri-suffix': "", } @@ -73,3 +73,4 @@ raise return navigation + result +
--- a/MoinMoin/macro/WantedPages.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/WantedPages.py Mon Jul 17 04:27:24 2006 +0200 @@ -15,12 +15,12 @@ _ = request.getText # prevent recursion - if request.mode_getpagelinks: - return '' + if request.mode_getpagelinks: + return '' # Get allpages switch from the form allpages = int(request.form.get('allpages', [0])[0]) != 0 - + # Control bar - filter the list of pages # TODO: we should make this a widget and use on all page listing pages controlbar = '''<div class="controlbar"> @@ -35,13 +35,13 @@ pages = request.rootpage.getPageDict() # build a dict of wanted pages - wanted = {} + wanted = {} for name, page in pages.items(): # Skip system pages, because missing translations are not wanted pages, # unless you are a translator and clicked "Include system pages" if not allpages and wikiutil.isSystemPage(request, name): continue - + # Add links to pages which does not exists in pages dict links = page.getPageLinks(request) for link in links: @@ -53,7 +53,7 @@ # Check for the extreme case when there are no wanted pages if not wanted: - return u"%s<p>%s</p>" % (controlbar ,_("No wanted pages in this wiki.")) + return u"%s<p>%s</p>" % (controlbar, _("No wanted pages in this wiki.")) # Return a list of page links wantednames = wanted.keys() @@ -74,7 +74,7 @@ where.sort() if macro.formatter.page.page_name in where: where.remove(macro.formatter.page.page_name) - querystr='highlight=%s' % wikiutil.url_quote_plus(name) + querystr = 'highlight=%s' % wikiutil.url_quote_plus(name) wherelinks = [pages[pagename].link_to(request, querystr=querystr, rel='nofollow') for pagename in where] result.append(": " + ', '.join(wherelinks)) @@ -82,3 +82,4 @@ result.append(macro.formatter.number_list(0)) return u'%s%s' % (controlbar, u''.join(result)) +
--- a/MoinMoin/macro/__init__.py Mon Jul 17 04:01:34 2006 +0200 +++ b/MoinMoin/macro/__init__.py Mon Jul 17 04:27:24 2006 +0200 @@ -87,7 +87,7 @@ # to have correct dir and lang html attributes for lang in i18n.wikiLanguages().keys(): Dependencies[lang] = [] - + def __init__(self, parser): self.parser = parser @@ -96,7 +96,7 @@ self.formatter = self.request.formatter self._ = self.request.getText self.cfg = self.request.cfg - + # Initialized on execute self.name = None @@ -131,10 +131,10 @@ return (self.formatter.lang(1, self.name) + self.formatter.text(text) + self.formatter.lang(0, self.name)) - + self.request.current_lang = self.name return '' - + def get_dependencies(self, macro_name): if macro_name in self.Dependencies: return self.Dependencies[macro_name] @@ -178,7 +178,7 @@ ] boxes = u'\n'.join(boxes) button = _("Search Text") - + # Format type = (type == "titlesearch") html = [ @@ -190,11 +190,11 @@ u'<input type="submit" value="%s">' % button, boxes, u'</div>', - u'</form>', + u'</form>', ] html = u'\n'.join(html) return self.formatter.rawHTML(html) - + def _macro_GoTo(self, args): """ Make a goto box @@ -241,7 +241,7 @@ def filter(name): return not wikiutil.isSystemPage(self.request, name) pages = self.request.rootpage.getPageList(filter=filter) - + word_re = re.compile(word_re, re.UNICODE) map = {} for name in pages: @@ -275,7 +275,7 @@ html.append(self.formatter.strong(1)) html.append(word) html.append(self.formatter.strong(0)) - + html.append(self.formatter.bullet_list(1)) links.sort() last_page = None @@ -286,7 +286,7 @@ html.append(Page(self.request, name).link_to(self.request, attachment_indicator=1)) html.append(self.formatter.listitem(0)) html.append(self.formatter.bullet_list(0)) - + def _make_index_key(index_letters, additional_html=''): index_letters.sort() def letter_link(ch): @@ -301,7 +301,7 @@ """ % (qpagename, not allpages, allpages_txt) ) # ?action=titleindex and ?action=titleindex&mimetype=text/xml removed - return u'%s%s' % (index, u''.join(html)) + return u'%s%s' % (index, u''.join(html)) def _macro_TitleIndex(self, args): @@ -324,16 +324,16 @@ # With whitespace argument, return same error message as FullSearch elif needle.isspace(): - err = _('Please use a more selective search term instead of {{{"%s"}}}') % needle + err = _('Please use a more selective search term instead of {{{"%s"}}}') % needle return '<span class="error">%s</span>' % err - + # Return a title search for needle, sorted by name. # XXX: what's with literal? results = search.searchPages(self.request, needle, titlesearch=1, case=case) results.sortByPagename() return results.pageList(self.request, self.formatter) - + def _macro_InterWiki(self, args): from StringIO import StringIO interwiki_list = wikiutil.load_wikimap(self.request) @@ -367,7 +367,7 @@ return (self.formatter.span(1, css_class="error") + 'Wrong argument: %s' % arg + self.formatter.span(0)) - + count = self.request.rootpage.getPageCount(exists=exists) return self.formatter.text("%d" % count) @@ -386,7 +386,7 @@ # Get page list readable by current user, filtered by needle hits = self.request.rootpage.getPageList(filter=needle_re.search) hits.sort() - + result = [] result.append(self.formatter.bullet_list(1)) for pagename in hits: @@ -408,8 +408,8 @@ # we ignore any time zone offsets here, assume UTC, # and accept (and ignore) any trailing stuff try: - year, month, day = int(args[0:4]), int(args[5:7]), int(args[8:10]) - hour, minute, second = int(args[11:13]), int(args[14:16]), int(args[17:19]) + year, month, day = int(args[0:4]), int(args[5:7]), int(args[8:10]) + hour, minute, second = int(args[11:13]), int(args[14:16]), int(args[17:19]) tz = args[19:] # +HHMM, -HHMM or Z or nothing (then we assume Z) tzoffset = 0 # we assume UTC no matter if there is a Z if tz: @@ -451,7 +451,7 @@ create_only = False if isinstance(args, unicode): args = args.strip(" '\"") - create_only = (args.lower()=="createonly") + create_only = (args.lower() == "createonly") return self.formatter.rawHTML(userform.getUserForm( self.request, @@ -492,8 +492,8 @@ return result def _macro_GetVal(self, args): - page,key = args.split(',') + page, key = args.split(',') d = self.request.dicts.dict(page) - result = d.get(key,'') + result = d.get(key, '') return self.formatter.text(result)