changeset 1085:2bcb7bdf94a2

Implemented an editable InterWikiMap, updated my CHANGES file.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Fri, 28 Jul 2006 22:45:59 +0200
parents 815f69e6c563
children db7863d7a45e
files MoinMoin/wikiutil.py docs/CHANGES.aschremmer
diffstat 2 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Fri Jul 28 17:10:43 2006 +0200
+++ b/MoinMoin/wikiutil.py	Fri Jul 28 22:45:59 2006 +0200
@@ -6,8 +6,13 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, re, urllib, cgi
-import codecs, types
+import cgi
+import codecs
+import os
+import re
+import time
+import types
+import urllib
 
 from MoinMoin import util, version, config
 from MoinMoin.util import pysupport, filesys, lock
@@ -497,8 +502,13 @@
 #############################################################################
 def load_wikimap(request):
     """ load interwiki map (once, and only on demand) """
+    from MoinMoin.Page import Page
+
     try:
         _interwiki_list = request.cfg._interwiki_list
+        now = int(time.time())
+        if request.cfg._interwiki_ts + (3*60) < now: # 3 minutes caching time
+            raise AttributeError # refresh cache
     except AttributeError:
         _interwiki_list = {}
         lines = []
@@ -507,7 +517,7 @@
         # precedence over the shared one, and is thus read AFTER
         # the shared one
         intermap_files = request.cfg.shared_intermap
-        if not isinstance(intermap_files, type([])):
+        if not isinstance(intermap_files, list):
             intermap_files = [intermap_files]
         intermap_files.append(os.path.join(request.cfg.data_dir, "intermap.txt"))
 
@@ -517,6 +527,9 @@
                 lines.extend(f.readlines())
                 f.close()
 
+        # add the contents of the InterWikiMap page
+        lines += Page(request, "InterWikiMap").get_raw_body().splitlines()
+
         for line in lines:
             if not line or line[0] == '#': continue
             try:
@@ -536,6 +549,7 @@
 
         # save for later
         request.cfg._interwiki_list = _interwiki_list
+        request.cfg._interwiki_ts = now
 
     return _interwiki_list
 
--- a/docs/CHANGES.aschremmer	Fri Jul 28 17:10:43 2006 +0200
+++ b/docs/CHANGES.aschremmer	Fri Jul 28 22:45:59 2006 +0200
@@ -12,7 +12,7 @@
       identity storage.
     * Clean up trailing whitespace.
     * Add page locking, i.e. use the one in the new storage layer.
-    * How about using unique IDs that just derive from the interwikiname?
+    * Check what needs to be documented on MoinMaster.
 
   New Features:
     * XMLRPC method to return the Moin version
@@ -27,6 +27,7 @@
     * XMLRPC method to get the pagelist in a special way (revnos,
       no system pages etc.)
     * IWID support - i.e. every instance has a unique ID
+    * InterWiki page editable in the wiki
 
   Bugfixes (only stuff that is buggy in moin/1.6 main branch):
     * Conflict resolution fixes. (merged into main)
@@ -73,14 +74,15 @@
          script written by Stefan Merten.
 Week 29: Finished first version of the mergeChanges method. Added Tag and TagStore classes which are currently
          using pickle-based storage. Added getAllPagesEx XMLRPC method.
-Week 30: Implemented IWID support, added function to generate random strings.
+Week 30: Implemented IWID support, added function to generate random strings. Added support
+         for editing the InterWikiMap in the wiki.
 
 2006-07-18: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-07-19: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-07-20: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-07-21: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-07-22: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
-2006-07-23: no work on SOC project
+2006-07-23: no work on SOC project -- a Sunday
 2006-07-24: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 
 Time plan