Re: [Zope-dev] How to trigger Zope externally (mail)

2003-02-27 Thread Jean Jordaan
I can't remember where I cribbed from ;]
Remembered:
  http://www.zope.org/Members/phd/cron-zope/pack-db_fs/view
--
Jean Jordaan
http://www.upfrontsystems.co.za
___
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] Session Event Listeners

2003-02-27 Thread Chris Withers
Beef a wrote:
Does anyone have any idea how to register session event listeners in 
Zope 2?
Chris McDonough is tha man when it comes to this. It's probably all documented 
in the online Zope Book by now, or in the Zope distribution somewhere. In any 
case, he'll be able to tell you wehre to find it...

cheers,

Chris

___
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] Index errors revisited: KeywordIndex unindex_object could not removedocumentId -883140122 from index ComponentVersions. This should not happen.

2003-02-27 Thread Jean Jordaan
Hi all

We've posted about this before, but never managed to pin down
the issue nicely. It doesn't interfere with our application,
as far as we could tell, so we've let it slide. Here's another
attempt at formulating the problem.
We run a script which iterates over 719 ZClass License instances.
For each instance, either one or two ZClass Reminder instances
are created and edited. The script completes, logging all the way:
2003-02-27T09:43:44 INFO(0) MyDebugLog
recreate_reminders INFO: creating reminders for License_99
Then, Zope starts spitting out 657 errors like the following:

2003-02-27T09:43:49 ERROR(200) KeywordIndex unindex_object could not 
remove documentId -883140119 from index ComponentVersions.  This should 
not happen.
Traceback (innermost last):
  File 
/usr/local/zope/2-5-1/lib/python/Products/PluginIndexes/common/UnIndex.py, 
line 168, in removeForwardIndexEntry
(Object: ComponentVersions)
KeyError: -883140119

Most of these errors are identical. There are 172 unique errors,
the rest are all retries. The 172 keys are not in the catalog.
The only indexes involved are ComponentVersions and NodeNames,
both 'lines' properties of ZClass Reminder.
Does anyone know how to cause this, so that I can stop doing it?
I'm trying to narrow it down again ..
 (Zope 2.5.1 (source release, python 2.1, linux2), python 2.1.3, linux2)

--
Jean Jordaan
http://www.upfrontsystems.co.za
___
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] ZPublisher XMLRPC extension for user exceptions

2003-02-27 Thread Illarramendi Amilibia, Aitor



Hello 
everybody:

 
I'm making some kind of development related to invoke externally from a Java 
Applet some ZOPE product methods via XML-RPC.

 I 
use ZOPE as the XMLRPC server, as it can 'listen' for XMLRPC requests, find the 
method requested using URL and traversal, invoke the method and receive the 
return value of it and then encapsulate the result in a XMLRPC 
response.

 
Anyways, I want to report some exceptions from my ZOPE product python methods 
through XML-RPC to the applet. As my methods don't work directly with XMLRPC, 
all is embedded inside ZOPE, all the XMLRPC works are transparent for my python 
methods, soI didn't realize howI could do it.

 
After looking for the ZOPE code responsible of the XMLRPC request process and 
XMLRPC response generation I found that some of the work was being done in 
ZPublisher xmlrpc.py code (Response stuff).

 
Then whenI started to read the comments of the code I found this in the 
Response class of the code:

 
""" It's probably possible to improve the 'exception' method quite a bit. The 
current implementation, however, should suffice for now. """

 
But as you will see is not enough, at least for my needs.

 I 
want to define my own exceptions in my product, this exceptions could be defined 
as follows:

 class 
MyOwnException:
 
__init__(self, faultCode, faultString):
 
self.faultCode = faultCode
 
self.faultString = faultString

 Obviously I 
want to map XMLRPC-like fault format.

 Then, I 
could raise this exception from my method, and I will want that the class 
responsible of making the XMLRPC Response for my XMLRPC client will use it for 
composing the XML for XMLRPC using my fault code and fault 
string.

 But I found 
that xmlrpc.py doesn't take into account that (i'm talking of ZOPE 2.6.0) so i 
had to make some changes in the code of 
ZPublisher/xmlrpc.py:

 
def exception(self, fatal=0, 
info=None, 
absuri_match=None, 
tag_search=None):# 
Fetch our exception info. t is type, v is value and tb is 
the 
# traceback 
object. 
if type(info) is type(()) and len(info)==3: t,v,tb = 
info 
else: 
t,v,tb = 
sys.exc_info()# 
Don't mask 404 respnses, as some XML-RPC libraries rely on the 
HTTP 
# mechanisms for detecting when authentication is required. Fixes 
Zope 
# Collector issue 
525. 
if t == 'Unauthorized' or (isinstance(t, 
types.ClassType) 
and issubclass(t, 
Unauthorized)): 
return self._real.exception(fatal=fatal, info=info)

