fix JS macro; add 'authenticated' property to base view

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3277 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-03-15 13:48:07 +00:00
parent c0ce542b9c
commit a603002142
2 changed files with 7 additions and 2 deletions

View file

@ -45,7 +45,7 @@
<metal:js define-macro="js" <metal:js define-macro="js"
tal:define="layout view/context/template"> tal:define="layout view/context/template">
<script type="text/javascript" <script type="text/javascript"
tal:attributes="src string:${view/page/resourceBase}${layout/resource});"> tal:attributes="src string:${view/page/resourceBase}${layout/resource};">
</script> </script>
</metal:js> </metal:js>

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de # Copyright (c) 2009 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@ from zope import component
from zope.interface import Interface, implements from zope.interface import Interface, implements
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.pagetemplate import ViewPageTemplateFile
from zope.app.security.interfaces import IUnauthenticatedPrincipal
from cybertools.composer.layout.base import Layout from cybertools.composer.layout.base import Layout
from cybertools.composer.layout.interfaces import ILayoutManager from cybertools.composer.layout.interfaces import ILayoutManager
@ -49,6 +50,10 @@ class BaseView(object):
def __call__(self): def __call__(self):
return self.template(self) return self.template(self)
@Lazy
def authenticated(self):
return not IUnauthenticatedPrincipal.providedBy(self.request.principal)
class Page(BaseView): class Page(BaseView):