Hi,

I am trying to do some ugly schemaception. A semi-working minimal
example is at
https://gist.github.com/fabianfreyer/f92054d260dc0485c649#file-field_storage-py.

The data model I am implementing is hierarchical, fieldable containers.
Field types are created by sub-classing Schema instances. This part works.
I am having problems implementing a way of grouping those fields by
their Category. For this purpose I have added a collection_class (see
lines 50-) that should take care of the grouping and be interfaceable as
a 2D dictionary as in

    field = container.categories[category.name][field.name]

This works on the first access. On the second access it throws a
DetachedInstanceError (see
https://gist.github.com/fabianfreyer/f92054d260dc0485c649#file-traceback1)

To mitigate this I have added lines 63 to 65 (commented out in the
gist). When these are uncommented, there is also a DetachedInstanceError
(see
https://gist.github.com/fabianfreyer/f92054d260dc0485c649#file-traceback2)

I am running this in flask by the way.

What's the preferred way to deal with this? Am I on the completely wrong
track to group a collection?

Fabian Freyer

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to