[Zope-dev] Re: Interfaces in Zope 2.5, 2.7, and 3.x

2004-03-04 Thread Tres Seaver
Martijn Faassen wrote:
Jim Fulton wrote:

Martijn's suggestion was to use an alternate name for the 
"__implements__" attribute.  I suppost I could do that -- call mine
 "__narya_interfaces__", but that sounds ugly.  In particular, I
don't really want my interfaces module to actually *conflict* with
Zope's.
As I mentioned on the zope3-dev list, you want to use the facade
Interface from (Packages3/Interface) in Zope 2.7. This is a bit of a
pain to set up. The facade will be a standard part of Zope 2.8.
As a note so Terry also sees; I couldn't get this to work.

Setting it up using the zope.conf 'path' setting in Zope 2.7 to include 
this on the Python path fails, as Zope actually imports the old (non 
facade) interface package before it gets to do configuration. This means 
the facade never is imported, as the next imports will re-use the cached 
  initial import.
Here is an excerpt from the 'runzope' I use for "FrankenZope" sites 
(that is our affectionate name for that Interface package):

  #!/bin/sh
  python="/opt/zc/bin/python2.3"
  zope_home="/opt/zc/lib/zope2.7"
  zodb3_home="/opt/zc/lib/zodb3.2"
  zope3_home="/opt/zc/lib/zope3"
  instance="/var/zc/appserver"
  transylvania="/opt/zc/lib/frankenzope"  # contains Interface!
  # N.B.:  $instance/lib/python contains a symlink to $transylvania
  PYTHONPATH="$instance/lib/python:$zodb3_home:$zope_home:zope3_home"
  export PYTHONPATH
  config_file="/opt/zc/etc/zope.conf"
  zope_run="$zope_home/Zope/Startup/run.py"
  exec "$python" "$zope_run" -C "$config_file" "$@"

Note that I abandoned earlier versions which just tried to force 
$transylvania into the head of $PYTHONPATH.  I don't recall now *why* 
that didn't work;  it could have been unrelated pilot error.  I can 
verify that with this setup, the shambling hulk *does* arise from the 
charging table.

Tres.
--
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  "Zope Dealers"   http://www.zope.com
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: Interfaces in Zope 2.5, 2.7, and 3.x

2004-03-04 Thread Martijn Faassen
Jim Fulton wrote:

Martijn's suggestion was to use an alternate name for the 
"__implements__" attribute.  I suppost I could do that -- call mine
 "__narya_interfaces__", but that sounds ugly.  In particular, I
don't really want my interfaces module to actually *conflict* with
Zope's.


As I mentioned on the zope3-dev list, you want to use the facade
Interface from (Packages3/Interface) in Zope 2.7. This is a bit of a
pain to set up. The facade will be a standard part of Zope 2.8.
As a note so Terry also sees; I couldn't get this to work.

Setting it up using the zope.conf 'path' setting in Zope 2.7 to include 
this on the Python path fails, as Zope actually imports the old (non 
facade) interface package before it gets to do configuration. This means 
the facade never is imported, as the next imports will re-use the cached 
  initial import.

So I moved on to removing Zope 2's Interface package and replacing it 
with the facade Interface. For some reason I couldn't get this to start 
either. Perhaps I was fiddling with the paths wrong, but I couldn't get 
Zope 2.7 to start.

I've since gone back to my own hack using a different __implements__ 
attribute. Since Zope 3 interfaces use the 'implements()' directive 
anyway, this hack only breaks backwards compatibility to Z3 interfaces 
that *do* use __implements__ (this is deprecated however), and could 
break ZODB portability in case of persistent interfaces (there are 
currently pretty uncommon and I don't need them at the moment).

Perhaps Terry did get this to work; if so I'm curious to find out how.

Regards,

Martijn

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )