Re: [Zope-dev] connecting server code to the ZODB

2004-11-10 Thread Tim Hicks
Paul Winkler said:

>> Ok, so I could simply drop the Zope.startup() line and things would be
>> fine (and quick), right?
>
> I haven't tried it, but I think doing Zope.app() will try to
> acquire a lock on the database and it is already locked by
> the running Zope (or ZEO). So I don't think you can do that.


Ok, I think I follow that.


>> > I think you should use the existing publisher machinery.
>> > Given an SMTPRequest instance foo, you should be able to
>> > do foo.traverse(path, response) and get back an object.
>> > This monster method is defined in ZPublisher/BaseRequest.py
>>
>>
>> What does using foo.traverse() buy me over simply accessing the ZODB
>> objects 'by hand', as in root = Zope.app()?
>
> Well, for one thing it might actually work ;-)


Good point :-).  The only thing is that I'm not sure that I actually am
able to call foo.traverse() before it gets passed into handle() (see
below) because I don't think that it will be populated with 'PARENTS'
before it's been 'sent to zope'.


> Note, I'm not sure what your code looks like - if you already
> have a reference to any persistent object (as long as it's
> Traversable which basically anything of interest to you would be),
> you can get the root by doing root = someObject.getPhysicalRoot().


Nope, I don't have a reference to a persistent object.  I'm looking at the
code in smtpserver.SMTPServer and trying to figure out what I need to
adjust.  As far as I can tell, the only point in that code at which a
'link' to zope/zodb objects is made is in the following call in
SMTPChannel.process_message:

handle(self.server.module, request, response)

My immediate problem is that I don't understand how the result of this
call gets dealt with.  It just seems to get discarded in the smtpserver
code.  If this is the way to interact with the publisher, how do I get
hold of the return value?

I'm assuming that by adjusting the REQUEST['PATH_INFO'] value before
calling handle(), I can affect which ZODB object/method gets called, but I
want to know the result of this call.

Any ideas?


tim
___
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] XML Export Error and Patch

2004-11-10 Thread Willi Langenberger
Hi!


When i try to export a PluggableAuthService object as XML, (with ZMI
Import/Export or with manage_exportObject?id=acl_users&download=1&toxml=Y)
i get the following exception:

  Error Type: AttributeError
  Error Value: List instance has no attribute 'extend'

  [...]

  Traceback (innermost last):

* Module ZPublisher.Publish, line 101, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 39, in call_object
* Module OFS.ObjectManager, line 504, in manage_exportObject
* Module OFS.XMLExportImport, line 58, in exportXML
* Module OFS.XMLExportImport, line 33, in XMLrecord
* Module Shared.DC.xml.ppml, line 253, in load
* Module pickle, line 872, in load
* Module pickle, line 1209, in load_appends

Seems that the xml export calls the "extend" method of an
Shared.DC.xml.ppml.List object, which isnt implemented.

The following patch (implement "extend" like "append") solves the problem
(for me!):

[EMAIL PROTECTED]:~$ diff -u -U10 
Zope-2.7.2/lib/python/Shared/DC/xml/ppml.py.ori 
Zope-2.7.2/lib/python/Shared/DC/xml/ppml.py
--- Zope-2.7.2/lib/python/Shared/DC/xml/ppml.py.ori 2002-08-14 
23:51:00.0 +0200
+++ Zope-2.7.2/lib/python/Shared/DC/xml/ppml.py 2004-11-10 23:05:55.0 
+0100
@@ -209,20 +209,22 @@
 class Sequence(Collection):
 
 def __init__(self, v=None):
 if not v: v=[]
 self._subs=v
 
 def __len__(self): return len(self._subs)
 
 def append(self, v): self._subs.append(v)
 
+def extend(self, v): self._subs.extend(v)
+
 def value(self, indent):


\wlang{}

