=== modified file 'ubuntu_sso/utils/tests/test_txsecrets.py'
--- ubuntu_sso/utils/tests/test_txsecrets.py	2011-04-15 19:56:34 +0000
+++ ubuntu_sso/utils/tests/test_txsecrets.py	2011-06-23 17:53:25 +0000
@@ -43,6 +43,10 @@
 SAMPLE_CONTENT_TYPE = "text/plain; charset=utf8"
 
 
+class InvalidProperty(Exception):
+    """An exception for when invalid properties are passed in."""
+
+
 class SampleMiscException(Exception):
     """An exception that will be turned into a DBus Exception."""
 
@@ -129,6 +133,10 @@
     unlock_prompts = False
     item_mock_class = ItemMock
 
+    item_attrs_property = txsecrets.ITEM_ATTRIBUTES_PROPERTY_OLD
+    item_label_property = txsecrets.ITEM_LABEL_PROPERTY_OLD
+    clxn_label_property = txsecrets.CLXN_LABEL_PROPERTY_OLD
+
     def __init__(self, label, *args, **kwargs):
         """Initialize this instance."""
         super(BaseCollectionMock, self).__init__(*args, **kwargs)
@@ -145,8 +153,8 @@
             raise SampleMiscException()
         if self.locked:
             raise SampleMiscException(ERROR_CREATE_BUT_LOCKED)
-        attributes = properties[txsecrets.ATTRIBUTES_PROPERTY]
-        item_label = properties[txsecrets.LABEL_PROPERTY]
+        attributes = properties[self.item_attrs_property]
+        item_label = properties[self.item_label_property]
         value = secret[2]
         item_path = create_object_path(make_coll_path(self.label))
         item = self.dbus_publish(item_path, self.item_mock_class, self,
@@ -165,8 +173,10 @@
                          in_signature="ss", out_signature="v")
     def Get(self, interface, propname):
         """The only property implemented is Label."""
-        if interface == txsecrets.COLLECTION_IFACE and propname == "Label":
+        if interface == txsecrets.COLLECTION_IFACE and \
+                propname == self.clxn_label_property:
             return dbus.String(self.label)
+        raise InvalidProperty("Invalid property: {}".format(propname))
 
 
 class CollectionMock(BaseCollectionMock):
@@ -202,6 +212,9 @@
     dismissed = False
     collection_mock_class = CollectionMock
 
+    clxn_label_property = txsecrets.CLXN_LABEL_PROPERTY_OLD
+    collections_property = txsecrets.COLLECTIONS_PROPERTY_OLD
+
     def __init__(self, *args, **kwargs):
         """Initialize this instance."""
         super(SecretServiceMock, self).__init__(*args, **kwargs)
@@ -226,7 +239,7 @@
         """Create a new collection with the specified properties."""
         if self.create_collection_fail:
             raise SampleMiscException()
-        label = str(properties[txsecrets.LABEL_PROPERTY])
+        label = str(properties[self.clxn_label_property])
         coll_path = make_coll_path(label)
         collection = self.dbus_publish(coll_path, self.collection_mock_class,
                                        label)
@@ -313,9 +326,11 @@
                          in_signature="ss", out_signature="v")
     def Get(self, interface, propname):
         """The only property implemented is Collections."""
-        if interface == txsecrets.SERVICE_IFACE and propname == "Collections":
+        if interface == txsecrets.SERVICE_IFACE and \
+                propname == self.collections_property:
             coll_paths = [make_coll_path(l) for l in self.collections]
             return dbus.Array(coll_paths, signature="o", variant_level=1)
+        raise InvalidProperty("Invalid property: {}".format(propname))
 
 
 class AltItemMock(ItemMock):
@@ -335,6 +350,10 @@
 
     item_mock_class = AltItemMock
 
+    item_attrs_property = txsecrets.ITEM_ATTRIBUTES_PROPERTY
+    item_label_property = txsecrets.ITEM_LABEL_PROPERTY
+    clxn_label_property = txsecrets.CLXN_LABEL_PROPERTY
+
     @dbus.service.method(dbus_interface=txsecrets.COLLECTION_IFACE,
                          in_signature="a{sv}(oayays)b", out_signature="oo",
                          byte_arrays=True)
@@ -349,6 +368,9 @@
 
     collection_mock_class = AltCollectionMock
 
+    clxn_label_property = txsecrets.CLXN_LABEL_PROPERTY
+    collections_property = txsecrets.COLLECTIONS_PROPERTY
+
 
 def create_object_path(base):
     """Create a random object path given a base path."""

=== modified file 'ubuntu_sso/utils/txsecrets.py'
--- ubuntu_sso/utils/txsecrets.py	2011-04-15 19:56:34 +0000
+++ ubuntu_sso/utils/txsecrets.py	2011-06-23 17:53:25 +0000
@@ -45,9 +45,14 @@
 
 ALGORITHM = "plain"
 ALGORITHM_PARAMS = ""
