def get_editor(userid, addr, hostname): """ 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), 'email' (email addr), 'interwiki' (Interwiki homepage) or 'anon' (''). """ result = 'anon', '' if app.cfg.show_hosts and hostname: result = 'ip', hostname if userid: userdata = User(userid) if userdata.mailto_author and userdata.email: return 'email', userdata.email elif userdata.name: interwiki = getInterwikiHome(userdata.name0) if interwiki: result = ('interwiki', interwiki) return result
def userhome(self): """ Assemble arguments used to build user homepage link :rtype: tuple :returns: arguments of user homepage link in tuple (wiki_href, display_name, title, exists) """ user = self.user name = user.name0 display_name = user.display_name or name wikiname, itemname = getInterwikiHome(name) title = u"{0} @ {1}".format(display_name, wikiname) # link to (interwiki) user homepage if is_local_wiki(wikiname): exists = self.storage.has_item(itemname) else: # We cannot check if wiki pages exists in remote wikis exists = True wiki_href = url_for_item(itemname, wiki_name=wikiname, namespace=NAMESPACE_USERS) return wiki_href, display_name, title, exists