[Zope] Help create filesystem skin with product
yary
not.com at gmail.com
Wed Oct 11 18:37:55 EDT 2006
I'm having a problem which must have been solved many times before-
trying to make a product that ships with a skin. I'm new to Zope
development, been stumbling for a couple months with it.
Ideally, the end user will unpack my product "Q" into a Products
directory. They will be able to add a "Q" object to an existing CMF
site, or create a "QSite" at their Zope2 root. If they create a QSite,
my product should give it a QSkin during instantiation. I'm developing
the QSkin (and the entire Q product) on the filesystem.
Background:
The product includes a subclass of CMFSite called a QSite. If the user
creates a QSite, I'd like it to include a QSkin which the user can
select from the portal_skins tool.
The product is running on Zope 2.9.4, Five 1.4, CMF 2.0. It needs to
work on Windows and Linux. (Would like to use Zope 2.10, Five 1.5 when
someone compiles the win32 installer, so I don't have to worry about
"five:traversable" directives! Already posted a request for that.)
Customer requires that the product have no Plone dependencies. Product
will require workflow, so it can have a CMF dependency. Could possibly
implement on Zope 3, though I could not figure out basic workflow
management on that platform, and would rather not re-implement
something available on Zope2.
Hurdles I've had so far in creating a skin:
Using Five- seems to be the way to go. Started by trying
"browser:page" & "browser:defaultView" with QSite/IQSite- really
didn't know what I was doing, and a helpful sould pointed out, that is
what skins are for.
Tried using zcml "skin" directive, "broswer:layer", and "browser:defaultSkin".
I can create a skin in zcml, and adding "/++skin++QSkin" to the end of
any URL causes the page to load. However it does not look like a
QSkin- apparently acquisition finds items in portal_skins before it
finds resources added by five. So if I use zcml to add a Logo.gif, it
won't override a Logo.gif already on the CMF site, to see it I have to
also add "/++resource++Logo.gif"
I cannot use defaultSkin with CMF, because CMF already declares a
defaultSkin. Its better if the user picks the skin from the
portal_skins management interface, but skins and layers declared in
zcml don't show up there.
As for "the old/tried-and-true way", can't use the
ExampleFileSystemSkin or MinimalPloneSkin as a starting point, perhaps
they use parts of Plone: "cannot import name ContentFactoryMetadata."
http://plonebook.packtpub.com/chapter6_preview.htm looks promising.
Hurdles I've had so far installing the skin:
Tried using container events ("subscriber" zcml) to call a hook when a
QSite is created, presuming that I'd work skin magic on the new site
object from within the event handler. Alas that is not the intended
purpose of "subscriber" and while it may work in the future, events
don't fire on CMFSite objects yet.
Am I supposed to create a "manage_afterAdd" method in my QSite object,
even though it's depreciated? Hmm, just tried creating that as a
method of QSite and it doesn't get called either- what's the right
way?
Thanks for reading my rambling.
More information about the Zope
mailing list