Back to index

moin  1.9.0~rc2
Public Member Functions | Private Attributes
MoinMoin.logfile.editlog.EditLogLine Class Reference

List of all members.

Public Member Functions

def __init__
def __cmp__
def is_from_current_user
def getEditorData
def getInterwikiEditorData
def getEditor

Private Attributes

 _usercache

Detailed Description

Has the following attributes

ed_time_usecs
rev
action
pagename
addr
hostname
userid
extra
comment

Definition at line 25 of file editlog.py.


Constructor & Destructor Documentation

def MoinMoin.logfile.editlog.EditLogLine.__init__ (   self,
  usercache 
)

Definition at line 39 of file editlog.py.

00039 
00040     def __init__(self, usercache):
00041         self._usercache = usercache


Member Function Documentation

def MoinMoin.logfile.editlog.EditLogLine.__cmp__ (   self,
  other 
)

Definition at line 42 of file editlog.py.

00042 
00043     def __cmp__(self, other):
00044         try:
00045             return cmp(self.ed_time_usecs, other.ed_time_usecs)
00046         except AttributeError:
00047             return cmp(self.ed_time_usecs, other)

def MoinMoin.logfile.editlog.EditLogLine.getEditor (   self,
  request 
)
Return a HTML-safe string representing the user that did the edit.

Definition at line 102 of file editlog.py.

00102 
00103     def getEditor(self, request):
00104         """ Return a HTML-safe string representing the user that did the edit.
00105         """
00106         _ = request.getText
00107         if request.cfg.show_hosts and self.hostname and self.addr:
00108             title = " @ %s[%s]" % (self.hostname, self.addr)
00109         else:
00110             title = ""
00111         kind, info = self.getInterwikiEditorData(request)
00112         if kind == 'interwiki':
00113             name = self._usercache[self.userid].name
00114             aliasname = self._usercache[self.userid].aliasname
00115             if not aliasname:
00116                 aliasname = name
00117             title = aliasname + title
00118             text = (request.formatter.interwikilink(1, title=title, generated=True, *info) +
00119                     request.formatter.text(name) +
00120                     request.formatter.interwikilink(0, title=title, *info))
00121         elif kind == 'email':
00122             name = self._usercache[self.userid].name
00123             aliasname = self._usercache[self.userid].aliasname
00124             if not aliasname:
00125                 aliasname = name
00126             title = aliasname + title
00127             url = 'mailto:%s' % info
00128             text = (request.formatter.url(1, url, css='mailto', title=title) +
00129                     request.formatter.text(name) +
00130                     request.formatter.url(0))
00131         elif kind == 'ip':
00132             try:
00133                 idx = info.index('.')
00134             except ValueError:
00135                 idx = len(info)
00136             title = '???' + title
00137             text = request.formatter.text(info[:idx])
00138         elif kind == 'anon':
00139             title = ''
00140             text = _('anonymous')
00141         else:
00142             raise Exception("unknown EditorData type")
00143         return (request.formatter.span(1, title=title) +
00144                 text +
00145                 request.formatter.span(0))
00146 

Here is the call graph for this function:

Return a tuple of type id and string or Page object
    representing the user that did the edit.

    DEPRECATED - try to use getInterwikiEditorData
    NOT USED ANY MORE BY MOIN CODE!

    The type id is one of 'ip' (DNS or numeric IP), 'user' (user name)
    or 'homepage' (Page instance of user's homepage).

Definition at line 54 of file editlog.py.

00054 
00055     def getEditorData(self, request):
00056         """ Return a tuple of type id and string or Page object
00057             representing the user that did the edit.
00058 
00059             DEPRECATED - try to use getInterwikiEditorData
00060             NOT USED ANY MORE BY MOIN CODE!
00061 
00062             The type id is one of 'ip' (DNS or numeric IP), 'user' (user name)
00063             or 'homepage' (Page instance of user's homepage).
00064         """
00065         result = 'ip', request.cfg.show_hosts and self.hostname or ''
00066         if self.userid:
00067             if self.userid not in self._usercache:
00068                 self._usercache[self.userid] = user.User(request, self.userid, auth_method="editlog:53")
00069             userdata = self._usercache[self.userid]
00070             if userdata.name:
00071                 pg = wikiutil.getHomePage(request, username=userdata.name)
00072                 if pg:
00073                     result = ('homepage', pg)
00074                 else:
00075                     result = ('user', userdata.name)
00076 
00077         return result
00078 

Return a tuple of type id and string or Page object
    representing the user that did the edit.

    The type id is one of 'ip' (DNS or numeric IP), 'user' (user name)
    or 'homepage' (Page instance of user's homepage) or 'anon' ('').

Definition at line 79 of file editlog.py.

00079 
00080     def getInterwikiEditorData(self, request):
00081         """ Return a tuple of type id and string or Page object
00082             representing the user that did the edit.
00083 
00084             The type id is one of 'ip' (DNS or numeric IP), 'user' (user name)
00085             or 'homepage' (Page instance of user's homepage) or 'anon' ('').
00086         """
00087         result = 'anon', ''
00088         if request.cfg.show_hosts and self.hostname:
00089             result = 'ip', self.hostname
00090         if self.userid:
00091             if self.userid not in self._usercache:
00092                 self._usercache[self.userid] = user.User(request, self.userid, auth_method="editlog:75")
00093             userdata = self._usercache[self.userid]
00094             if userdata.mailto_author and userdata.email:
00095                 return ('email', userdata.email)
00096             elif userdata.name:
00097                 interwiki = wikiutil.getInterwikiHomePage(request, username=userdata.name)
00098                 if interwiki:
00099                     result = ('interwiki', interwiki)
00100         return result
00101 

Here is the caller graph for this function:

Definition at line 48 of file editlog.py.

00048 
00049     def is_from_current_user(self, request):
00050         user = request.user
00051         if user.id:
00052             return user.id == self.userid
00053         return request.remote_addr == self.addr


Member Data Documentation

Definition at line 40 of file editlog.py.


The documentation for this class was generated from the following file: