[ZPT] Calling complex product tags from ZPT
Juan David Ibáñez Palomar
j-david@noos.fr
Sun, 07 Jul 2002 18:56:30 +0200
J C Lawrence wrote:
>On Sun, 07 Jul 2002 17:12:23 +0200
>j-david <ISO-8859-1> wrote:
>
>
>
>>I've tried with a new installation, just installed Zope 2.5.1 on a
>>Debian system...
>>
>>
>
>FWLIW I'm running Debian/testing here.
>
>
>
good :-)
>>... Localizer 0.8.1, mxDateTime 0.3, and did a symbolic link from
>><Zope HOME>/lib/python2.1/site-packages/mx to my Debian mx
>>installation. It worked.
>>
>>
>
>Ahh, perhaps there's the critical bit. What symlink and why?
>
>
>
I did a symlink because it was an installation from a Zope
binary, not the Debian package, and this was the quickest
way to get mx in the python path.
But I also have Zope from Debian and it works without the
symlink because the mx is already in the python.
>I installed the Egenix Debian mx packages which shoved all their bits
>under /usr/lib/python2.1/site-packages/mx:
>
> $ dpkg --get-selections | fgrep egenix
> python2.1-egenix-mxdatetime install
> python2.1-egenix-mxproxy install
> python2.1-egenix-mxqueue install
> python2.1-egenix-mxstack install
> python2.1-egenix-mxtexttools install
> python2.1-egenix-mxtools install
>
>
>
For me this is:
python-egenix-mxdatetime install
python2.1-egenix-mxdatetime install
python2.1-egenix-mxtools install
> $ dpkg -L python2.1-egenix-mxtools | fgrep site-packages
> /usr/lib/python2.1/site-packages
> /usr/lib/python2.1/site-packages/mx
> /usr/lib/python2.1/site-packages/mx/Misc
> /usr/lib/python2.1/site-packages/mx/Misc/Namespace.py
> ...
> /usr/lib/python2.1/site-packages/mx/__init__.py
> ...
>
>Just to check that my Zope installation is running python 2.1:
>
> $ head -1 `which zope-z2`
> #! /usr/bin/python
> $ ls -l /usr/bin/python
> lrwxrwxrwx 1 root root 9 Apr 28 14:42 /usr/bin/python -> python2.1
> $ ls -l /usr/bin/python2.1
> -rwxr-xr-x 1 root root 517864 Apr 20 01:32 /usr/bin/python2.1
>
>
>
Everything looks right.
>There doesn't seem to be a Zope-specific site-packages directory unless
>I'm missing something. /usr/lib/python2.1/site-packages and
>/usr/local/lib/python2.1/site-packages are the only site-packages
>directory I have on my system outside of XEmacs.
>
>
>
Yes, there's a <ZOPE HOME>/lib/python2.1/site-packages in
a Zope binary installation, but not in the Debian package.
>I've cut back my Zope installation to:
>
> Debian Zope package (2.5.1-1)
> CVS CMF (newer than the Debian package)
> Localizer 0.8.1
> mxDateTime 0.3.0
> NuxWidgets 0.1.0
> and the above listed python2.1-egenix-mx* packages.
>
>
>
Look at /usr/lib/zope/lib/python/Products, is there any hotfix?
They patch Zope, I already had a problem with one of them and
Localizer.
>I'm passing "-I /var/lib/zope" to zope-z2 (setting of ZOPECTLOPTS in
>the init script) and then installing CMF, Localizer, mxDateTime, and
>NuxWidgets under /var/lib/zope/Products. Per the products list in Zope
>this works fine.
>
>Still no go here for the ZPT widgets/calendar tag tho.
>
>Stupid question:
>
> As I understand the docs and how NuxWidgets is trying to hook into ZPT
> I shouldn't have to do anything in my page template other than just
> call widgets/calendar, right? Specifically I don't have to do a
> use-macro or similar reference to NuxWidgets beforehand...
>
>
>
The simplest test is:
<div metal:use-macro="widgets/calendar" />
The "calendar" is a macro so it's used with "use-macro", but
that's all, nothing else needs to be done. This line should
render a simple calendar.
>>I think you should try to debug, try with a new installation as I did.
>>
>>
>
>Arrgh. Debugging Zope is something I've not done before. I see several
>basic approaches recommended when wandering zope.org. Recommended
>approach?
>
>
>
I use a really primitive way to debug, which is enough most of
the time. Just modify NuxWidgets to output a message in the right
places. For example, in NuxWidgets.__init__.py, add the following
line at the beginning of pt_getContext:
open('/tmp/kk', 'w').write('pt_getContext from NuxWidgets\n')
Then, every time you try to view a page template the file "/tmp/kk"
should be created. If it isn't then the patch wasn't applied or
some other code overwrited it.
But I also suggest to set up a new installation from a Zope binary
(without the CMF, etc.., only with the required stuff), and see if
it works or not. It takes 5 minutes.
--
J. David Ibáñez, http://www.j-david.net
Software Engineer / Ingénieur Logiciel / Ingeniero de Software