-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix allowed table and field names #67
Comments
Problem could be back compatibility |
it was that way. Then cleanup was relaxed to.... pretty anything. |
I agree, and we should have the same approach for situations such as:
raises
while
raises
In addition, the following works at 'pydal' level:
but then it fails at 'db' level:
raises
|
this should be fixed before the next release to avoid finding ourselves in 6 months locked-in for backward compatibility |
I've moved this to 15.04 milestone. If anybody is interested into fixing this, let us know. |
this is quite an easy fix, once we all agree. There's nothing documented in the book, so a clear and large statement in the CHANGELOG would suffice. I didn't read anything conclusive on web2py-developers, but I strongly think that this should be closed once and for all. |
+1 on @niphlod vote |
ok, I think we can safely assume the only responsible for whining users would be me and @gi0baro . I'm ready to take the heat. @gi0baro : |
@niphlod ok with that |
ok, will send a PR soon enough. |
@gi0baro : another question... I'd go for the same routine for both tablenames and fieldnames, which is basically:
table would have also the restriction of not being a yet-existing attribute of DAL. tl;dr: adding "a valid python identifier" constraint to the existing one on Table and all of the above for Field |
umpf. quite there. How the heck should we check that |
@niphlod sorry, I was AFK. Anyway, I'm missing your point, since isinstance('è', str) is |
right ........ will do this evening. |
sorry if I chime in late @niphlod, does this help? 2015-05-20 10:40 GMT+02:00 niphlod notifications@github.com:
|
unfortunately not. in py3 it would allow also unicode, since \W is in. Seeing the code, I won't touch "cleanup()" as it seems that the validation is both in Table and Field #current
if (not isinstance(tablename, str) or tablename[0] == '_'
or hasattr(DAL, tablename) or '.' in tablename
or REGEX_PYTHON_KEYWORDS.match(tablename)
):
#will probably become
# in regex.py
NEWREGEX = re.compile('^[^\d_][_0-9a-zA-Z]+$')
....
if (not isinstance(tablename, basestr) or hasattr(DAL, tablename)
or NEWREGEX.match(tablename)
or REGEX_PYTHON_KEYWORDS.match(tablename)
): |
As discussed in web2py-developers (such as here ), we should avoid any table and field name that is not coherent with python identifiers. The cleanup() needs a revision and tests should be added to avoid regressions. We have rname for legacy and/or funny names.
The text was updated successfully, but these errors were encountered: