Traceback (most recent call last):
File "/home/spametki/web2py/web2py-git/gluon/restricted.py", line 217, in restricted
exec ccode in environment
File "/home/spametki/web2py/web2py-git/applications/mongodb/views/appadmin.html", line 189, in <module>
</p>
File "/home/spametki/web2py/web2py-git/gluon/sqlhtml.py", line 2899, in __init__
columns = ['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c in sqlrows.colnames]
AttributeError: 'NoneType' object has no attribute 'groups'
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You can try to create a regexp in the adapter that works in your model.
You can try to create a regexp in the adapter that works in your model.
Undoing the regex pattern change from the mentioned patch appears to solve the problem. Tried the match method and it finds the columns with the "table.field" notation. I'm not a regex guru, but according to my understanding of the Python docs the new pattern requires column names to end with a ".", so this matches:
this.is.my.column.name
but this doesn't
this.is
. Is that the intended behavior?
Every adapter needs the following attributes set properly in pair:QUOTE_TEMPLATE -> to send queries with correct entity quotingREGEX_TABLE_DOT_FIELD -> to split table and field when parsing responses from the db engine.
> What are you trying to match?
As you mentioned, the new pattern does work too for inputs like "mytable.myfield" (colnames returned by the mongodb .select method), so I guess the actual problem is with the default base adapter quote template.
--
Every adapter needs the following attributes set properly in pair:
QUOTE_TEMPLATE -> to send queries with correct entity quotingREGEX_TABLE_DOT_FIELD -> to split table and field when parsing responses from the db engine.
My bad, I didn't find the requirement within the framework documentation.
> Up to now the code has been tested on (postgresql, mysql, sqlite) BUT NOT ON mongodb.Well, actually I did test the adapter while debugging an issue and found this another one.
> Most database engines have a way to allow a characters besides case insensitive ASCII in the name of entities (call them tables andUntil this is requested for support (and in case that the storage systems that are not relational dbs actually support extended charsets for defining objects) I think we can safely return to the former quoting/table naming to prevent this and further issues (only with NoSQLAdapter subclasses). Unless there are objections, I can send the patch.
> fields).
> or overwrite it in your model just after DAL instantiation.I'd prefer not requiring users to add configuration commands so their apps keep working with new versions. It would be somewhat against web2py style.
2013/12/7 Alan Etkin <spam...@gmail.com>Every adapter needs the following attributes set properly in pair:QUOTE_TEMPLATE -> to send queries with correct entity quotingREGEX_TABLE_DOT_FIELD -> to split table and field when parsing responses from the db engine.
My bad, I didn't find the requirement within the framework documentation.Why your bad? it's not documented at all, it was only partially supported before and I started trying to make it more complete.Once we agree on a stable API we will have to document it. One important aspect of the API is that Field and Table have a newproperty "sqlsafe" this contains the name of the entity quoted. [ Actually "sqlsafe" has been poorly chosen (by me) and should become "querysafe" or something similar since we do not deal with sql only...]..sqlsafe is "rname" aware, i.e. if you use rname attribute, in the entity definition, sqlsafe will use that asis.
I hadn't noticed sqlsafe, which shares QUOTE_TEMPLATE. So my suggestion of a generalized QUOTE_TEMPLATE wouldn't work.
1. |
Traceback (most recent call last |
): |