restoring Settings backward compatibility, thanks Dominic
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-08-23 08:37:52) dev
|
Version 2.00.0 (2012-08-23 08:42:44) dev
|
||||||
|
|||||||
+4
-4
@@ -35,7 +35,7 @@ class Storage(dict):
|
|||||||
2
|
2
|
||||||
|
|
||||||
>>> del o.a
|
>>> del o.a
|
||||||
>>> print o.a
|
>>> print o.a
|
||||||
None
|
None
|
||||||
"""
|
"""
|
||||||
def __getattr__(self, key):
|
def __getattr__(self, key):
|
||||||
@@ -100,7 +100,7 @@ class Storage(dict):
|
|||||||
|
|
||||||
def getlast(self,key,default=None):
|
def getlast(self,key,default=None):
|
||||||
"""
|
"""
|
||||||
Returns the last or only single value when
|
Returns the last or only single value when
|
||||||
given a request.vars-style key.
|
given a request.vars-style key.
|
||||||
|
|
||||||
If the value is a list, the last item will be returned;
|
If the value is a list, the last item will be returned;
|
||||||
@@ -155,9 +155,9 @@ def save_storage(storage, filename):
|
|||||||
|
|
||||||
class Settings(Storage):
|
class Settings(Storage):
|
||||||
def __setattr__(self, key, value):
|
def __setattr__(self, key, value):
|
||||||
if key != 'lock_keys' and 'lock_keys' in self and not key in self:
|
if key != 'lock_keys' and self['lock_keys'] and key not in self:
|
||||||
raise SyntaxError, 'setting key \'%s\' does not exist' % key
|
raise SyntaxError, 'setting key \'%s\' does not exist' % key
|
||||||
if key != 'lock_values' and 'lock_values' in self:
|
if key != 'lock_values' and self['lock_values']:
|
||||||
raise SyntaxError, 'setting value cannot be changed: %s' % key
|
raise SyntaxError, 'setting value cannot be changed: %s' % key
|
||||||
self[key] = value
|
self[key] = value
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user