Attachment 'moin-1.3.4-rss_rc.py-per_page_feeds.patch'

Download

   1 --- MoinMoin/action/rss_rc.py	2005-01-09 10:48:07.000000000 -0800
   2 +++ MoinMoin/action/rss_rc.py	2005-06-25 06:43:55.000000000 -0700
   3 @@ -43,6 +43,11 @@
   4          ddiffs = int(request.form.get('ddiffs', [0])[0])
   5      except ValueError:
   6          ddiffs = 0
   7 +    ## Sitewide versus local changes by Travis Snoozy <ai2097@yahoo.com>, 2005-06-25
   8 +    try:
   9 +        sitewide = int(request.form.get('sitewide', [0])[0])
  10 +    except ValueError:
  11 +        sitewide = 0
  12  
  13      # prepare output
  14      out = StringIO.StringIO()
  15 @@ -63,7 +68,8 @@
  16          if not request.user.may.read(line.pagename):
  17              continue
  18          if ((line.action[:4] != 'SAVE') or
  19 -            ((line.pagename in pages) and unique)): continue
  20 +            ((line.pagename in pages) and unique) or
  21 +            (not sitewide and line.pagename != pagename)): continue
  22          #if log.dayChanged() and log.daycount > _MAX_DAYS: break
  23          line.editor = line.getEditorData(request)[1]
  24          line.time = util.datetime.tmtuple(wikiutil.version2timestamp(line.ed_time_usecs)) # UTC
  25 @@ -87,17 +93,32 @@
  26          '    Add "diffs=1" to add change diffs to the description of each items.\n'
  27          '    \n'
  28          '    Add "ddiffs=1" to link directly to the diff (good for FeedReader).\n'
  29 -        '    Current settings: items=%i, unique=%i, diffs=%i, ddiffs=%i'
  30 -        '-->\n' % (items_limit, max_items, unique, diffs, ddiffs)
  31 +        '    \n'
  32 +        '    Add "sitewide=1" to get a site-wide feed; otherwise, only differences\n' 
  33 +        '    for the identified page will be shown.\n'
  34 +        '    \n'
  35 +        '    Current settings: items=%i, unique=%i, diffs=%i, ddiffs=%i, sitewide=%i'
  36 +        '-->\n' % (items_limit, max_items, unique, diffs, ddiffs, sitewide)
  37          )
  38  
  39      # emit channel description
  40 -    handler.startNode('channel', {
  41 -        (handler.xmlns['rdf'], 'about'): request.getBaseURL(),
  42 -        })
  43 -    handler.simpleNode('title', cfg.sitename)
  44 -    handler.simpleNode('link', interwiki + wikiutil.quoteWikinameURL(pagename))
  45 -    handler.simpleNode('description', 'RecentChanges at %s' % cfg.sitename)
  46 +    if sitewide:
  47 +        # Site-wide feed
  48 +        handler.startNode('channel', {
  49 +            (handler.xmlns['rdf'], 'about'): request.getBaseURL(),
  50 +            })
  51 +        handler.simpleNode('title', cfg.sitename)
  52 +        handler.simpleNode('link', request.getBaseURL())
  53 +        handler.simpleNode('description', 'RecentChanges at %s' % cfg.sitename)
  54 +    else:
  55 +        # Page-specific feed
  56 +        handler.startNode('channel', {
  57 +            (handler.xmlns['rdf'], 'about'): request.getBaseURL() + request.getPathinfo(),
  58 +            })
  59 +        handler.simpleNode('title', cfg.sitename + " " + pagename)
  60 +        handler.simpleNode('link', interwiki + wikiutil.quoteWikinameURL(pagename))
  61 +        handler.simpleNode('description', 'RecentChanges to %s at %s' % (pagename, cfg.sitename))
  62 +
  63      if logo:
  64          handler.simpleNode('image', None, {
  65              (handler.xmlns['rdf'], 'resource'): logo,
  66 @@ -139,7 +160,7 @@
  67          # general attributes
  68          handler.simpleNode('title', item.pagename)
  69          if ddiffs:
  70 -            handler.simpleNode('link', link+"?action=diff")
  71 +            handler.simpleNode('link', link+"?action=diff&amp;rev1="+str(int(item.rev)-1)+"&amp;rev2="+str(int(item.rev)))
  72          else:
  73              handler.simpleNode('link', link)
  74              
  75 @@ -148,19 +169,7 @@
  76          # description
  77          desc_text = item.comment
  78          if diffs:
  79 -            # TODO: rewrite / extend wikiutil.pagediff
  80 -            # searching for the matching pages doesn't really belong here
  81 -            revisions = page.getRevList()
  82 -
  83 -            rl = len(revisions)
  84 -            for idx in range(rl):
  85 -                rev = revisions[idx]
  86 -                if rev <= item.rev:
  87 -                    if idx+1 < rl:
  88 -                        lines = wikiutil.pagediff(request, item.pagename, revisions[idx+1], item.pagename, 0, ignorews=1)
  89 -                        if len(lines) > 20: lines = lines[:20] + ['...\n']
  90 -                        desc_text = '%s\n<pre>\n%s\n</pre>\n' % (desc_text, '\n'.join(lines))
  91 -                    break
  92 +            desc_text = '%s\n<pre>\n%s\n</pre>\n' % (desc_text, '\n'.join(wikiutil.pagediff(request, item.pagename, (int(item.rev)-1), item.pagename, int(item.rev), ignorews=1)))
  93          if desc_text:
  94              handler.simpleNode('description', desc_text)
  95  

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] (2005-07-12 02:26:49, 6.3 KB) [[attachment:NewTableOfContents-1.3.4.py]]
  • [get | view] (2005-05-01 18:12:47, 2.6 KB) [[attachment:README]]
  • [get | view] (2003-12-07 18:15:55, 1.3 KB) [[attachment:TableOfContents-startdepth.diff]]
  • [get | view] (2005-06-25 14:38:34, 4.3 KB) [[attachment:moin-1.3.4-rss_rc.py-per_page_feeds.patch]]
  • [get | view] (2005-06-09 20:25:52, 10.1 KB) [[attachment:moin-cache-friendly.diff]]
  • [get | view] (2005-04-27 17:22:13, 2.3 KB) [[attachment:moin-negotiate-auth.diff]]
  • [get | view] (2005-04-04 05:12:33, 18.0 KB) [[attachment:moinmoin-1.3.4-editor-insert-patch.diff]]
  • [get | view] (2005-04-04 05:50:16, 43.3 KB) [[attachment:moinmoin-1.3.4-editor-insert-screenshot.png]]
  • [get | view] (2005-08-17 20:24:31, 18.1 KB) [[attachment:moinmoin-1.3.5-editor-insert-patch.diff]]
  • [get | view] (2003-12-07 18:15:55, 13.0 KB) [[attachment:multisearch.diff]]
  • [get | view] (2005-06-14 14:45:06, 0.8 KB) [[attachment:vary-cookie.diff]]
 All files | Selected Files: delete move to page copy to page

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