On Feb 3, 2010, at 9:43 AM, Thadeus Burgess wrote:

> Ok take a look at the following proposed changes

Comments.

* Could we use 'check_reserved' instead of 'check_reserve'? It sounds more 
natural to me.

* Capitalize SQL in the error message strings

* dal.py is already much too long. Could the wordlists live somewhere else?

* Is 'print' the most appropriate way to show the warning message? How about at 
least sending it to stderr, or see the next point:

* I don't entirely get the rationale for the distinction between the warning 
message and raising a syntax error, at least not based on the selected list. 
Since this is intended for development, not production, why not just make it a 
syntax error and be done with it? Or if it's important, make it a separate 
option.

* I remain uneasy about the idea of doing this on every call (vs calls that 
make actual changes in the db). I don't know what the performance overhead is 
of the lookup (I suspect that frozenset would be faster--at the very least 
something immutable), so maybe it's a non-concern. I'm also uneasy about 
proliferating flags that you have to remember to turn off for production; it's 
too easy to forget about once it's working.

> 
> http://code.google.com/r/thadeusburgess-web2py/source/detail?r=c416459252755abde998e923021188335924e02c
> 
> I made it DRY. Also you pass a list of options. Here is example usage
> 
> db = DAL('sqlite....', pool_size...., check_reserve=['common',
> 'postgres', 'mysql'])
> 
> check_reserve is a list of backends to use, with two extra terms 'all'
> and 'common'. It defaults to None, which performs no check.
> 
> If you set common, it will check the KEYWORDS_COMMON list, and throw a
> SyntaxError.
> 
> If you set all, it will check the KEYWORDS_ALL list, and print a
> warning message.
> 
> If you set an adapter name, it will check the adapters KEYWORDS and
> throw a SyntaxError.
> 
> This only effects the new dal, (dal.py) since i do not have time to
> implement this for sql.py.
> 
> 
> As Jonathan Lundell suggests in his mercurial post, you can code
> review this change. Once we are happy, Massimo can pull the changes
> in.
> 
> -Thadeus


-- 
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.

Reply via email to