I went through the same motions as you in Zope2.12 trying to use
Phillkon's book as a guide. I think I ran into the same problem as you.
The key is in the package five.localsitemanager.<br><br>My Site Interface is nothing. <br>
<br>class IMySite(Interface):<br> """My Site""<br><br>In my site.py I have the following. <br>...<br>from five.localsitemanager import make_objectmanager_site<br>...<br>class MySite(Folder):<br>
implements(IMySite)<br> def __init__(self, id):<br> setHooks()<br> Folder.__init__(self, id='Mine')<br> make_objectmanager_site(self) <----- key to making a OFS folder a site<br><div id=":t8" class="ii gt">
setSite(self)<br> notify(NewMySiteEvent(self)<br><br>After that you can treat your MySite OFS Folder like a site. Register utilities with it, setHooks, and setSite.<br><br>Hope this helps,<br><font color="#888888"><br>
- Jim</font></div><br><br><div class="gmail_quote">On Thu, Jan 28, 2010 at 2:40 AM, Roberto Allende <span dir="ltr"><<a href="mailto:rover@menttes.com">rover@menttes.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello<br>
<br>
Following example 18.3.1 and 18.3.2 from phillkon's book, i'm trying to<br>
define a MySite class in Zope 2.12, which look like this:<br>
<br>
<br>
class IMySite(IPossibleSite, IContainer):<br>
"""<br>
"""<br>
id = ASCIILine( ...<br>
name = TextLine( ...<br>
<br>
<br>
class MySite(SiteManagerContainer, BTreeContainer):<br>
implements(IMySite)<br>
<br>
So far so good, i've an interface and a class extending<br>
SiteManagerContainer and BTreeContainer. Problem becomes when i want to<br>
define the add form. If i'm not wrong, I cannot use the same machinery<br>
as zope3, so i was trying to use formlib:<br>
<br>
class MySiteAddForm(AddForm):<br>
form_fields=form.Fields(IListo)<br>
<br>
And i doesn't work. The error i'm getting is:<br>
<br>
NotImplementedError: concrete classes must implement create() or<br>
createAndAdd()<br>
<br>
I was looking info about them but i wonder i'm running with a conceptual<br>
gap here, because this is the same problem i had to define MySite<br>
inheriting from Folder. The same problem happened there, i was able to<br>
define the class but when i needed the form i wasn't able to use formlib<br>
and i used old-zope2-like-code. Probably i could try to do smt like<br>
that, but i'm very curious to see how can i use formlib in such cases.<br>
<br>
The question then is, is it possible or would it make sense to do<br>
something like this ?. Do you know about a sample code that could be<br>
helpful ?.<br>
<br>
Any comment or hint would be very appreciated.<br>
<br>
Kind Regards<br>
r.<br>
<br>
--<br>
<a href="http://robertoallende.com" target="_blank">http://robertoallende.com</a><br>
<br>
_______________________________________________<br>
Zope maillist - <a href="mailto:Zope@zope.org">Zope@zope.org</a><br>
<a href="https://mail.zope.org/mailman/listinfo/zope" target="_blank">https://mail.zope.org/mailman/listinfo/zope</a><br>
** No cross posts or HTML encoding! **<br>
(Related lists -<br>
<a href="https://mail.zope.org/mailman/listinfo/zope-announce" target="_blank">https://mail.zope.org/mailman/listinfo/zope-announce</a><br>
<a href="https://mail.zope.org/mailman/listinfo/zope-dev" target="_blank">https://mail.zope.org/mailman/listinfo/zope-dev</a> )<br>
</blockquote></div><br>