Discussion:
bug?
lekma
2007-01-14 11:26:18 UTC
Permalink
Hi,

given the following extent:

class Lang(E.Entity):

base_code = f.string()

_index(base_code)


the following takes place in schevo shell env when i try to build a
query:

schevo_test # schevo shell test.db
Schevo 3.0b4dev-r2831 :: Python Shell

Opened database test.db
Python 2.4.3 (#1, Sep 27 2006, 10:43:07)
[GCC 4.1.1 (Gentoo 4.1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
db.Lang.find()[0].base_code
'lg'
Q = db.Q
langs_en = Q.Match(db.Lang, 'base_code', 'startswith', 'en')
langs_en()
...(tons of tracebacks (path stripped for lisibility))...

File "schevo/query.py", line 43, in __str__
return str(unicode(self))
File "schevo/query.py", line 386, in __unicode__
field.set(value)
File "schevo/field.py", line 302, in set
msg = '%s field is readonly and cannot be changed on %s %r' % (
File "schevo/query.py", line 43, in __str__
return str(unicode(self))
File "schevo/query.py", line 386, in __unicode__
field.set(value)
File "schevo/field.py", line 302, in set
msg = '%s field is readonly and cannot be changed on %s %r' % (
RuntimeError: maximum recursion depth exceeded
is this a bug, or am i missing something (i'm following the example at
http://schevo.org/trac/wiki/SchevoPublicApi#match-queries)?
the Lang extent holds 185000 entities (i'm testing performances), maybe
it's relevant.

thanks for any help

lekma
lekma
2007-01-17 10:17:36 UTC
Permalink
Hi all,

I'm still trying to grasp the underlying code here, so forgive me if
what i say below is complete and utter nonsense :)


So, it seems that the exception is caused by the fact that all
entities fields are readonly. This behaviour was introduced in
changeset 2792 (http://schevo.org/trac/changeset/2792).

If i comment line 226 to 230 in schema.py (i didn't revert the
changeset, just commented these lines) then the query behave as
advertised.

So, the question is: is this the result of an api change (i.e. i
should build queries differently)? or is this a bug?

thanks for any help

lekma




On Sun, 14 Jan 2007 12:26:18 +0100
Post by lekma
Hi,
base_code = f.string()
_index(base_code)
the following takes place in schevo shell env when i try to build a
schevo_test # schevo shell test.db
Schevo 3.0b4dev-r2831 :: Python Shell
Opened database test.db
Python 2.4.3 (#1, Sep 27 2006, 10:43:07)
[GCC 4.1.1 (Gentoo 4.1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
db.Lang.find()[0].base_code
'lg'
Q = db.Q
langs_en = Q.Match(db.Lang, 'base_code', 'startswith', 'en')
langs_en()
...(tons of tracebacks (path stripped for lisibility))...
File "schevo/query.py", line 43, in __str__
return str(unicode(self))
File "schevo/query.py", line 386, in __unicode__
field.set(value)
File "schevo/field.py", line 302, in set
msg = '%s field is readonly and cannot be changed on %s %r' % (
File "schevo/query.py", line 43, in __str__
return str(unicode(self))
File "schevo/query.py", line 386, in __unicode__
field.set(value)
File "schevo/field.py", line 302, in set
msg = '%s field is readonly and cannot be changed on %s %r' % (
RuntimeError: maximum recursion depth exceeded
is this a bug, or am i missing something (i'm following the example at
http://schevo.org/trac/wiki/SchevoPublicApi#match-queries)?
the Lang extent holds 185000 entities (i'm testing performances),
maybe it's relevant.
thanks for any help
lekma
_______________________________________________
Schevo-devel mailing list
http://schevo.org/lists/mailman/listinfo/schevo-devel
Patrick K. O'Brien
2007-01-17 15:40:18 UTC
Permalink
Post by lekma
Hi all,
I'm still trying to grasp the underlying code here, so forgive me if
what i say below is complete and utter nonsense :)
So, it seems that the exception is caused by the fact that all
entities fields are readonly. This behaviour was introduced in
changeset 2792 (http://schevo.org/trac/changeset/2792).
If i comment line 226 to 230 in schema.py (i didn't revert the
changeset, just commented these lines) then the query behave as
advertised.
So, the question is: is this the result of an api change (i.e. i
should build queries differently)? or is this a bug?
Entity fields do need to be readonly, but a corresponding change needs
to be made such that query fields are not readonly, just like
transaction fields are not readonly. And we need some query unit tests
so that this situation would have been caught sooner.

I implemented this fix: http://schevo.org/trac/changeset/2843.
--
Patrick K. O'Brien
Orbtech http://www.orbtech.com
Schevo http://www.schevo.org
Louie http://www.pylouie.org
Loading...