Hi, I have this strange bug or problem...

I have a basic class like this mapped to a table with the same name.
Metatype is a relation to the metatype object.

class MetaData(DBObject):

        def __init__(self, metatype, value, item):

                self.metatype = metatype
                self.item = item
                self.value = value

class MetaType(DBObject):

        def __init__(self, name, parent=None, offset=None):

                self.parent = parent
                self.offset = offset
                self.name = name

Now when I create a MetaData object like this I get the following
error:

>>> nameMetaType = MetaType('name')
>>> product = Product(Decimal('20.00'), Decimal('15.00'))
>>> Session.commit()

>>> MetaData(nameMetaType, 'Koen', product)

Traceback (most recent call last):
  method testMetabug in test_connection.py at line 16
    MetaData(nameMetaType, 'Koen', product)
  method init in attributes.py at line 1025
    oldinit(instance, *args, **kwargs)
TypeError: __init__() takes at most 3 arguments (4 given)

That seems odd to me, as it clearly takes 4 arguments: self, metatype,
value, item. But I tried it anyway with 3 arguments to see what it
did:

>>> MetaData(nameMetaType, 'Koen')

Traceback (most recent call last):
  method testMetabug in test_connection.py at line 16
    MetaData(nameMetaType, 'Koen')
  method init in attributes.py at line 1025
    oldinit(instance, *args, **kwargs)
  method __init__ in schema.py at line 1070
    self.reflect()
  method reflect in schema.py at line 1193
    available = util.OrderedSet(bind.engine.table_names(schema,
AttributeError: 'MetaType' object has no attribute 'engine'

Extra info: The item is a polymorphic mapper to product, employee
etc... I use scoped_session and created my mappers with
Session.mapper.

If you need more info let me know...

Thanks,

Koen


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