# 
Create an appropriate Fault object. Containing error 
information 
Fault=xmlrpclib.Faultf=None 
try: 
# Strip HTML tags from the error 
value 
v = 
str(v) 
remove = [r"[^]*", 
r"[A-Za-z]+;"] 
for pat in 
remove: 
v = re.sub(pat, " ", 
v) 
from Globals import 
DevelopmentMode 
if 
DevelopmentMode: 
from traceback import 
format_exception 
value = '\n' + ''.join(format_exception(t, v, 
tb)) 
else: 
value = '%s - %s' % (t, 
v)## my own extension for catching user exceptions 
START# 
try: 
faultCode = 
getattr(sys.exc_info()[1],'faultCode') 
faultString = 
getattr(sys.exc_info()[1],'faultString')except: 
print "noaccording exception 
type"## 
my own extension for catching user exceptionsFINISH 
#
if 
isinstance(v, 
Fault): 
f=v## my own extension for catching user exceptions START 
#elif 
(faultCode and faultString) 
: 
f = 
xmlrpclib.Fault(faultCode,faultString)## 
my own extension for catching user exceptionsFINISH 
## 
elif isinstance(v, 
Exception): 
f=Fault(-1, 'Unexpected Zope exception: %s' % 
value) 
else: 
f=Fault(-2, 'Unexpected Zope error value: %s' % 
value)except:f=Fault(-3, 
"Unknown Zope fault type")

# 
Do the 
damage.self.setBody(f)self._real.setStatus(200)

 
return tb

 By that way, 
I could send my own fault code and fault descriptions via 
XML-RPC.

 But as you 
can see, I have to extend ZOPE code, and I don't want to do it, I have to work 
with standard releases of ZOPE.

 Do you think 
that something like that would be improved in an early future for next ZOPE 
releases?

 Any opinion 
will be really appreciated.

 Thanks for 
advance.

Regards.



  
  

Aitor Illarramendi Amilibia
  


  Ingeniero de software
  Mando y Control 
  

  


  Carretera de Loeches, 928850 - Torrejón de Ardoz, Madrid 
  (ESPAÑA)Tel: +34-91-626.80.60Fax: +34-91-626.81.14
  [EMAIL PROTECTED]www.indra.es

Indra.bmp

Re: [Zope-dev] Index errors revisited: KeywordIndex unindex_object could not remove documentId -883140122 from index ComponentVersions. This should not happen.

2003-02-27 Thread Florent Guillaume
In article [EMAIL PROTECTED] you write:
 We run a script which iterates over 719 ZClass License instances.
 For each instance, either one or two ZClass Reminder instances
 are created and edited. The script completes, logging all the way:
 
 2003-02-27T09:43:44 INFO(0) MyDebugLog
 recreate_reminders INFO: creating reminders for License_99
 
 Then, Zope starts spitting out 657 errors like the following:
 
 2003-02-27T09:43:49 ERROR(200) KeywordIndex unindex_object could not 
 remove documentId -883140119 from index ComponentVersions.  This should 
 not happen.
 Traceback (innermost last):
File 
 /usr/local/zope/2-5-1/lib/python/Products/PluginIndexes/common/UnIndex.py, 
 line 168, in removeForwardIndexEntry
  (Object: ComponentVersions)
 KeyError: -883140119
 
 Most of these errors are identical. There are 172 unique errors,
 the rest are all retries. The 172 keys are not in the catalog.
 The only indexes involved are ComponentVersions and NodeNames,
 both 'lines' properties of ZClass Reminder.
 
 Does anyone know how to cause this, so that I can stop doing it?
 I'm trying to narrow it down again ..
 
   (Zope 2.5.1 (source release, python 2.1, linux2), python 2.1.3, linux2)


It would be interesting to test it with Zope 2.6.1... I'd hate to debug
something that has already been fixed.

To debug it, I'd log a full backtrace by patching UnIndex.py line 168
when the KeyError is raised. But I don't know enough about the catalog
to debug deeper. An invariant is being broken somewhere. Maybe because
of a too-greedy try/except: ?

Which reminds me, there is such a greedy one in manage_beforeDelete, it
could be your culprit.

BTW are you using CMF?

Florent


-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:[EMAIL PROTECTED]

___
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] Index errors revisited: KeywordIndex unindex_object could not removedocumentId -883140122 from index ComponentVersions. This should not happen.

2003-02-27 Thread Dieter Maurer
Jean Jordaan wrote at 2003-2-27 16:45 +0200:
  We've posted about this before, but never managed to pin down
  the issue nicely. It doesn't interfere with our application,
  as far as we could tell, so we've let it slide. Here's another
  attempt at formulating the problem.

The reason is very simple:

  In order to unindex objects later, Zope's indexes remember
  the values an object has been indexed by.

  KeywordIndex is a bit stupid about this.
  If the sequence contains duplicates, it does not remove
  them.
  Later, when the object is unindexed, it tries to remove
  the object from the list for each term in the sequence.
  In case of a duplicate, this goes well when it is
  encountered for the first time but, when it is encountered
  again, the object can (of course) not be removed...

The fix: fix KeywordIndex such that is removes duplicates
  from _unindex[documentId].


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] Index errors revisited: KeywordIndex unindex_objectcould not remove documentId -883140122 from index ComponentVersions. Thisshould not happen.

2003-02-27 Thread Jean Jordaan
Dieter:
The reason is very simple:
Indeed! You make it clear as day :)

The fix: fix KeywordIndex such that is removes duplicates
  from _unindex[documentId].
We're looking to see if we can fix it for us ..

--
Jean Jordaan
http://www.upfrontsystems.co.za
___
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] Index errors revisited: KeywordIndex unindex_objectcould not remove documentId -883140122 from index ComponentVersions. Thisshould not happen.

2003-02-27 Thread Chris Withers
Jean Jordaan wrote:
Dieter:

The reason is very simple:
Indeed! You make it clear as day :)

The fix: fix KeywordIndex such that is removes duplicates
  from _unindex[documentId].
We're looking to see if we can fix it for us ..
Is this fixed in 2.6.x?

If not, please file a collector issue when you have a patch and I'll make sure 
it's applied on the 2.6 branch as well as the HEAD.

cheers,

Chris

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