This is a refactor of everything web2py uses with redis.
Specifically:
- a refactored redis_cache.py that fixes#958, allowing a "fail
gracefully" behaviour in case redis is not available
- a refactored redis_session.py that blocks less with with_lock=True
(although still not optimal)
- a new (and NEEDED) redis_utils.py that serves as the base for
everything else, allowing an RConn object that you can freely use as a
redis.StrictRedis connection, and that you can override in case you're
using a different library (or that web2py will use in case redis-py
won't be the de-facto standard around)
- a newly - and much anticipated - redis_scheduler.py. It's a slip-in
replacement for the standard scheduler that uses redis for workers
coordination. Feel free to dig in the code and improve it.
For redis_cache and redis_session changes are BREAKING. It means that
users will need to change the import locations and tune a bit the code.
Now every module depends on an gluon.contrib.redis_utils.RConn object
(or similar) that in turns is very similar to a redis.StrictRedis one.
The redis instance is EXTERNAL to the modules themselves (no more "host,
port, db, password" parameters in RedisCache or RedisSession)
See the relevant docstrings for usage examples
now elements with data-w2p_disable are not disabled.
in addition, for non-ajax forms, disabled submit buttons are reenabled
after 5 seconds
plus reindented, refactored AND jslinted
- if hmac.compare_digest is there, we should use it instead of our own
fallback.
- jwt handler has been updated to use utils.compare (reported in
#web2py-users)
- includes the same mods as https://github.com/web2py/web2py/pull/1146
response.include_files is now cleaner and easier to maintain
You can specify a tuple of (type, url) to include external assets
without extension (such as the usecase described in #628)
Added tests for include_files, that was never included in CI tests
Improvements over the "old" v1.0
- behaves well also without javascript
- use_ssl is redundant, v2.0 works only in https mode
- ajax is not useful anymore as the newer API is a lot easier
Adjusted also the addrow() method that was missing newer formstyles.
Why didn't we think before ? References are lazy, but when asked
for representation why should we fetch the same referenced record
over and over ?
NB: the code caches only represent() fetching records from tables, that
are the only idempotent represent() calls out there. We could cache
every representation only asking for every represent() call to be
idempotent. As I feel there will be someone returning random values,
I left it out.
I'll make a PR soon for pyDAL to fix the same behaviour.
Removed redundant tests in test_validators.py since there's test_isurl.py
Added allowed_tlds from http://data.iana.org/TLD/tlds-alpha-by-domain.txt
Added script to easily update the official_top_level_domains for the future
since there is no more a proper place to put the new regex, it's on top
of the module for speedup. The patch leaves open a few corner-cases,
but since we have "headers" to alter the headers in SQLTABLE, any
corner case can be fixed passing properly filled "headers" parameter.
This just makes the simple case described on the issue work fine, that
should accomodate the 99% of the usecases for with_alias() needs
at the field level.
- fixed response.include_files() to behave correctly with
response.static_version_urls
- added response.static_version_urls to admin
- refactored admin URL() usage passing always and correctly 'static'
as the controller
one clear case of "should never happen"... that happened.
in this case docs were failing builds on readthedocs because of
pypyodbc not being able to load any odbc library.
this is because jquery can't know what button was pressed when the
submit event is triggered. We circumvent it adding an hidden field before
triggering the submission
BTW: don't know why the commit seems huge. I just changed a bit the trap_form
function to handle the corner case and streamlined what disableElement,
enableElement, disableFormElements, enableFormElements do,
along with formInputClickSelector
This comes from an unfortunate choice of naming conventions and the fact that
manage errors gets called even on the full document on page load.
I had a table full of .error-"classed" elements and it took nearly 30 seconds for that
snippet to hide and fade them in. We should definitevely prefix every css class with
something that won't clash with everything else.
pyflaked the module, at least a bit. Sometimes I feel developers are in a contest
where less characters and lines win. Concise implementation wins over verbose one,
but less SLOC DON'T mean somewhat better code. Just reading through
this module makes my brain hurt a bit