Author: jmorliaguet Date: Wed May 17 22:54:29 2006 New Revision: 3158 Modified: cpsskins/branches/paris-sprint-2006/setup/README.txt
Log: - test fix Modified: cpsskins/branches/paris-sprint-2006/setup/README.txt ============================================================================== --- cpsskins/branches/paris-sprint-2006/setup/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/setup/README.txt Wed May 17 22:54:29 2006 @@ -90,9 +90,8 @@ resource directly (e.g. 'cpsskins://dummy:resource1') we access it by referring to the corresponding setting (e.g. 'cpsskins://[EMAIL PROTECTED]'). - >>> resources.register(name=u'setting1', title=u'Setting 1', - ... resource=resource1) - <Setting: cpsskins://[EMAIL PROTECTED]> + >>> setting1 = resources.register(name=u'setting1', title=u'Setting 1', + ... resource=resource1) we can look up the setting: @@ -112,9 +111,8 @@ Now we register the second resource: - >>> resources.register(name=u'setting2', title=u'Setting 2', - ... resource=resource2) - <Setting: cpsskins://[EMAIL PROTECTED]> + >>> setting2 = resources.register(name=u'setting2', title=u'Setting 2', + ... resource=resource2) and look it up in the registry: @@ -134,9 +132,8 @@ so we register a local resource, we do this by passing a context to register(): - >>> resources.register(name=u'setting3', title=u'Setting 3', - ... resource=resource3, context=root) - <Setting: cpsskins://[EMAIL PROTECTED]> + >>> setting3 = resources.register(name=u'setting3', title=u'Setting 3', + ... resource=resource3, context=root) We now have a local resource in the context of the root folder: @@ -146,10 +143,15 @@ but for the application in the context of the root folder there is no difference between local and global resources: - >>> pprint(resources.list(type=IDummyResource, context=root)) - [<Setting: cpsskins://[EMAIL PROTECTED]>, - <Setting: cpsskins://[EMAIL PROTECTED]>, - <Setting: cpsskins://[EMAIL PROTECTED]>] + >>> res = resources.list(type=IDummyResource, context=root) + >>> setting1 in res + True + + >>> setting2 in res + True + + >>> setting3 in res + True Unregistering settings @@ -283,28 +285,11 @@ >>> file.close() -Reloading settings ------------------- - -File-system settings can be reloaded: - - >>> from cpsskins.setup.registration import reloadSetting - >>> reloadSetting(u'cpsskins://[EMAIL PROTECTED]') - -Settings created through-the-web cannot be reloaded: +Global settings are registered in ZCML with: - >>> reloadSetting(u'cpsskins://[EMAIL PROTECTED]') - Traceback (most recent call last): - ... - TypeError: The setting is not a file-system setting. - -File-system resources can also be refreshed: - - >>> from cpsskins.setup.registration import refreshSettings - >>> refreshSettings() - -In that case the file's modification date is compared with the date when the -settings were last loaded. +<configure xmlns:cpsskins="http://namespaces.zope.org/cpsskins"> + <cpsskins:setup settings="settings.tgz" /> +</configure> IMPORT / EXPORT @@ -483,7 +468,7 @@ >>> gsm = zapi.getGlobalSiteManager() >>> resource = Style() - >>> root[u'style-1'] = resource + >>> root[u'style-2'] = resource >>> unicode(IRelatable(resource)) == unicode(resource.identifier) True @@ -499,7 +484,7 @@ once: >>> resource = Style() - >>> root[u'style-2'] = resource + >>> root[u'style-3'] = resource >>> print IIdentifiable(resource).getURI() cpsskins://format-style:... @@ -533,11 +518,19 @@ ------------------ >>> style = Style() + >>> root[u'style-1'] = style >>> resources.register(name=u'style1', title=u'Style 1', resource=style) <Setting: cpsskins://[EMAIL PROTECTED]> - >>> setting = resources.lookup(u'style1') + >>> setting = resources.lookup(u'cpsskins://[EMAIL PROTECTED]') >>> print toXML(setting, u'settings') + <?xml version="1.0" encoding="utf-8"?> + <settings> + <setting custom="False" name="style1" title="Style 1" type="format-style"> + <style id="..."/> + </setting> + </settings> + <BLANKLINE> Export of styles ---------------- @@ -731,6 +724,8 @@ ... "\x18\x05\xa3`\x14\x8c\x82Q0\nF\x01\xbd\x01\x00\x07\x80\x00\x01:" \ ... "\xe7\xca\xd4\x00\x00\x00\x00IEND\xaeB`\x82" + >>> root[u'portlet-1'] = portlet + >>> from zope.app.file.image import getImageInfo >>> getImageInfo(portlet.data) ('image/png', 120, 120) @@ -749,7 +744,8 @@ </portlets> <BLANKLINE> - >>> archive == portlet.data + >>> binary_name = u'%s_data_120x120.png' % portlet.identifier + >>> archive[binary_name] == portlet.data True -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins