-
Notifications
You must be signed in to change notification settings - Fork 7
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
Instant cache refreshing on ZMI-JS changes #345
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left comment.
Products/zms/__init__.py
Outdated
# a. write it into separate file and | ||
# b. create a configuration parameter | ||
min_fileobj = open(fileobj.name, 'r') | ||
min_hash = standard.encrypt_password(min_fileobj.read(),hex=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use the python builtin hash()-function and hexlify the result?
Password encryption maybe misleading and change its behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ZMS-builtin function does exactly the required task:
https://github.com/zms-[publishing/ZMS/blob/f5d6275e83ab7d63e33ccf1a03ed2b5ce0997917/Products/zms/conf/metaobj_manager/captcha_lib/captcha_func.py#L46-L57](https://github.com/zms-publishing/ZMS/blob/f5d6275e83ab7d63e33ccf1a03ed2b5ce0997917/Products/zms/standard.py#L622-L645)
Of course the function's name might suggest a special purpose and a limited use. So feel free to apply the python-builtin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
Ref: https://github.com/idasm-unibe-ch/unibe-cms/issues/744
ZMI-JS-code changes may be unseen after deployment due to proxy caching. A hash value of the minified ZMI-JS code (created on Zope start) will refresh the proxy caching of the minfied file
/++resource++zms_/zms-all.min.js
.The code proposal determines the hash value from the freshly created
zms-all.min.js
-file and writes it aszms-all.min.js.hash
into the file system andjs_min.hash
Thus it is easy to
zmscontext.getConfProperty('js_min.hash')
Any code status will result in a specific hash-value ...
... and create a new URL for zms-all.min.js: