changeset 1962:40821d91633d

logfile: improve docstrings
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 07 Apr 2007 20:07:20 +0200
parents 4e528d291fc0
children de42f84ddb3c
files MoinMoin/logfile/editlog.py MoinMoin/logfile/eventlog.py
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/logfile/editlog.py	Sat Apr 07 19:25:07 2007 +0200
+++ b/MoinMoin/logfile/editlog.py	Sat Apr 07 20:07:20 2007 +0200
@@ -4,6 +4,13 @@
     This is used for accessing the global edit-log (e.g. by RecentChanges) as
     well as for the local edit-log (e.g. PageEditor, info action).
 
+    TODO:
+    * when we have items with separate data and metadata storage, we do not
+      need the local edit-log file any more (because everything in it will be
+      stored into the revision's metadata).
+    * maybe we can even get rid of the global edit-log as we know it now (and just
+      maintaining a cache of recent changes metadata)
+
     @copyright: 2006 MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
@@ -129,7 +136,9 @@
 
 
 class EditLog(LogFile):
-
+    """ Used for accessing the global edit-log (e.g. by RecentChanges) as
+        well as for the local edit-log (e.g. PageEditor, info action).
+    """
     def __init__(self, request, filename=None, buffer_size=4096, **kw):
         if filename is None:
             rootpagename = kw.get('rootpagename', None)
@@ -146,7 +155,7 @@
         self.uid_override = kw.get('uid_override', None)
 
     def add(self, request, mtime, rev, action, pagename, host=None, extra=u'', comment=u''):
-        """ Generate a line for the editlog.
+        """ Generate (and add) a line to the edit-log.
 
         If `host` is None, it's read from request vars.
         """
@@ -185,7 +194,7 @@
         self._add(line)
 
     def parser(self, line):
-        """ Parser edit log line into fields """
+        """ Parse edit-log line into fields """
         fields = line.strip().split('\t')
         # Pad empty fields
         missing = self._NUM_FIELDS - len(fields)
@@ -202,6 +211,7 @@
         return result
 
     def set_filter(self, **kw):
+        """ optionally filter for specific pagenames, addrs, hostnames, userids """
         expr = "1"
         for field in ['pagename', 'addr', 'hostname', 'userid']:
             if field in kw:
--- a/MoinMoin/logfile/eventlog.py	Sat Apr 07 19:25:07 2007 +0200
+++ b/MoinMoin/logfile/eventlog.py	Sat Apr 07 20:07:20 2007 +0200
@@ -13,7 +13,7 @@
 from MoinMoin import wikiutil
 
 class EventLog(LogFile):
-
+    """ The global event-log is mainly used for statistics (e.g. EventStats) """
     def __init__(self, request, filename=None, buffer_size=65536, **kw):
         if filename is None:
             rootpagename = kw.get('rootpagename', None)
@@ -27,7 +27,7 @@
     def add(self, request, eventtype, values=None, add_http_info=1,
             mtime_usecs=None):
         """ Write an event of type `eventtype, with optional key/value
-        pairs appended (i.e. you have to pass a dict).
+            pairs appended (i.e. you have to pass a dict).
         """
         if request.isSpiderAgent:
             return
@@ -49,6 +49,7 @@
         self._add(u"%d\t%s\t%s\n" % (mtime_usecs, eventtype, values))
 
     def parser(self, line):
+        """ parse a event-log line into its components """
         try:
             time_usecs, eventtype, kvpairs = line.rstrip().split('\t')
         except ValueError:
@@ -57,6 +58,7 @@
         return long(time_usecs), eventtype, wikiutil.parseQueryString(kvpairs)
 
     def set_filter(self, event_types=None):
+        """ optionally filter log for specific event types """
         if event_types is None:
             self.filter = None
         else: