[z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue?

Maciej Wiśniowski maciej.wisniowski at coig.katowice.pl
Wed Jul 12 09:55:26 CEST 2006


Hi

I have clean instance of Zope 2.8.6 and with just one
product in Products - Five (1.2.5). I've written simple
product with use of five directives but this product causes
zope to report strange errors... why? Here is the description:

Using ZMI I've created folder structure:

mytest/                             # Folder with one additional 
property: myattr:string = myvalue
         index_html              # Python Script with one line: return 
context.body()
         /subfolder               # Folder
                       body        # Page template with line: <h2 
tal:content="context/myattr"></h2>

When I'm visiting http://localhost:8080/mytest/subfolder I see:

myvalue

at output page and I think it is correct.
Strange things happen when I add one more product.
It's definition is below. After putting it to Products/
folder and restarting zope visiting

http://localhost:8080/mytest/subfolder

causes:

Error Type: Unauthorized
Error Value: You are not allowed to access 'myattr' in this context

Maybe something is wrong in my product, or it's a bug in Five?
With this kind of product I can see a lot of other errors too.
Something like this:

*Error Type: Unauthorized*
*Error Value: No container provided. Access to 'xyz' of None, acquired 
through (Folder at /dev/sth/App/Main/Pages/home), denied.*


Another thing - it is not possible to access:

http://localhost:8080/++resource++tm_icon.gif

but

http://localhost:8080/mytest/++resource++tm_icon.gif

works correctly.

Is browser:addform supported correctly in this version of Five?
I have few more questions about this directive, but I'll ask them later ;)



My product that does nothing:

Products/
             testowy/
                        __init__.py              # empty file
                        main_module.py      # main file
                       configure.zcml          # configuration
                        tm_icon.gif              # my icon


# -------------main_module.py
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from OFS.Folder import Folder
from zope.interface import implements
from zope.interface import Interface
from zope.schema import Text, TextLine, Choice

class ITestowyModule(Interface):
    """ TestowyModule
    """
   
    title = TextLine(
        title=u"Title",
        required=False,
        description=u"The title of the TestowyModule.")

class TestowyModule(Folder):
    """TestowyModule"""

    implements(ITestowyModule)
       
    def __init__(self, id, title):
        self.id            = id
        self.title         = title
       
def TestowyModuleFactory(view, id, title):   
    obj = TestowyModule(id, title)
    return obj.__of__(view.context)


# ------------- configure.zcml
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:browser="http://namespaces.zope.org/browser"
           xmlns:five="http://namespaces.zope.org/five"
           i18n_domain="testowy">

  <five:traversable class="OFS.Folder.Folder" />
 
  <browser:resource
    name="tm_icon.gif"
    image="tm_icon.gif"
  />
 
  <browser:addform
     schema=".main_module.ITestowyModule"
     content_factory=".main_module.TestowyModuleFactory"
     name="testowymodule_addform"
     permission="zope2.ViewManagementScreens"
     label="Add TestowyModule"
     >
  </browser:addform>

  <five:registerClass
     class=".main_module.TestowyModule"
     meta_type="TestowyModule"
     permission="zope2.ViewManagementScreens"
     icon="tm_icon.gif"
     addview="testowymodule_addform"
     />
</configure>

-- 
Maciej Wisniowski


More information about the z3-five mailing list