Hi,
I created a custom type that represents a string as list of int(elements), 
e.g.:

"2222" <-> [2, 2, 2, 2]

The class I created looks as follows:

class IntList(types.TypeDecorator):
    """List of integers that is represented by string in the RDB"""
    impl=String
    
    def process_bind_param(self, value, engine):
        if value == [] or value is None:
            return None
        else:
            return ''.join((str(x) for x in value))
    def process_result_value(self, value, engine):
        if value is None:
            return []
        else:
            return [int(x) for x in value]

This data type is then used in one of my tables, which is represented by an 
object.

The problem I have is that changing items in the list seems not to trigger SA, 
so that a session.flush() does not perform an update, e.g.

myobj.intlist[0] = 8

When I, however, do the following, it works:

l = list(myobj.intlist)
l[0] = 8
myobj.intlist = l

On the other hand, the following does not:

myobj.intlist[0] = 8
l = list(myobj.intlist)
myobj.intlist = l

Can please someone enlighten me why this happens, and what I can do about it?

Best Regards,
Hermann


-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7

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

Reply via email to