{ "info": { "author": "Andrey Tkachenko", "author_email": "falko.lab@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "This package provides new flexible zcml directive to inserts a computed by \r\ncontent version info (hash, crc32 or versionfile) into the resource's URL, \r\nso the URL changes whenever the contents change, thereby forcing a browser to \r\nupdate its cache.\r\n\r\n==================================\r\nCache Burster for Zope 3/BlueBream\r\n==================================\r\n\r\nThis package contains the `IVersionedResourceLayer` layer. This layer supports \r\na correct set of component registration and can be used for inheritation in \r\ncustom skins.\r\n\r\nTesting\r\n-------\r\n\r\nFor testing the Cache Burster we use the testing skin defined in the tests \r\npackage which uses the `IVersionedResourceLayer` layer as the only base layer. \r\nThis means, that our testing skin provides only the views defined in the minimal \r\npackage and it's testing views defined in tests.\r\n\r\nLogin as manager first:\r\n\r\n >>> from zope.testbrowser.testing import Browser\r\n >>> browser = Browser()\r\n >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')\r\n \r\nWe have page template file that looks as:\r\n \r\n >>> print getTemplateContent('page.pt')\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\nWe have ``page.html`` view which is registred in the\r\n``ftesting.zcml`` file with our skin for testing purposes:\r\n\r\n >>> browser.open('http://localhost/page.html')\r\n >>> browser.url\r\n 'http://localhost/page.html'\r\n \r\nRendered view:\r\n\r\n >>> print browser.contents\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\nNothing has changed, all right. \r\n\r\nCache Burster rule\r\n------------------\r\n\r\nNow we register Cache Burster rule:\r\n\r\n >>> from zope.configuration import xmlconfig\r\n >>> import falkolab.cacheburster\r\n >>> context = xmlconfig.file('meta.zcml', falkolab.cacheburster)\r\n >>> def zcml(s, context): \r\n ... return xmlconfig.string(s, context)\r\n\r\n >>> context = zcml(r\"\"\"\r\n ... \r\n ...\r\n ... \r\n ...\r\n ... \r\n ... \"\"\", context)\r\n \r\nOK. Render page again:\r\n\r\n >>> browser.open('http://localhost/page.html')\r\n >>> print browser.contents\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\nThe cacheburster directive `from` and `to` fields use python re syntax.\r\nThat looks similarly re.sub(from, to, resourcename)\r\nWe can specify from=\"(.*).js\". It means that the rule was accepted by all \r\nresources that end with `.js`.\r\n\r\nTest that resource URL is accessible:\r\n\r\n >>> browser.open('http://localhost/@@/script.8dc15d98.js')\r\n >>> print browser.contents \r\n alert('script.js');\r\n\r\nAdd next rule:\r\n\r\n >>> context = zcml(r\"\"\"\r\n ... \r\n ...\r\n ... \r\n ...\r\n ... \r\n ... \"\"\", context)\r\n \r\nRender page again:\r\n\r\n >>> browser.open('http://localhost/page.html')\r\n >>> print browser.contents\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\nTest that resource URL is accessible:\r\n\r\n >>> browser.open('http://localhost/@@/one-module.css?579d7fcdc5acc3fe9f063020b2f573cf')\r\n >>> print browser.contents \r\n body {background:#ffffff;} \r\n\r\nNo-file resource\r\n----------------\r\n \r\nRegister resource and rule:\r\n\r\n >>> import zope.browserresource\r\n >>> context = xmlconfig.file('meta.zcml', zope.browserresource, context)\r\n >>> context = zcml(r\"\"\"\r\n ... \r\n ... \r\n ...\r\n ... \r\n ...\r\n ... \r\n ... \"\"\", context)\r\n \r\n >>> browser.open('http://localhost/page2.html')\r\n >>> print browser.contents\r\n \r\n \r\n \r\n \r\n \r\n \r\nTest that resource URL is accessible:\r\n\r\n >>> browser.open('http://localhost/@@/fdd9b757.nofile')\r\n >>> print browser.contents \r\n no file resource body\r\n \r\nResource Directory\r\n------------------\r\n\r\n >>> context = zcml(r\"\"\"\r\n ... \r\n ... \r\n ... \r\n ... \"\"\", context) \r\n \r\nNow we test resource url within ResourceDirectory:\r\n\r\n >>> resourceDir = zope.component.getAdapter(request, name='resources')\r\n >>> resourceDir['script.js']() \r\n 'http://127.0.0.1/@@/resources/script.js'\r\n \r\n >>> resourceDir['one-module.css']()\r\n 'http://127.0.0.1/@@/resources/one-module.css?c25661cc824732136e9ec697d97afaed'\r\n \r\nWe can see rules matching difference between `(script).js` and `(.*)-module.css`. \r\nTest that resource URL is accessible:\r\n\r\n >>> browser.open('http://localhost/@@/resources/one-module.css?c25661cc824732136e9ec697d97afaed')\r\n >>> print browser.contents \r\n body {background:#ffffff;}\r\n \r\nFile Version Manager\r\n--------------------\r\n\r\nCreate and register file manager as `versionfile`:\r\n\r\n >>> import os, tempfile\r\n >>> temp_dir = tempfile.mkdtemp()\r\n\r\n >>> pathToVersionFile = os.path.join(temp_dir, 'version.txt')\r\n >>> open(pathToVersionFile, 'w').write(\"1\")\r\n\r\n >>> from zope.browserresource.interfaces import IResource\r\n >>> manager = falkolab.cacheburster.version.FileVersionManager(pathToVersionFile)\r\n\r\n >>> zope.component.provideAdapter(manager,\r\n ... (zope.browserresource.interfaces.IResource, \r\n ... falkolab.cacheburster.interfaces.IVersionedResourceLayer), \r\n ... falkolab.cacheburster.interfaces.IVersionManager, name='versionfile')\r\n\r\nAdd rule:\r\n\r\n >>> context = zcml(r\"\"\"\r\n ... \r\n ...\r\n ... \r\n ...\r\n ... \r\n ... \"\"\", context)\r\n\r\nLook at the page:\r\n\r\n >>> print getTemplateContent('page3.pt')\r\n \r\n \r\n \r\n \r\n \r\n \r\nRender page:\r\n\r\n >>> browser.open('http://localhost/page3.html')\r\n >>> print browser.contents\r\n \r\n \r\n \r\n \r\n \r\n \r\nCleanup\r\n-------\r\n\r\n >>> import shutil\r\n >>> shutil.rmtree(temp_dir)\r\n\r\n=======\r\nCHANGES\r\n=======\r\n\r\n0.1.5 (2010-12-17)\r\n\r\n- Added path normalization so that A//B, A/B/, A/./B and A/foo/../B all become A/B.\r\n\r\n0.1.4 (2010-12-07)\r\n------------------\r\n\r\n- Fix direct call Resources from ResourceDirectory \r\n\r\n0.1.3 (2010-11-23)\r\n------------------\r\n\r\n- ResourceDirectory support\r\n\r\n0.1.2 (2010-11-21)\r\n------------------\r\n\r\n- Changes to MANIFEST.in\r\n\r\n0.1.1 (2010-11-19)\r\n------------------\r\n\r\n- Package broken. Changes to add README.txt\r\n\r\n0.1.0 (2010-11-16)\r\n------------------\r\n\r\n- Initial release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "resource cache burster hash crc32 version", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "falkolab.cacheburster", "package_url": "https://pypi.org/project/falkolab.cacheburster/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/falkolab.cacheburster/", "project_urls": { "Download": "UNKNOWN" }, "release_url": "https://pypi.org/project/falkolab.cacheburster/0.1.5/", "requires_dist": null, "requires_python": null, "summary": "Manipulations with browser resource URL to forcing a browser to update its cache", "version": "0.1.5" }, "last_serial": 1675643, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "af61d41b67ac85459f44f0cb435331eb", "sha256": "70658b8349aff1dcf26e4bd7e874b8e2edb25d23c69c2e0f4902231fe557b6e8" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.0.tar.gz", "has_sig": false, "md5_digest": "af61d41b67ac85459f44f0cb435331eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11539, "upload_time": "2010-11-18T15:28:34", "url": "https://files.pythonhosted.org/packages/e5/9f/97416cce832b6505f2651326a1e0f5735ce39336d7befdb4513dc10722df/falkolab.cacheburster-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "46a1436c1c6a9a2a23ae67ef0ce253fb", "sha256": "c78521c11fb5e4d57bdfb227de7f8d005f3461f6058a2a1f7cf8c97a4536d08b" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.1.tar.gz", "has_sig": false, "md5_digest": "46a1436c1c6a9a2a23ae67ef0ce253fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13157, "upload_time": "2010-11-19T18:15:33", "url": "https://files.pythonhosted.org/packages/81/dc/e96973294b17eccacadbb54fb3bb116221a362714c6e22f9c3bcc8fa1b4e/falkolab.cacheburster-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0f6998769af83d760add4ce196a6a712", "sha256": "167065917cc03a0b065211d80792168c28e727b84d293c793b8f829686ff0179" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0f6998769af83d760add4ce196a6a712", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14068, "upload_time": "2010-11-21T01:36:23", "url": "https://files.pythonhosted.org/packages/a2/55/39b1ce4c0dd3db452d1c6152f88727a491f0aa9b6cab157bcef9ee3ea9e6/falkolab.cacheburster-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "7d10a1e71ed8aa3c205c9905510ee50e", "sha256": "558b8a2b4a1c42cd0da59ddc93cadb44e3f966dd107909ad3212ad372d3e6acf" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7d10a1e71ed8aa3c205c9905510ee50e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14408, "upload_time": "2010-11-23T19:58:01", "url": "https://files.pythonhosted.org/packages/af/a4/d1fc804a3b210b129fc2708fccdfebbf0faff9e08f0d64def326a6e3bfb7/falkolab.cacheburster-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "526403d730eb097777fc7809314c4041", "sha256": "56e3e74f6e38e2f442368823d6060910d97678ce8ca7bbef35b96c7da8498a29" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.4-py2.6.egg", "has_sig": false, "md5_digest": "526403d730eb097777fc7809314c4041", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 35765, "upload_time": "2010-12-07T10:19:42", "url": "https://files.pythonhosted.org/packages/94/f9/80340e0b89dc0628230c2fc3cb476965fe1775b086bf14779ee7b2a07351/falkolab.cacheburster-0.1.4-py2.6.egg" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "78f449e31296d3a6587477a66a624e57", "sha256": "6b2a9dba6948386c536b582c05051ecce96c9a82f72a6415087df287868d30b3" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.5-py2.6.egg", "has_sig": false, "md5_digest": "78f449e31296d3a6587477a66a624e57", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 35971, "upload_time": "2010-12-17T18:05:12", "url": "https://files.pythonhosted.org/packages/03/4c/9b192a65058fd1b8ae17133da07ce5a93c898521e6dbada73aad2f3596f7/falkolab.cacheburster-0.1.5-py2.6.egg" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "78f449e31296d3a6587477a66a624e57", "sha256": "6b2a9dba6948386c536b582c05051ecce96c9a82f72a6415087df287868d30b3" }, "downloads": -1, "filename": "falkolab.cacheburster-0.1.5-py2.6.egg", "has_sig": false, "md5_digest": "78f449e31296d3a6587477a66a624e57", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 35971, "upload_time": "2010-12-17T18:05:12", "url": "https://files.pythonhosted.org/packages/03/4c/9b192a65058fd1b8ae17133da07ce5a93c898521e6dbada73aad2f3596f7/falkolab.cacheburster-0.1.5-py2.6.egg" } ] }