[Zope3-Users] PyWebOff

Shane Hathaway shane at hathawaymix.org
Fri Mar 3 02:27:48 EST 2006


Hello,

I've been assigned to present Zope in a local upcoming Python user group 
meeting.  As part of the assignment, I'm supposed to solve the PyWebOff 
challenge using Zope:

http://pyre.third-bit.com/pyweb/challenge.html

I'd like to do this using Zope 3.  However, I'm really struggling.  I 
feel like I must be using Zope 3 in a really dumb way, because the code 
so far is highly repetitive, completely dependent on Zope, and more XML 
than Python.  This is not going to go over well in the presentation.

Can anyone tell me how to do this better with Zope 3?  Maybe my Zope 2 
experience is preventing me from seeing something obvious.  I've 
attached the __init__.py and configure.zcml that I created in a package 
called "challenge".

Shane
-------------- next part --------------
A non-text attachment was scrubbed...
Name: __init__.py
Type: text/x-python
Size: 1131 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20060303/5cc39c82/__init__.py
-------------- next part --------------
<configure xmlns="http://namespaces.zope.org/zope"
  xmlns:browser="http://namespaces.zope.org/browser">

<content class=".Book">
<require
  permission="zope.View"
  interface=".IBook"
  />
<require
  permission="zope.ManageContent"
  set_schema=".IBook"
  />
</content>

<content class=".Loan">
<require
  permission="zope.ManageContent"
  interface=".ILoan"
  />
<require
  permission="zope.ManageContent"
  set_schema=".ILoan"
  />
</content>

<content class=".Library">
<require
  permission="zope.ManageContent"
  interface=".ILibrary"
  />
<require
  permission="zope.ManageContent"
  set_schema=".ILibrary"
  />
</content>

<browser:addform
  name="addlibrary"
  schema=".ILibrary"
  content_factory=".Library"
  permission="zope.ManageContent"
  />

<browser:addMenuItem
  class=".Library"
  permission="zope.ManageContent"
  view="addlibrary"
  title="Library"
  />

<browser:containerViews
  for=".ILibrary"
  index="zope.View"
  contents="zope.View"
  add="zope.ManageContent"
  />

<browser:addform
  name="addbook"
  schema=".IBook"
  content_factory=".Book"
  permission="zope.ManageContent"
  />

<browser:addMenuItem
  class=".Book"
  permission="zope.ManageContent"
  view="addbook"
  title="Book"
  />

<browser:editform
  schema=".IBook"
  permission="zope.ManageContent"
  menu="zmi_views"
  title="Edit"
  name="edit"
  />

<browser:addform
  name="addloan"
  schema=".ILoan"
  content_factory=".Loan"
  permission="zope.ManageContent"
  />

<browser:addMenuItem
  class=".Loan"
  permission="zope.ManageContent"
  view="addloan"
  title="Loan"
  />

<browser:editform
  schema=".ILoan"
  permission="zope.ManageContent"
  menu="zmi_views"
  title="Edit"
  name="edit"
  />

</configure>


More information about the Zope3-users mailing list