Hello,

I have recently converted a Pylons app from SQLObject to SQLAlchemy
0.3.10.  Conversion went quite well.

I need to serialize access to some of my objects, so I've looked into
extending MapperExtension as described at [1] to add a mutex on load.

First, I define an extension and instantiate it:
--------
from sqlalchemy.orm import MapperExtension
import mutex

class MutexExtension(MapperExtension):
    def create_instance(self, mapper, selectcontext, row, class_):
        self.mutex = mutex.mutex()
        return None

mutexext = MutexExtension()
-------


My mapper setup looks like this:

switch_mapper = mapper (Switch, switch_table,
extension=[mutexext.mutexext, sac.ext],
 
properties={'ports':sqla.relation(SwitchPort)})


When I try to fetch objects from the database, I get a exception
setting
self.entity_name:


Module sqlalchemy.orm.mapper:1485 in _instance
<<                  instance = self._create_instance(context.session)
                else:
                    instance._entity_name = self.entity_name
                if self.__should_log_debug:
                    self.__log_debug("_instance(): created new
instance %s identity %s" % (mapperutil.instance_str(instance),
%str(identitykey)))>>
instance._entity_name = self.entity_name
exceptions.AttributeError: 'NoneType' object has no attribute
'_entity_name'


What did I do wrong?

Thanks,
Ross




[1] 
http://www.sqlalchemy.org/docs/03/adv_datamapping.html#advdatamapping_extending

--~--~---------~--~----~------------~-------~--~----~
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