[Checkins] SVN: Sandbox/darrylcousins/tfws.website/ Moving on
Darryl Cousins
darryl at darrylcousins.net.nz
Mon Jul 23 06:25:18 EDT 2007
Log message for revision 78290:
Moving on
Changed:
A Sandbox/darrylcousins/tfws.website/CHANGES.txt
A Sandbox/darrylcousins/tfws.website/INSTALL.txt
A Sandbox/darrylcousins/tfws.website/README.txt
U Sandbox/darrylcousins/tfws.website/setup.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/BROWSER.txt
U Sandbox/darrylcousins/tfws.website/src/tfws/website/authentication.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/browser/browser.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/configure.zcml
U Sandbox/darrylcousins/tfws.website/src/tfws/website/interfaces.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py
U Sandbox/darrylcousins/tfws.website/src/tfws/website/site.py
A Sandbox/darrylcousins/tfws.website/src/tfws/website/site.txt
U Sandbox/darrylcousins/tfws.website/src/tfws/website/skin/skin.py
A Sandbox/darrylcousins/tfws.website/src/tfws/website/tests.py
-=-
Added: Sandbox/darrylcousins/tfws.website/CHANGES.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/CHANGES.txt (rev 0)
+++ Sandbox/darrylcousins/tfws.website/CHANGES.txt 2007-07-23 10:25:17 UTC (rev 78290)
@@ -0,0 +1,5 @@
+============
+tfws.website
+============
+
+
Property changes on: Sandbox/darrylcousins/tfws.website/CHANGES.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author
Added: Sandbox/darrylcousins/tfws.website/INSTALL.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/INSTALL.txt (rev 0)
+++ Sandbox/darrylcousins/tfws.website/INSTALL.txt 2007-07-23 10:25:17 UTC (rev 78290)
@@ -0,0 +1,60 @@
+============
+tfws.website
+============
+
+tfws.website is installed via buildout <http://cheeseshop.python.org/pypi/zc.buildout>.
+
+You may have setuptools already installed for your system Python. In
+that case, you may need to upgrade it first because buildout requires
+a very recent version::
+
+ $ sudo easy_install -U setuptools
+
+If this command fails because easy_install is not available, there is
+a good chance you do not have setuptools available for your system
+Python. If so, there is no problem because setuptools will be
+installed locally by buildout.
+
+Bootstrapping
+-------------
+
+Bootstrap the buildout environment::
+
+ $ python bootstrap/bootstrap.py
+
+If you do not have a ~/.buildout/default.cfg I suggest creating it and adding
+the following::
+
+ [buildout]
+ eggs-directory=/path/to/buildout/eggs
+ develop-eggs-directory=/path/to/buildout/develop-eggs
+
+This file is read when buildout is run and will re-use the eggs already
+installed.
+
+and run the buildout command::
+
+ $ bin/buildout [-N]
+ [lots of stuff will be downloaded and installed locally here]
+
+Testing
+-------
+
+Test the installation::
+
+ $ bin/test [website]
+
+Because we have additional packages installed as develop eggs
+(z3c.authentication and z3c.resource) the option ``website`` causes only tests
+in the tfws.website package to be run.
+
+Running the website
+-------------------
+
+Start the application::
+
+ $ bin/paster serve deploy.ini
+
+If you now connect to port 8080 and log in with username 'tfws',
+password 'tfws'.
+
Property changes on: Sandbox/darrylcousins/tfws.website/INSTALL.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author
Added: Sandbox/darrylcousins/tfws.website/README.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/README.txt (rev 0)
+++ Sandbox/darrylcousins/tfws.website/README.txt 2007-07-23 10:25:17 UTC (rev 78290)
@@ -0,0 +1,15 @@
+============
+tfws.website
+============
+
+This website application borrows heavily from z3c.website and other z3c
+packages. It is however in essence a `Grok`_ application and uses most or all
+of the `Mars`_ packages for component definitions and registration.
+
+Although the intention is to use it also in production the focus of development
+is to produce a demo application for the `Mars`_ packages. It is the second demo
+application, the first being `mars.formdemo`_.
+
+.. _`Grok`: http://grok.zope.org/
+.. _`Mars`: http://www.tfws.org.nz/mars
+.. _`mars.formdemo`: http://svn.zope.org/Sandbox/darrylcousins/mars.formdemo
Property changes on: Sandbox/darrylcousins/tfws.website/README.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author
Modified: Sandbox/darrylcousins/tfws.website/setup.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/setup.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/setup.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -26,7 +26,7 @@
'z3c.breadcrumb',
'z3c.configurator',
'z3c.form',
- 'z3c.form',
+ 'z3c.formjs',
'z3c.formui',
'z3c.layer',
'z3c.pagelet',
@@ -38,6 +38,8 @@
'z3c.formdemo',
'zc.resourcelibrary',
'zc.table',
+ 'jquery.javascript',
+ 'jquery.layer',
'mars.adapter',
'mars.contentprovider',
'mars.form',
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/BROWSER.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/BROWSER.txt 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/BROWSER.txt 2007-07-23 10:25:17 UTC (rev 78290)
@@ -22,6 +22,7 @@
>>> browser.open("http://localhost/add")
>>> browser.getControl('name').value = u'treefern'
+ >>> browser.getControl('Title').value = u'Tree Fern'
>>> browser.getControl('Login').value = u'darrylcousins'
>>> browser.getControl('Password').value = u'tfws'
>>> browser.getControl('First Name').value = u'Darryl'
@@ -35,9 +36,9 @@
>>> testing.printElement(browser, "//table/tbody/tr[1]/td/a/text()",
... multiple=True, serialize=False )
treefern
- Grok/Mars/Z3C Demo Site
+ Tree Fern
We can edit the new site.
>>> #print browser.contents
- >>> browser.getLink('Grok/Mars/Z3C Demo Site').click()
+ >>> browser.getLink('Tree Fern').click()
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/authentication.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/authentication.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/authentication.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -1,10 +1,60 @@
import zope.interface
+import zope.event
+import zope.lifecycleevent
from zope.schema.fieldproperty import FieldProperty
+from zope.app.component import hooks
+from zope.app.authentication.session import SessionCredentialsPlugin
+from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
from z3c.authentication.simple import member
+from z3c.authentication.simple import group
from tfws.website import interfaces
+def setup_site_auth(auth):
+
+ # setup credentials plugin
+ cred = SessionCredentialsPlugin()
+ zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(cred))
+ auth[u'credentials'] = cred
+ auth.credentialsPlugins += (u'credentials',)
+
+ site = auth.__parent__.__parent__
+ prm = IPrincipalRoleManager(site)
+
+ # setup 'members' member container
+ members = member.MemberContainer()
+ zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(members))
+ auth[u'members'] = members
+ auth.authenticatorPlugins += (u'members',)
+
+ # setup 'groups' group container
+ groups = group.GroupContainer(u'groups.')
+ zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(groups))
+ auth[u'groups'] = groups
+ auth.authenticatorPlugins += (u'groups',)
+
+ # setup 'Members' group
+ grp = group.Group(u'Members', u'Members')
+ groups.addGroup('Members', grp)
+ prm.assignRoleToPrincipal('tfws.website.Member', 'groups.Members')
+
+ # setup 'Administrators' group
+ grp = group.Group(u'Administrators', u'Administrators')
+ groups.addGroup('Administrators', grp)
+ prm.assignRoleToPrincipal('tfws.website.Administrator',
+ 'groups.Administrators')
+
+def role_factory(*args):
+ def factory():
+ return LocalRole(*args)
+ return factory
+
+def folder_factory(folderfactory, *args):
+ def factory():
+ return folderfactory(*args)
+ return factory
+
class WebSiteMember(member.Member):
"""An IMember for MemberContainer."""
@@ -24,3 +74,4 @@
def __repr__(self):
return '<%s %r>' %(self.__class__.__name__, self.title)
+
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/browser/browser.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/browser/browser.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/browser/browser.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -16,11 +16,12 @@
from tfws.website import interfaces
from tfws.website.browser import formatter
-from tfws.website.layer import IWebsiteLayer
+from tfws.website.layer import IWebSiteLayer
from tfws.website.i18n import MessageFactory as _
-mars.layer.layer(IWebsiteLayer)
+mars.layer.layer(IWebSiteLayer)
+# rremove this defintion
grok.define_permission('tfws.ManageSites')
class CheckboxColumn(column.Column):
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/configure.zcml
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/configure.zcml 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/configure.zcml 2007-07-23 10:25:17 UTC (rev 78290)
@@ -16,8 +16,11 @@
<include package="z3c.pagelet" file="meta.zcml" />
<include package="z3c.template" file="meta.zcml" />
<include package="z3c.zrtresource" file="meta.zcml" />
+
<include package="zc.resourcelibrary" file="meta.zcml" />
+ <include package="jquery.layer" />
+
<include package="z3c.breadcrumb" />
<include package="z3c.form" />
<include package="z3c.formui" />
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/interfaces.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/interfaces.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/interfaces.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -1,16 +1,6 @@
import zope.interface
import zope.schema
-from zope.annotation.interfaces import IAttributeAnnotatable
-from zope.app.container.interfaces import IContainer
-from zope.app.container.constraints import containers
-from zope.app.container.constraints import contains
-from zope.app.component.interfaces import IPossibleSite
-from zope.app.file.interfaces import IFile as ZIFile
-from zope.app.file.interfaces import IImage as ZIImage
-from zope.app.session.interfaces import ISession
import z3c.schema.email
-import z3c.pagelet.interfaces
-import z3c.form.interfaces
from z3c.authentication.simple.interfaces import IMember
from z3c.resource.interfaces import IResourceTraversable
from z3c.resource.interfaces import IResourceItem
@@ -19,12 +9,13 @@
#class IContent(IResourceTraversable): # grok traversal enough for me?
+# I need to get a better understanding of IResource.
class IContent(zope.interface.Interface):
"""Page interface."""
title = zope.schema.TextLine(
title=_(u'Title'),
- description=_(u'Title of the html page.'),
+ description=_(u'Title of the content.'),
default=u'',
required=False)
@@ -34,114 +25,11 @@
default=u'',
required=False)
- keyword = zope.schema.Text(
- title=_(u'Keyword'),
- description=_(u'Keyword of the content.'),
- default=u'',
- required=False)
- body = zope.schema.Text(
- title=_(u'Body'),
- description=_(u'Body is the main part of the page.'),
- default=u'',
- required=False)
-
-
class IWebSite(IContent):
- """grok/mars demo site."""
+ """grok/mars/z3c demo site."""
- containers('zope.app.folder.interfaces.IFolder')
- contains('tfws.website.interfaces.IPage')
- title = zope.schema.TextLine(
- title=_(u'Title'),
- description=_(u'The title of the site.'),
- default=u"Grok/Mars/Z3C Demo Site",
- required=True)
-
-
-class IPage(IContainer, IContent):
- """Page interface."""
-
- containers('tfws.website.interfaces.IWebSite',
- 'tfws.website.interfaces.IPage')
- contains('tfws.website.interfaces.IPage')
-
-
-class ISamples(IPage):
- """Container for samples"""
-
- containers(IWebSite)
- contains('z3c.website.interfaces.ISample')
-
- title = zope.schema.TextLine(
- title=_("Title"),
- description=_("The application title."),
- required=True)
-
-
-class ISample(IContent):
- """Base class for Z3C sample objects."""
-
- containers(ISamples)
-
- headline = zope.schema.TextLine(
- title=_(u'Headline'),
- description=_(u'The headline for the sample.'),
- default=u'',
- required=False)
-
- summary = zope.schema.Text(
- title=_(u'Summary'),
- description=_(u'The sumary for the sample.'),
- default=u'',
- required=False)
-
- author = zope.schema.TextLine(
- title=_(u'Author'),
- description=_(u'The author of the sample.'),
- default=u'',
- required=False)
-
-
-class ISamplePagelet(z3c.pagelet.interfaces.IPagelet):
- """Sample pagelet using a special IPageletRenderer which includes intro and
- footer templates."""
-
-
-class ISampleAddForm(z3c.form.interfaces.IAddForm,
- z3c.pagelet.interfaces.IPagelet):
- """Sample pagelet using a special IPageletRenderer whic includes intro and
- footer templates."""
-
-
-class ISessionData(zope.interface.Interface):
- """Simple data object which offers a field called content."""
-
- content = zope.schema.Text(
- title=u'Content',
- description=u'The content field',
- default=u'')
-
-
-class IDemoSession(ISession):
- """Simply session which knows how to set and get a object."""
-
- def setObject(key, obj):
- """Add a object to the session."""
-
- def getObject(key, default=None):
- """Get a object from the session."""
-
-
-class IFile(IResourceItem, ZIFile):
- """File resource item."""
-
-
-class IImage(IResourceItem, ZIImage):
- """Image resource item."""
-
-
class IWebSiteMember(IMember):
"""WebSite member."""
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/layer.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -1,4 +1,6 @@
+from jquery.layer import IJQueryJavaScriptBrowserLayer
+
import mars.form
-class IWebsiteLayer(mars.form.IDivFormLayer):
+class IWebSiteLayer(mars.form.IDivFormLayer, IJQueryJavaScriptBrowserLayer):
pass
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/site.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/site.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/site.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -10,22 +10,13 @@
from zope.app.catalog.catalog import Catalog
from zope.app.catalog.interfaces import ICatalog
from zope.app.folder.interfaces import IRootFolder
-from zope.app.authentication.session import SessionCredentialsPlugin
from zope.app.security.interfaces import IAuthentication
-from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
-from z3c.authentication.simple.authentication import SimpleAuthentication
-from z3c.authentication.simple.group import Group
-from z3c.authentication.simple.group import GroupContainer
-from z3c.authentication.simple.member import Member
-from z3c.authentication.simple.member import MemberContainer
-from z3c.authentication.simple.interfaces import IAuthenticatedPrincipal
-from z3c.authentication.simple.interfaces import IFoundPrincipal
-from z3c.authentication.simple.principal import PrincipalBase
-
-from z3c.configurator import configurator
from z3c.form import form, field, button, group
from z3c.formui import layout
+from z3c.formjs import jsaction, jsevent, ajax
+from z3c.configurator import configurator
+from z3c.authentication.simple.authentication import SimpleAuthentication
import grok
@@ -37,21 +28,25 @@
from tfws.website import interfaces
from tfws.website import authentication
from tfws.website.catalog import setup_catalog
-from tfws.website.layer import IWebsiteLayer
+from tfws.website.layer import IWebSiteLayer
from tfws.website.i18n import MessageFactory as _
-mars.layer.layer(IWebsiteLayer)
+mars.layer.layer(IWebSiteLayer)
class WebSite(grok.Application, grok.Container):
- """Mars/Grok/Z3C demo website"""
+ """Mars/Grok/Z3C demo website
+
+ """
zope.interface.implements(interfaces.IWebSite)
grok.local_utility(IntIds, IIntIds) # needed for the catalog
- grok.local_utility(Catalog, ICatalog, setup=setup_catalog)
+ grok.local_utility(Catalog, ICatalog, setup=setup_catalog,
+ name_in_container='wcatalog')
+ grok.local_utility(SimpleAuthentication, IAuthentication,
+ setup=authentication.setup_site_auth,
+ name_in_container='auth')
title = FieldProperty(interfaces.IWebSite['title'])
description = FieldProperty(interfaces.IWebSite['description'])
- keyword = FieldProperty(interfaces.IWebSite['keyword'])
- body = FieldProperty(interfaces.IWebSite['body'])
def __init__(self, title=None):
super(WebSite, self).__init__()
@@ -61,25 +56,34 @@
def __repr__(self):
return '<%s %r>' % (self.__class__.__name__, self.__name__)
+
class Index(mars.form.FormView, layout.FormLayoutSupport, form.DisplayForm):
"""Temp display view for site"""
fields = field.Fields(interfaces.IWebSite).omit('__parent__', 'title')
+
class IndexTemplate(mars.template.TemplateFactory):
grok.context(Index)
grok.template('templates/index.pt')
+
class InitialManagerGroup(group.Group):
label = u'Initial Manager Account'
fields = field.Fields(interfaces.IWebSiteMember, prefix="member").select(
'member.login', 'member.password', 'member.firstName',
'member.lastName', 'member.email')
+
class SiteMetaDataGroup(group.Group):
label = u'Site Metadata'
fields = field.Fields(interfaces.IWebSite).select('title',
- 'description', 'keyword')
+ 'description')
+class IEditButtons(zope.interface.Interface):
+ apply = jsaction.JSButton(title=_('Apply'))
+ applyView = jsaction.JSButton(title=_('Apply and View'))
+
+
class Edit(mars.form.FormView, layout.FormLayoutSupport,
group.GroupForm, form.EditForm):
"""Edit form for site"""
@@ -96,6 +100,11 @@
self.request.response.redirect(url)
+# use this button to call the ajax method
+class IAddButtons(zope.interface.Interface):
+ add = jsaction.JSButton(title=_('Add'))
+
+
class Add(mars.form.FormView, layout.AddFormLayoutSupport,
group.GroupForm, form.AddForm):
""" Add form for tfws.website."""
@@ -110,8 +119,10 @@
title=_(u"name"), required=True))
groups = (SiteMetaDataGroup, InitialManagerGroup)
+ #buttons = button.Buttons(IAddButtons)
- @button.buttonAndHandler(_('Add'), name='add')
+# I want this to be an ajax method
+ @button.buttonAndHandler(u'Add', name='add')
def handleAdd(self, action):
data, errors = self.extractData()
if errors:
@@ -123,6 +134,12 @@
if result is not None:
self._finishedAdd = True
+ #def handleAdd(self, event, selector):
+ #@ajax.handler
+ #@jsaction.JSButton(title=_('Test'))
+ #def callAdd(self, event, selector):
+ # return 'alert("hello")'
+
def create(self, data):
self.data = data
# get form data
@@ -150,51 +167,16 @@
def nextURL(self):
return self.request.URL[-1]
+
class SiteConfigurator(grok.Adapter, configurator.ConfigurationPluginBase):
- """Configure the site."""
+ """Configure the site, this has access to the data submitted by the add
+ form as well as local utilities defined with grok.local_utility."""
zope.component.adapts(interfaces.IWebSite)
def __call__(self, data):
- # get parameters
- # Add the pluggable authentication utility
- sm = zope.component.getSiteManager(self.context)
- auth = SimpleAuthentication()
- zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(auth))
- sm['auth'] = auth
- sm.registerUtility(auth, IAuthentication)
-
- # setup credentials plugin
- cred = SessionCredentialsPlugin()
- zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(cred))
- auth[u'credentials'] = cred
- auth.credentialsPlugins += (u'credentials',)
-
- prm = IPrincipalRoleManager(self.context)
-
- # setup 'members' member container
- members = MemberContainer()
- zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(members))
- auth[u'members'] = members
- auth.authenticatorPlugins += (u'members',)
-
- # setup 'groups' group container
- groups = GroupContainer(u'groups.')
- zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(groups))
- auth[u'groups'] = groups
- auth.authenticatorPlugins += (u'groups',)
-
- # setup 'Members' group
- grp = Group(u'Members', u'Members')
- groups.addGroup('Members', grp)
- prm.assignRoleToPrincipal('tfws.website.Member', 'groups.Members')
-
- # setup 'Administrators' group
- grp = Group(u'Administrators', u'Administrators')
- groups.addGroup('Administrators', grp)
- prm.assignRoleToPrincipal('tfws.website.Administrator',
- 'groups.Administrators')
-
+ auth = zope.component.getUtility(IAuthentication,
+ context=self.context)
# Add a Admin to the administrators group
login = data['member.login']
admin = authentication.WebSiteMember(login, data['member.password'],
@@ -203,6 +185,7 @@
zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(admin))
auth['members'].add(admin)
- adminGroup = groups['groups.Administrators']
+ adminGroup = auth['groups']['groups.Administrators']
adminGroup.setPrincipals(
adminGroup.principals + (admin.__name__,), check=False)
+
Added: Sandbox/darrylcousins/tfws.website/src/tfws/website/site.txt
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/site.txt (rev 0)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/site.txt 2007-07-23 10:25:17 UTC (rev 78290)
@@ -0,0 +1,28 @@
+Website
+=======
+
+First we need to ``grok`` the package.
+
+ >>> import grok
+ >>> grok.grok('tfws.website')
+
+Imports for later.
+
+ >>> import zope.component
+ >>> from zope.app.security.interfaces import IAuthentication
+ >>> from zope.app.catalog.interfaces import ICatalog
+
+Create a site
+
+ >>> from tfws.website.site import WebSite
+ >>> root['treefern'] = site = WebSite(u'Tree Fern')
+
+It has an authentication utility and a catalog.
+
+ >>> auth = zope.component.getUtility(IAuthentication, context=site)
+ >>> print auth
+ <z3c.authentication.simple.authentication.SimpleAuthentication object at 0x...>
+ >>> catalog = zope.component.getUtility(ICatalog, context=site)
+ >>> print catalog
+ <zope.app.catalog.catalog.Catalog object at 0x...>
+
Property changes on: Sandbox/darrylcousins/tfws.website/src/tfws/website/site.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author
Modified: Sandbox/darrylcousins/tfws.website/src/tfws/website/skin/skin.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/skin/skin.py 2007-07-23 06:10:27 UTC (rev 78289)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/skin/skin.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -8,6 +8,8 @@
import z3c.formui
+from jquery.javascript.browser import JQueryJavaScriptViewlet
+
import grok
import mars.layer
@@ -15,10 +17,10 @@
import mars.viewlet
import mars.resource
-from tfws.website.layer import IWebsiteLayer
+from tfws.website.layer import IWebSiteLayer
# module level layer definition
-mars.layer.layer(IWebsiteLayer)
+mars.layer.layer(IWebSiteLayer)
class TFWSWebsite(mars.layer.Skin):
"""The ``tfwswebsite`` browser skin."""
@@ -45,14 +47,21 @@
grok.name('IJavaScript')
grok.context(zope.interface.Interface)
+class JQueryViewlet(mars.viewlet.SimpleViewlet, JQueryJavaScriptViewlet):
+ """jquery viewlet"""
+ grok.name('jquery.js')
+ grok.context(zope.interface.Interface) # todo set this to a form marker interface
+# TODO use mars.viewlet.view to set to a jquery view marker
+ mars.viewlet.manager(JavaScriptManager)
+
WebsiteCSSViewlet = CSSViewlet('website.css')
-class FormDemoCSSViewlet(mars.viewlet.SimpleViewlet, WebsiteCSSViewlet):
+class WebSiteCSSViewlet(mars.viewlet.SimpleViewlet, WebsiteCSSViewlet):
"""css viewlet"""
grok.name('website.css')
grok.context(zope.interface.Interface)
mars.viewlet.manager(CSSManager)
-class DemoStyle(mars.resource.ResourceFactory):
+class WebSiteStyle(mars.resource.ResourceFactory):
"""resources (++resource++website.css)"""
grok.name('website.css')
mars.resource.file('website.css')
Added: Sandbox/darrylcousins/tfws.website/src/tfws/website/tests.py
===================================================================
--- Sandbox/darrylcousins/tfws.website/src/tfws/website/tests.py (rev 0)
+++ Sandbox/darrylcousins/tfws.website/src/tfws/website/tests.py 2007-07-23 10:25:17 UTC (rev 78290)
@@ -0,0 +1,33 @@
+import unittest
+from zope.testing import doctest
+from zope.app.testing import setup, ztapi
+
+from zope.annotation.interfaces import IAnnotatable
+from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
+from zope.app.securitypolicy.principalrole \
+ import AnnotationPrincipalRoleManager
+
+optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
+
+def setUp(test):
+ root = setup.placefulSetUp(site=True)
+ test.globs['root'] = root
+ ztapi.provideAdapter(IAnnotatable, IPrincipalRoleManager,
+ AnnotationPrincipalRoleManager)
+
+def tearDown(test):
+ setup.placefulTearDown()
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTests([doctest.DocFileSuite('site.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=optionflags),
+ ])
+
+ return suite
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
+
Property changes on: Sandbox/darrylcousins/tfws.website/src/tfws/website/tests.py
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the Checkins
mailing list