-LABEL_PROPERTY = "Label"
-ATTRIBUTES_PROPERTY = "Attributes"
-COLLECTIONS_PROPERTY = "Collections"
+CLXN_LABEL_PROPERTY = "org.freedesktop.Secret.Collection.Label"
+CLXN_LABEL_PROPERTY_OLD = "Label"
+ITEM_LABEL_PROPERTY = "org.freedesktop.Secret.Item.Label"
+ITEM_LABEL_PROPERTY_OLD = "Label"
+ITEM_ATTRIBUTES_PROPERTY = "org.freedesktop.Secret.Item.Attributes"
+ITEM_ATTRIBUTES_PROPERTY_OLD = "Attributes"
+COLLECTIONS_PROPERTY = "org.freedesktop.Secret.Service.Collections"
+COLLECTIONS_PROPERTY_OLD = "Collections"
 DEFAULT_LABEL = "default"
 
 
@@ -163,10 +168,21 @@
             else:
                 d.callback(collection)
 
-        properties = {LABEL_PROPERTY: dbus.String(label, variant_level=1)}
+        def error_fallback(error):
+            """Fall back to using the old property name."""
+            properties = {CLXN_LABEL_PROPERTY_OLD: dbus.String(
+                    label,
+                    variant_level=1)}
+            self.service.CreateCollection(
+                properties,
+                reply_handler=createcollection_handler,
+                error_handler=d.errback)
+
+        properties = {CLXN_LABEL_PROPERTY: dbus.String(label,
+                                                       variant_level=1)}
         self.service.CreateCollection(properties,
                                       reply_handler=createcollection_handler,
-                                      error_handler=d.errback)
+                                      error_handler=error_fallback)
 
         d.addCallback(lambda p: Collection(self, p))
         return d
@@ -183,9 +199,15 @@
                 result.append(collection)
             d.callback(result)
 
+        def error_fallback(error):
+            """Fall back to the old property name."""
+            self.properties.Get(SERVICE_IFACE, COLLECTIONS_PROPERTY_OLD,
+                                reply_handler=propertyget_handler,
+                                error_handler=d.errback)
+
         self.properties.Get(SERVICE_IFACE, COLLECTIONS_PROPERTY,
                             reply_handler=propertyget_handler,
-                            error_handler=d.errback)
+                            error_handler=error_fallback)
         return d
 
     def get_default_collection(self):
@@ -268,8 +290,16 @@
     def get_label(self):
         """Return the label for this collection from the keyring."""
         d = Deferred()
-        self.properties.Get(COLLECTION_IFACE, LABEL_PROPERTY,
-                            reply_handler=d.callback, error_handler=d.errback)
+
+        def error_fallback(error):
+            """Fall back to the old property name."""
+            self.properties.Get(COLLECTION_IFACE, CLXN_LABEL_PROPERTY_OLD,
+                                reply_handler=d.callback,
+                                error_handler=d.errback)
+
+        self.properties.Get(COLLECTION_IFACE, CLXN_LABEL_PROPERTY,
+                            reply_handler=d.callback,
+                            error_handler=error_fallback)
         return d
 
     def create_item(self, label, attr, value, replace=True):
@@ -287,24 +317,28 @@
             else:
                 d.callback(item)
 
-        def createitem_error(error):
-            """An error creating the item, try older signature."""
-            secret = (self.service.session, parameters, value_bytes)
-            self.collection_iface.CreateItem(properties, secret, replace,
-                                             reply_handler=createitem_handler,
-                                             error_handler=d.errback)
-
         properties = dbus.Dictionary(signature="sv")
-        properties[LABEL_PROPERTY] = label
+        properties[ITEM_LABEL_PROPERTY] = label
         attributes = dbus.Dictionary(attr, signature="ss")
-        properties[ATTRIBUTES_PROPERTY] = attributes
+        properties[ITEM_ATTRIBUTES_PROPERTY] = attributes
         parameters = dbus.ByteArray(ALGORITHM_PARAMS)
         value_bytes = dbus.ByteArray(value)
         secret = (self.service.session, parameters, value_bytes,
                   SECRET_CONTENT_TYPE)
+
+        def error_fallback(error):
+            """A fallback for using old property names and signature."""
+            oldprops = dbus.Dictionary(signature="sv")
+            oldprops[ITEM_LABEL_PROPERTY_OLD] = label
+            oldprops[ITEM_ATTRIBUTES_PROPERTY_OLD] = attributes
+            secret = (self.service.session, parameters, value_bytes)
+            self.collection_iface.CreateItem(oldprops, secret, replace,
+                                             reply_handler=createitem_handler,
+                                             error_handler=d.errback)
+
         self.collection_iface.CreateItem(properties, secret, replace,
                                          reply_handler=createitem_handler,
-                                         error_handler=createitem_error)
+                                         error_handler=error_fallback)
         return d
 
 

