I will try fix but if I get a patch sooner it is better. Using len may be slower than using count. there has to be a better solution.
---------- Forwarded message ---------- From: Miguel Goncalves <goncalvesmig...@gmail.com> Date: Feb 22, 7:28 pm Subject: GAE delete() has subtle difference compared to native Web2Py To: web2py-users I am running into the same problem. Replacing count by len seems to work. Will this fix be included in the next version of web2py or is there a "better"/other way of addressing this? -Miguel On Sun, Feb 21, 2010 at 3:03 PM, what_ho <a...@viovi.com> wrote: > I got the same issue, delete operations by id work locally, but not on > gae (dev_appserver or live). > Modifying from .count() to len(..) appears to fix this for me. I > locally modified the delete method in gql.py, line 692 as follows: > def delete(self): > self._db['_lastsql'] = 'DELETE WHERE %s' % self.where > (items, tablename, fields) = self._select() > tableobj = self._db[tablename]._tableobj > counter = len(items) > gae.delete(items) > return counter - len(items) > Hope that helps, cheers > - Alex > On Feb 9, 3:19 pm, Throngly <ad...@throngly.com> wrote: > > My traceback is as follows: > > In FILE: /base/data/home/apps/throngly-com/1.339746990702093170/ > > applications/throngly/controllers/people.py > > Traceback (most recent call last): > > File "/base/data/home/apps/throngly-com/1.339746990702093170/gluon/ > > restricted.py", line 173, in restricted > > exec ccode in environment > > File "/base/data/home/apps/throngly-com/1.339746990702093170/ > > applications/throngly/controllers/people.py:delete", line 30, in > > <module> > > File "/base/data/home/apps/throngly-com/1.339746990702093170/gluon/ > > globals.py", line 96, in <lambda> > > self._caller = lambda f: f() > > File "/base/data/home/apps/throngly-com/1.339746990702093170/gluon/ > > tools.py", line 1848, in f > > return action(*a, **b) > > File "/base/data/home/apps/throngly-com/1.339746990702093170/ > > applications/throngly/controllers/people.py:delete", line 25, in > > delete > > File "/base/data/home/apps/throngly-com/1.339746990702093170/gluon/ > > contrib/gql.py", line 696, in delete > > counter =items.count() > > TypeError: count() takes exactly one argument (0 given) > > On Feb 9, 2:58 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > What is the exact traceback? > > > On Feb 3, 6:11 pm, Carl <carl.ro...@gmail.com> wrote: > > > > This may be related toGAEupdate_record() has subtle difference > > > > compared to native Web2Pyhttp:// > groups.google.com/group/web2py/browse_thread/thread/a69afded01... > > > > but until shown otherwise, I've posed separately. > > > > I have this in db.py: > > > > db.define_table('team_user', > > > > Field('teamId', 'integer', notnull=True, > > > > required=True), > > > > Field('user_email', 'string', length=254, > > > > notnull=True, required=True, > > > > requires = [IS_LOWER(),IS_EMAIL()]), > > > > Field('live', 'boolean', notnull=True, required=True, > > > > default='True'), > > > > Field('cDate', 'datetime'), > > > > Field('mDate', 'datetime')) > > > > I make this call: > > > > self.db(self.db.team_user.id==memberId).delete() > > > > such a statement callsdelete(self) in gql.py > > > > defdelete(self): > > > > self._db['_lastsql'] = 'DELETEWHERE %s' % self.where > > > > (items, tablename, fields) = self._select() > > > > tableobj = self._db[tablename]._tableobj > > > > counter =items.count() > > > > gae.delete(items) > > > > return counter -items.count() > > > > When the interpreter exectutes "counter =items.count()" an exception > > > > is thrown stating "TypeError: count() takes exactly one argument (0 > > > > given)" > > > > Have I something in my db.py definition that native web2py is happy > > > > with but dev_appserver chokes on? > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at >http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.