I like idea but there is a problem. It break backward compatibility
for apps that use a session variable named 'copy'

>>> class A(dict):
...     def __getattr__(self,key): return self[key]
...     def __setattr__(self,key,value): self[key]=value
...     def copy(self): return self
>>> a=A()
>>> a.b=5
>>> a.b
5
>>> a.copy()
{'b': 5}
>>> a.copy=6
>>> a.copy
<bound method A.copy of {'copy': 6, 'b': 5}>
should be 6 for backward compatibility

what is wrong with?
from copy import copy
a=Storage()
b=copy(a)

On Nov 15, 1:56 am, "Xie&Tian" <mft...@gmail.com> wrote:
> Here is a patch for gluon.storage.Storage object. I added a "copy()"
> method so that when copying an storage object you can get another
> storage object instead of a dict. Note that this is a simple shadow
> copy.
>
> Hope it helps.
>
> --
> Luyun Xie
> 谢路云http://magefromhell.blogspot.com/
> (http://blog.hellmage.info/)
>
>  storage.py.diff
> < 1KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to