-- 
[EMAIL PROTECTED]Fax: +43/1/31336/9207
Zentrum fuer Informatikdienste, Wirtschaftsuniversitaet Wien, Austria
___
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 )


Re: [Zope-dev] Re: exception hiding in _delObject

2004-11-10 Thread Dieter Maurer
Tres Seaver wrote at 2004-11-9 13:28 -0500:
>Florent Guillaume wrote:
> ...
>> In _delObject and manage_beforeDelete there's a try/except that catches 
>> nearly everything (except BeforeDeleteException and the infamous 
>> ConflictError). It then proceeds to log a message, but continues:
>> 
>> try:
>> object.manage_beforeDelete(object, self)
>> except BeforeDeleteException, ob:
>> raise
>> except ConflictError: # Added for CPS
>> raise
>> except:
>> LOG('Zope',ERROR,'manage_beforeDelete() threw',
>> error=sys.exc_info())
>> pass
> ...
>> This is IMO very harmful because it hides any bug in the catalog or the 
>> indexes (especially during unit tests where LOG is ignored). I've been 
>> (again) bitten by it.

And in addition, it can leave the ZODB in an inconsistent state.
As you know, "manage_beforeDelete" is a recursive function.
When the exception occurs, it probably had run for part of the
descendants but not for others.
Almost surely, this will give you further unexpected problems
in the future.

>> I'd like to condition the pass to the fact that the current user is 
>> Manager. Otherwise I'd like it to fail (and reraise). So a Manager will 
>> still be able to delete objects when there's a bug, but not others.
>> 
>> Comments ?

I would be even more strict: do not catch the exception at all.

ZODB inconsistencies are as bad when caused by "Manager" intervention
as when caused by "normal" users.

>-1.  Buggy application code blocking deletes makes for nightmare "throw 
>away your Data.fs" error scenarios.  I am +0 on it if you can arrange 
>for the new behavior to happen only when Zope is running in debug mode.

-1 on deleting the object and leaving inconsistent ZODB state
behind. Better fix the application code and then try again to
delete the object.

-- 
Dieter
___
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 )


Re: [Zope-dev] Re: Zope and Python 2.4

2004-11-10 Thread Jens Vagelpohl
However, having to fork off the main Fedora branch in regard to Python
dependencies (which directly affect Anaconda, up2date, GTK, and most of
the desktop applets) has major implications for how we maintain our 
distro.
As Andreas said, there is no forking involved. You should have a 
separate Python that's used by Zope only, and not by the other 
Python-based tools. It's like the old Zope binary releases - they all 
came with their own Python.

jens
___
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 )


Re: [Zope-dev] Re: Zope and Python 2.4

2004-11-10 Thread Andreas Jung

--On Donnerstag, 11. November 2004 4:30 Uhr +1100 Alan Milligan 
<[EMAIL PROTECTED]> wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
The reason I asked this question is because clients I talk to in the
enterprise space are almost all exclusively RH9/RHEL clients, and many
have major reservations about installing anything non-RH 'approved' as
they feel they have some security assurances using this, and certainly
RH are reasonable sincere with their efforts here.
If ZC say Zope is approved and test with version X of Python, then this
too has some weight in their minds.
The approved versions are known: Python 2.3.3/2.3.4 for Zope 2.7. Other
customer might be running Debian, others Mandrake or whatever.
You can not satisfy everyone. Btw. FC4 is not at the horizon. We are 
currently
having FC3 which ships with Python 2.3.something. And as Jens stated: a
serious Zope installation should run with a self-compiled Python.

However, having to fork off the main Fedora branch in regard to Python
dependencies (which directly affect Anaconda, up2date, GTK, and most of
the desktop applets) has major implications for how we maintain our
distro.
That's nonsense. You can install your own Python version in a dedicated 
location
without getting into conflicts with the a pre-installed Python version. 
Just a question
of a clean system setup (configure --prefix=... is your friend).

