On Aug 13, 3:17 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Aug 13, 2010, at 10:01 AM, Dan wrote:
>
> > I have created a custom type in order to store denormalized PKs in a
> > TEXT field. The idea is that the text is converted back and forth from
> > a set of integers:
>
> >http://paste.pocoo.org/show/249784/
>
> this is unrelated, but the code is incorrect there, should be
>
>         def process(value):
>             if value is not None:
>                 items = [str(item).strip() for item in value]
>                 value = self.separator.join(item for item in items if item)
>
> otherwise, you must implement copy_value() on your type.   Here, the value 
> isn't being copied so there's nothing to compare to.
>

Yes, sorry for the typo. Realized myself once I'd posted.

> Usually you're supposed to mixin MutableType which will raise notimplemented 
> for copy_value().   I guess still more docs are needed since you were misled 
> by the is_mutable() method.
>

I've tried the same thing with the MutableType mixin with the same
result, i.e:

class DenormalizedText(types.TypeDecorator, types.MutableType):

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

Reply via email to