Changeset 1276
- Timestamp:
- 04/18/08 15:55:41 (8 months ago)
- Files:
-
- pleiades.vocabulary/trunk/pleiades/vocabulary/browser/__init__.py (added)
- pleiades.vocabulary/trunk/pleiades/vocabulary/browser/configure.zcml (modified) (1 diff)
- pleiades.vocabulary/trunk/pleiades/vocabulary/browser/vocabularies_index.pt (modified) (1 diff)
- pleiades.vocabulary/trunk/pleiades/vocabulary/browser/vocabulary.py (added)
- pleiades.vocabulary/trunk/pleiades/vocabulary/browser/vocabulary_view.pt (modified) (7 diffs)
- pleiades.vocabulary/trunk/pleiades/vocabulary/configure.zcml (modified) (2 diffs)
- pleiades.vocabulary/trunk/pleiades/vocabulary/profiles/default/skins.xml (deleted)
- pleiades.vocabulary/trunk/pleiades/vocabulary/tests/base.py (modified) (1 diff)
- pleiades.vocabulary/trunk/pleiades/vocabulary/tests/test_doctests.py (modified) (1 diff)
- pleiades.vocabulary/trunk/pleiades/vocabulary/tests/vocab-views.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pleiades.vocabulary/trunk/pleiades/vocabulary/browser/configure.zcml
r1273 r1276 4 4 > 5 5 6 <browser: view6 <browser:page 7 7 for="*" 8 8 name="vocabulary_macros" 9 class=".macros.ThesaurusMacros" 9 class=".vocabulary.VocabularyMacros" 10 template="vocabulary_macros.pt" 10 11 permission="zope.View" 11 12 /> pleiades.vocabulary/trunk/pleiades/vocabulary/browser/vocabularies_index.pt
r1275 r1276 75 75 header_macro view_macros/header | header_macro | base_macros/header; 76 76 body_macro view_macros/body | body_macro | base_macros/body; 77 thesaurilisting_macro context/ thesauri_macros/macros/thesaurilisting | folderlisting | base_macros/folderlisting;77 thesaurilisting_macro context/vocabulary_macros/macros/thesaurilisting | folderlisting | base_macros/folderlisting; 78 78 footer_macro view_macros/footer | footer_macro | base_macros/footer; 79 79 errors python:request.get('errors', {})"> pleiades.vocabulary/trunk/pleiades/vocabulary/browser/vocabulary_view.pt
r1274 r1276 5 5 xmlns:metal="http://xml.zope.org/namespaces/metal" 6 6 xmlns:i18n="http://xml.zope.org/namespaces/i18n" 7 metal:use-macro=" here/main_template/macros/master"7 metal:use-macro="context/main_template/macros/master" 8 8 i18n:domain="plone"> 9 9 … … 11 11 12 12 <metal:javascript_head fill-slot="javascript_head_slot"> 13 <tal:block define="macro here/archetypes_custom_js/macros/javascript_head | nothing"13 <tal:block define="macro context/archetypes_custom_js/macros/javascript_head | nothing" 14 14 condition="macro"> 15 15 <metal:block use-macro="macro" /> … … 21 21 create additional defines for each slot it fills. 22 22 </tal:comment> 23 <tal:js define="fields python: here.Schema().viewableFields(here);24 js python: here.getUniqueWidgetAttr(fields, 'helper_js')"23 <tal:js define="fields python:context.Schema().viewableFields(context); 24 js python:context.getUniqueWidgetAttr(fields, 'helper_js')" 25 25 condition="js" 26 26 repeat="item js"> … … 31 31 </script> 32 32 </tal:js> 33 <tal:block define="portal_type python: here.getPortalTypeName().lower().replace(' ', '_');33 <tal:block define="portal_type python:context.getPortalTypeName().lower().replace(' ', '_'); 34 34 view_template python:'%s_view' % portal_type; 35 view_macros python:path(' here/%s/macros|nothing' % view_template);35 view_macros python:path('context/%s/macros|nothing' % view_template); 36 36 macro view_macros/js | nothing" 37 37 condition="macro"> … … 47 47 create additional defines for each slot it fills. 48 48 </tal:comment> 49 <tal:css define="fields python: here.Schema().viewableFields(here);50 css python: here.getUniqueWidgetAttr(fields, 'helper_css')"49 <tal:css define="fields python:context.Schema().viewableFields(context); 50 css python:context.getUniqueWidgetAttr(fields, 'helper_css')" 51 51 condition="css" 52 52 repeat="item css"> … … 57 57 </style> 58 58 </tal:css> 59 <tal:block define="portal_type python: here.getPortalTypeName().lower().replace(' ', '_');59 <tal:block define="portal_type python:context.getPortalTypeName().lower().replace(' ', '_'); 60 60 view_template python:'%s_view' % portal_type; 61 view_macros python:path(' here/%s/macros|nothing' % view_template);61 view_macros python:path('context/%s/macros|nothing' % view_template); 62 62 macro view_macros/css | nothing" 63 63 condition="macro"> … … 69 69 <metal:fill fill-slot="main"> 70 70 <metal:main_macro define-macro="main" 71 tal:define="portal_type python: here.getPortalTypeName().lower().replace(' ', '_');72 base_macros here/base/macros;71 tal:define="portal_type python:context.getPortalTypeName().lower().replace(' ', '_'); 72 base_macros context/base/macros; 73 73 view_template python:'%s_view' % portal_type; 74 view_macros python:path(' here/%s/macros|nothing' % view_template);75 header_macro here/thesaurus_macros/macros/header | base_macros/header;74 view_macros python:path('context/%s/macros|nothing' % view_template); 75 header_macro context/thesaurus_macros/macros/header | base_macros/header; 76 76 body_macro view_macros/body | body_macro | base_macros/body; 77 termlisting_macro here/thesaurus_macros/macros/termlisting | folderlisting | base_macros/folderlisting;77 termlisting_macro context/vocabulary_macros/macros/termlisting | folderlisting | base_macros/folderlisting; 78 78 footer_macro view_macros/footer | footer_macro | base_macros/footer; 79 79 errors python:request.get('errors', {}); pleiades.vocabulary/trunk/pleiades/vocabulary/configure.zcml
r1266 r1276 5 5 i18n_domain="pleiades.policy" 6 6 > 7 8 <include package="zope.app.component" file="meta.zcml"/> 9 <include package="zope.app.security" file="meta.zcml"/> 10 <include package="zope.app.security"/> 7 11 8 12 <five:registerPackage package="." initialize=".initialize" /> … … 16 20 /> 17 21 22 <include package=".browser"/> 23 18 24 </configure> pleiades.vocabulary/trunk/pleiades/vocabulary/tests/base.py
r1268 r1276 42 42 we can put common utility or setup code in here. 43 43 """ 44 45 46 class PleiadesVocabularyFunctionalTestCase(ptc.FunctionalTestCase): 47 """We use this base class for all the tests in this package. If necessary, 48 we can put common utility or setup code in here. 49 """ pleiades.vocabulary/trunk/pleiades/vocabulary/tests/test_doctests.py
r1275 r1276 8 8 def test_suite(): 9 9 return unittest.TestSuite([ 10 ztc. ZopeDocFileSuite(10 ztc.FunctionalDocFileSuite( 11 11 'vocab-views.txt', 12 12 package='pleiades.vocabulary.tests', 13 test_class=base.PleiadesVocabulary TestCase,13 test_class=base.PleiadesVocabularyFunctionalTestCase, 14 14 optionflags=optionflags 15 15 ) pleiades.vocabulary/trunk/pleiades/vocabulary/tests/vocab-views.txt
r1275 r1276 3 3 ============================== 4 4 5 Query the catalog using the spatialcatalog view 5 First, we must perform some setup. We use the testbrowser that is shipped 6 with Five, as this provides proper Zope 2 integration. Most of the 7 documentation, though, is in the underlying zope.testbrower package. 6 8 7 >>> r = http(r""" 8 ... GET /vocabulary/vocabularies_index HTTP/1.1 9 ... Authorization: Basic mgr:mgrpw 10 ... """, handle_errors=False) 11 >>> r.getStatus() 12 200 13 >>> print r.getBody() 14 '' 9 >>> from Products.Five.testbrowser import Browser 10 >>> browser = Browser() 11 >>> portal_url = self.portal.absolute_url() 12 13 The following is useful when writing and debugging testbrowser tests. It lets 14 us see all error messages in the error_log. 15 16 >>> self.portal.error_log._ignored_exceptions = () 17 18 With that in place, we can go to the portal front page and log in. We will 19 do this using the default user from PloneTestCase: 20 21 >>> from Products.PloneTestCase.setup import portal_owner, default_password 22 23 >>> browser.open(portal_url) 24 25 We have the login portlet, so let's use that. 26 27 >>> browser.getControl(name='__ac_name').value = portal_owner 28 >>> browser.getControl(name='__ac_password').value = default_password 29 >>> browser.getControl(name='submit').click() 30 31 Here, we set the value of the fields on the login form and then simulate a 32 submit click. 33 34 We then test that we are still on the portal front page: 35 36 >>> browser.url == portal_url 37 True 38 39 And we ensure that we get the friendly logged-in message: 40 41 >>> "You are now logged in" in browser.contents 42 True 43 44 Test index of vocabularies 45 46 >>> browser.handleErrors = False 47 >>> vocab_url = self.portal.vocabulary.absolute_url() 48 >>> browser.open("%s/vocabularies_index" % vocab_url) 49 >>> 'name-accuracy' in browser.contents 50 True 51 52 Test view of one vocabulary 53 54 >>> vocab_url = self.portal.vocabulary.absolute_url() 55 >>> browser.open("%s/vocabulary_view?t=name-accuracy" % vocab_url) 56 >>> 'a string of characters in an ancient (primary)' in browser.contents 57 True 58
