On further investigation I see that this is actually per-instance
lazy, so no app-level hook will solve it.

So somehow __setstate__ needs to re-initialise the attribute.

I do actually merge() the object back into the new session, and that
is where the error first occurs. My web handling machinery masked the
original traceback, which is this:

  bondi.web:500 invoke_controller
    self.context.thaw(request)
  bondi.app:93 thaw
    self.screen.thaw()
  bondi.view:153 thaw
    self.model = getmeta(self.model).refresh_model(self.context,
self.model)
  bondi.model:309 refresh_model
    return self.do_refresh_model(context, model)
  bondi.model:477 do_refresh_model
    return self.getdb(context).merge(obj)
  sqlalchemy.orm.session:1162 merge
    return self._merge(instance, dont_load=dont_load,
_recursive=_recursive)
  sqlalchemy.orm.session:1182 _merge
    key = mapper._identity_key_from_state(state)
  sqlalchemy.orm.mapper:1086 _identity_key_from_state
    return self.identity_key_from_primary_key
(self._primary_key_from_state(state))
  sqlalchemy.orm.mapper:1097 _primary_key_from_state
    return [self._get_state_attr_by_column(state, column) for column
in self.primary_key]
  sqlalchemy.orm.mapper:1111 _get_state_attr_by_column
    return self._get_col_to_prop(column).getattr(state, column)
  sqlalchemy.orm.properties:99 getattr
    return state.get_impl(self.key).get(state, state.dict)
AttributeError: 'NoneType' object has no attribute 'get'

On Dec 17, 6:46 pm, avdd <adr...@gmail.com> wrote:
> I use pickle to serialise unsaved objects in a user session.  Normally
> this works fine, except that for development I use an auto-reloading
> server, and pickling some objects is hitting a case where some lazy
> attribute isn't fully compiled.

--

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