@@ -1846,8 +1846,6 @@ class StoragePasswords(Collection):
18461846 instance. Retrieve this collection using :meth:`Service.storage_passwords`.
18471847 """
18481848 def __init__ (self , service ):
1849- if service .namespace .owner == '-' or service .namespace .app == '-' :
1850- raise ValueError ("StoragePasswords cannot have wildcards in namespace." )
18511849 super (StoragePasswords , self ).__init__ (service , PATH_STORAGE_PASSWORDS , item = StoragePassword )
18521850
18531851 def create (self , password , username , realm = None ):
@@ -1865,6 +1863,9 @@ def create(self, password, username, realm=None):
18651863
18661864 :return: The :class:`StoragePassword` object created.
18671865 """
1866+ if self .service .namespace .owner == '-' or self .service .namespace .app == '-' :
1867+ raise ValueError ("While creating StoragePasswords, namespace cannot have wildcards." )
1868+
18681869 if not isinstance (username , six .string_types ):
18691870 raise ValueError ("Invalid name: %s" % repr (username ))
18701871
@@ -1896,6 +1897,9 @@ def delete(self, username, realm=None):
18961897 :return: The `StoragePassword` collection.
18971898 :rtype: ``self``
18981899 """
1900+ if self .service .namespace .owner == '-' or self .service .namespace .app == '-' :
1901+ raise ValueError ("app context must be specified when removing a password." )
1902+
18991903 if realm is None :
19001904 # This case makes the username optional, so
19011905 # the full name can be passed in as realm.
0 commit comments