Title: [commits] (grant) [11346] Fix Bug 4981 (No collection name when subscribing to an Oracle/Hula/RPI CalDAV collection) r=morgen
Revision
11346
Author
grant
Date
2006-08-07 16:33:52 -0700 (Mon, 07 Aug 2006)

Log Message

Fix Bug 4981 (No collection name when subscribing to an Oracle/Hula/RPI CalDAV collection) r=morgen

When subscribing to WebDAV/CalDAV collections, ask their collection resources
for a displayname.

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/sharing/Sharing.py (11345 => 11346)

--- trunk/chandler/parcels/osaf/sharing/Sharing.py	2006-08-07 22:03:42 UTC (rev 11345)
+++ trunk/chandler/parcels/osaf/sharing/Sharing.py	2006-08-07 23:33:52 UTC (rev 11346)
@@ -1014,9 +1014,9 @@
                 self._setSeen(itemPath)
 
             # When first importing a collection, name it after the share
-            if not hasattr(cvSelf.share.contents, 'displayName'):
+            if not getattr(cvSelf.share.contents, 'displayName', ''):
                 cvSelf.share.contents.displayName = \
-                    cvSelf.share.displayName
+                    self._getDisplayNameForShare(cvSelf.share)
 
             # If an item was previously on the server (it was in our
             # manifest) but is no longer on the server, remove it from
@@ -1095,7 +1095,16 @@
         else:
             print "@@@MOR Raise an exception here"
 
-
+    def _getDisplayNameForShare(self, share):
+        """
+        Return a C{str} (or C{unicode}) that specifies how the
+        shared collection should be displayed. By default, this
+        method just uses the share's displayName, but subclasses
+        may override for custom behavior (e.g. fetching a DAV
+        property).
+        """
+        return share.displayName
+        
     # Manifest mangement routines
     # The manifest keeps track of the state of shared items at the time of
     # last sync.  It is a dictionary keyed on "path" (not repo path, but
@@ -1660,7 +1669,20 @@
             resource.ticketId = self.ticket
         return resource
 
+    def _getDisplayNameForShare(self, share):
+        container = self._getContainerResource()
+        try:
+            result = container.serverHandle.blockUntil(container.getDisplayName)
+        except:
+            result = ""
+            
+        return result or super(WebDAVConduit,
+                               self)._getDisplayNameForShare(share)
+            
+        return result
 
+
+
     def _putItem(self, item):
         """
         putItem should publish an item and return etag/date, etc.




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to