@@ -1846,8 +1846,6 @@ class StoragePasswords(Collection):
1846
1846
instance. Retrieve this collection using :meth:`Service.storage_passwords`.
1847
1847
"""
1848
1848
def __init__ (self , service ):
1849
- if service .namespace .owner == '-' or service .namespace .app == '-' :
1850
- raise ValueError ("StoragePasswords cannot have wildcards in namespace." )
1851
1849
super (StoragePasswords , self ).__init__ (service , PATH_STORAGE_PASSWORDS , item = StoragePassword )
1852
1850
1853
1851
def create (self , password , username , realm = None ):
@@ -1865,6 +1863,9 @@ def create(self, password, username, realm=None):
1865
1863
1866
1864
:return: The :class:`StoragePassword` object created.
1867
1865
"""
1866
+ if self .service .namespace .owner == '-' or self .service .namespace .app == '-' :
1867
+ raise ValueError ("While creating StoragePasswords, namespace cannot have wildcards." )
1868
+
1868
1869
if not isinstance (username , six .string_types ):
1869
1870
raise ValueError ("Invalid name: %s" % repr (username ))
1870
1871
@@ -1896,6 +1897,9 @@ def delete(self, username, realm=None):
1896
1897
:return: The `StoragePassword` collection.
1897
1898
:rtype: ``self``
1898
1899
"""
1900
+ if self .service .namespace .owner == '-' or self .service .namespace .app == '-' :
1901
+ raise ValueError ("app context must be specified when removing a password." )
1902
+
1899
1903
if realm is None :
1900
1904
# This case makes the username optional, so
1901
1905
# the full name can be passed in as realm.
0 commit comments