I also get this problem with code that used to work before the
".count() to len()" change, so it appears to be a regression.
My traceback is as follows:
Traceback (most recent call last):
File "/base/data/home/apps/throngly-com/1.340262947933306301/gluon/
restricted.py", line 173, in restricted
exec ccode in environment
File "/base/data/home/apps/throngly-com/1.340262947933306301/
applications/throngly/controllers/events.py:delete", line 225, in
<module>
File "/base/data/home/apps/throngly-com/1.340262947933306301/gluon/
globals.py", line 96, in <lambda>
self._caller = lambda f: f()
File "/base/data/home/apps/throngly-com/1.340262947933306301/gluon/
tools.py", line 1850, in f
return action(*a, **b)
File "/base/data/home/apps/throngly-com/1.340262947933306301/
applications/throngly/controllers/events.py:delete", line 80, in
delete
File "/base/data/home/apps/throngly-com/1.340262947933306301/gluon/
contrib/gql.py", line 696, in delete
counter = len(items)
TypeError: object of type 'Query' has no len()
On Mar 1, 6:30 pm, mdipierro <[email protected]> wrote:
> Can you send me the complete traceback please. This is different than
> the error that strasted the thread (about count()).
>
> Massimo
>
> On Mar 1, 5:24 am, Richard <[email protected]> wrote:
>
> > when using appadmin forgaetodeleteall records that satisfy the
> > query "db.scrape.id>0" I get:
>
> > Invalid Query
>
> > object of type 'Query' has no len()
>
> > I get this with both the latest release and trunk.
>
> > On Mar 1, 12:09 am, mdipierro <[email protected]> wrote:
>
> > > they should be quivalent
>
> > > On Feb 23, 10:11 pm, Richard <[email protected]> wrote:
>
> > > > I sometimes get that ID error on bothGAEand the development server,
> > > > and for non-deleteoperations such as:
>
> > > > db(db.client.id > 0).select()
>
> > > > so to be more robust I have replaced ID calls with:
>
> > > > db().select(db.client.ALL)
>
> > > > On Feb 7, 11:33 am, Jon Romero <[email protected]> wrote:
>
> > > > > the problem seems to happen when you try to query by the id field and
> > > > > thendelete(I coulddeletewhen I chose a different field)
>
> > > > > On Feb 7, 2:18 am, Jon Romero <[email protected]> wrote:
>
> > > > > > Some thing happens to me. When I do:
> > > > > > db(db.table.id == some_id_that_exists).delete, I get the same count
> > > > > > error
>
> > > > > > On Feb 4, 3:16 am, mdipierro <[email protected]> wrote:
>
> > > > > > > do you use 2.5 or something else locally?
>
> > > > > > > On Feb 3, 6:11 pm, Carl <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.