On Fri, Jan 30, 2009 at 9:53 AM, Edward K. Ream <[email protected]> wrote:

>
>
> Yes.  You *are* right. This does work::
>

Here is the present code::

def __get_u(self):
    v = self
    if not hasattr(v,'unknownAttributes'):
        v.unknownAttributes = {}
    return v.unknownAttributes

def __set_u(self,val):
    v = self
    if val is None:
        if hasattr(v,'unknownAttributes'):
            delattr(v,'unknownAttributes')
    elif type(val) == type({}):
        v.unknownAttributes = val
    else:
        raise ValueError

u = property(
    __get_u, __set_u,
    doc = "vnode unknownAttribute property")

And here is the test script in test.leo::

print p.v.u
print p.v.u.get('key')
p.v.u['key'] = 'abc'
print p.v.u.get('key')
p.v.u = {'key':'xyz'}
p.v.u = 'abc'
print p.v.u

Saving the file does indeed save the uA.

EKR

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to