[CalendarServer-changes] [8084] CalendarServer/branches/users/glyph/other-html/twistedcaldav/ directory

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 13 12:11:26 PDT 2011


Revision: 8084
          http://trac.macosforge.org/projects/calendarserver/changeset/8084
Author:   glyph at apple.com
Date:     2011-09-13 12:11:26 -0700 (Tue, 13 Sep 2011)
Log Message:
-----------
remove dead code

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/calendaruserproxy.py
    CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/principal.py

Modified: CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/calendaruserproxy.py	2011-09-13 19:11:15 UTC (rev 8083)
+++ CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/calendaruserproxy.py	2011-09-13 19:11:26 UTC (rev 8084)
@@ -304,58 +304,12 @@
     ##
 
     def htmlElement(self):
+        """
+        Customize HTML display of proxy groups.
+        """
         return ProxyPrincipalElement(self)
 
 
-    def renderDirectoryBody(self, request):
-        # FIXME: Too much code duplication here from principal.py
-        from twistedcaldav.directory.principal import format_list, format_principals, format_link
-
-        closure = {}
-
-        d = super(CalendarUserProxyPrincipalResource, self).renderDirectoryBody(request)
-        d.addCallback(lambda output: closure.setdefault("output", output))
-
-        d.addCallback(lambda _: self.groupMembers())
-        d.addCallback(lambda members: closure.setdefault("members", members))
-
-        d.addCallback(lambda _: self.groupMemberships())
-        d.addCallback(lambda memberships: closure.setdefault("memberships", memberships))
-        
-        d.addCallback(
-            lambda _: "".join((
-                """<div class="directory-listing">"""
-                """<h1>Principal Details</h1>"""
-                """<pre><blockquote>"""
-                """Directory Information\n"""
-                """---------------------\n"""
-                """Directory GUID: %s\n"""         % (self.parent.record.service.guid,),
-                """Realm: %s\n"""                  % (self.parent.record.service.realmName,),
-                """\n"""
-                """Parent Principal Information\n"""
-                """---------------------\n"""
-                """GUID: %s\n"""                   % (self.parent.record.guid,),
-                """Record type: %s\n"""            % (self.parent.record.recordType,),
-                """Short names: %s\n"""            % (",".join(self.parent.record.shortNames,)),
-                """Full name: %s\n"""              % (self.parent.record.fullName,),
-                """Principal UID: %s\n"""          % (self.parent.principalUID(),),
-                """Principal URL: %s\n"""          % (format_link(self.parent.principalURL()),),
-                """\n"""
-                """Proxy Principal Information\n"""
-                """---------------------\n"""
-               #"""GUID: %s\n"""                   % (self.guid,),
-                """Principal UID: %s\n"""          % (self.principalUID(),),
-                """Principal URL: %s\n"""          % (format_link(self.principalURL()),),
-                """\nAlternate URIs:\n"""          , format_list(format_link(u) for u in self.alternateURIs()),
-                """\nGroup members:\n"""           , format_principals(closure["members"]),
-                """\nGroup memberships:\n"""       , format_principals(closure["memberships"]),
-                """</pre></blockquote></div>""",
-                closure["output"]
-            ))
-        )
-
-        return d
-
     ##
     # DAV
     ##
@@ -363,6 +317,7 @@
     def displayName(self):
         return self.proxyType
 
+
     ##
     # ACL
     ##

Modified: CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/principal.py	2011-09-13 19:11:15 UTC (rev 8083)
+++ CalendarServer/branches/users/glyph/other-html/twistedcaldav/directory/principal.py	2011-09-13 19:11:26 UTC (rev 8084)
@@ -26,12 +26,8 @@
     "DirectoryPrincipalUIDProvisioningResource",
     "DirectoryPrincipalResource",
     "DirectoryCalendarPrincipalResource",
-    "format_list",
-    "format_principals",
-    "format_link",
 ]
 
-from cgi import escape
 from urllib import unquote
 from urlparse import urlparse
 
@@ -1279,45 +1275,3 @@
     """
     return formatList(formatLink(link) for link in urls)
 
-
-
-def format_list(items, *args):
-    def genlist():
-        try:
-            item = None
-            for item in items:
-                yield " -> %s\n" % (item,)
-            if item is None:
-                yield " '()\n"
-        except Exception, e:
-            log.err("Exception while rendering: %s" % (e,))
-            Failure().printTraceback()
-            yield "  ** %s **: %s\n" % (e.__class__.__name__, e)
-    return "".join(genlist())
-
-def format_principals(principals):
-    def recordKey(principal):
-        try:
-            record = principal.record
-        except AttributeError:
-            try:
-                record = principal.parent.record
-            except:
-                return None
-
-        return (record.recordType, record.shortNames[0])
-
-    def describe(principal):
-        if hasattr(principal, "record"):
-            return " - %s" % (principal.record.fullName,)
-        else:
-            return ""
-
-    return format_list(
-        """<a href="%s">%s%s</a>"""
-        % (principal.principalURL(), escape(str(principal)), describe(principal))
-        for principal in sorted(principals, key=recordKey)
-    )
-
-def format_link(url):
-    return """<a href="%s">%s</a>""" % (url, url)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110913/03236eb4/attachment-0001.html>


More information about the calendarserver-changes mailing list