So, I ask again, what is the official view on Python 2.4, and if there's
a roadmap as to when it will become blessed.
There is a good chance to support Python 2.4 officially with in Zope 2.8.
Of course you can run it at your own risk. I think there is nothing to be 
added
at this time. Ask back if there is an official Python 2.4 version out.

-aj
___
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: Zope and Python 2.4

2004-11-10 Thread Alan Milligan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
The reason I asked this question is because clients I talk to in the
enterprise space are almost all exclusively RH9/RHEL clients, and many
have major reservations about installing anything non-RH 'approved' as
they feel they have some security assurances using this, and certainly
RH are reasonable sincere with their efforts here.
If ZC say Zope is approved and test with version X of Python, then this
too has some weight in their minds.
We have our own distro and stability within the flux of Zope, Plone and
a large number of enterprise-targeted products is probably the major
sales pitch.
However, having to fork off the main Fedora branch in regard to Python
dependencies (which directly affect Anaconda, up2date, GTK, and most of
the desktop applets) has major implications for how we maintain our distro.
So, I ask again, what is the official view on Python 2.4, and if there's
a roadmap as to when it will become blessed.
Alan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBklA2CfroLk4EZpkRAltZAJ9cCQAMH6HtB2Jo58wZEdoD2t+dlwCgqQUF
tLxEApntyi0zbmyb7BqVWQg=
=BD09
-END PGP SIGNATURE-
___
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 )


Re: [Zope-dev] Zope and Python 2.4

2004-11-10 Thread Jens Vagelpohl
However, RedHat have now released Python 2.4 in the Fedora development
stream and it will ship with FC4.
Does ZC have an official position upon this yet?
Speaking as Zope release manager but not as official of ZC: Python 
2.3.4
will likely be the recommended Python version for Zope 2.7.  I am 
personally
running Zope 2.7.3 with Plone since some weeks under Python 2.4b1 but
I am doing this at my "own risk".  Python 2.4 might be of interest for 
Zope 2.8.
Going for Python 2.4 just because Fedora ships with it is not really 
an argument.
Add to that the fact that it is *not advisable* most of the time to use 
the Python interpreter that comes with the system.

The reasons have been laid out before, like the fact that the 
interpreter is most likely compiled with strange flags, and that 
"updating" a system-level Python with vendor-supplied packages can have 
bad consequences for your Zope install. The vendor-supplied Python is 
(probably) tested with vendor-supplied packages that use it, but 
certainly not with third party software such as Zope is in this case.

jens
___
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 )


Re: [Zope-dev] Zope and Python 2.4

2004-11-10 Thread Andreas Jung

--On Donnerstag, 11. November 2004 0:54 Uhr +1100 Alan Milligan 
<[EMAIL PROTECTED]> wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I followed the thread a week or so ago with great interest, in that
substantially Zope is working with Python 2.4
However, RedHat have now released Python 2.4 in the Fedora development
stream and it will ship with FC4.
Does ZC have an official position upon this yet?
Speaking as Zope release manager but not as official of ZC: Python 2.3.4
will likely be the recommended Python version for Zope 2.7.  I am personally
running Zope 2.7.3 with Plone since some weeks under Python 2.4b1 but
I am doing this at my "own risk".  Python 2.4 might be of interest for Zope 
2.8.
Going for Python 2.4 just because Fedora ships with it is not really an 
argument.

-aj
___
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] Zope and Python 2.4

2004-11-10 Thread Alan Milligan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I followed the thread a week or so ago with great interest, in that
substantially Zope is working with Python 2.4
However, RedHat have now released Python 2.4 in the Fedora development
stream and it will ship with FC4.
Does ZC have an official position upon this yet?
Alan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBkh2XCfroLk4EZpkRAk7ZAKCOEPXWHID+xbF2eO8NO9eHVoaI9wCeO/9s
WOh4ZLgVBDpQy4hYmDm3qsk=
=4QF1
-END PGP SIGNATURE-
___
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 )