bmuller / twistar

Twistar is an object-relational mapper (ORM) for Python that uses the Twisted library to provide asynchronous DB interaction.
http://findingscience.com/twistar
Other
132 stars 38 forks source link

Add a class method as callback #26

Closed arski closed 12 years ago

arski commented 12 years ago

Hi there,

I'm running something like

class MyClass:
  def action(self, data):
    print data

  def fetch(self):
   User.find(where=['uid = ?', self.uid]).addCallback(self.action)

But the self.action method never gets called.. It appears that only callbacks that are accepted are global functions. Is there any way to make this work with the current code and/or is this a bug/feature of Twistar?

Cheers

arski commented 12 years ago

Sorry, the callback was called correctly, but a line doing "yield ..." inside that was somehow making it disappear. sorry about this.

bmuller commented 12 years ago

No worries :)