[Zope-dev] Strange traceback or Error in the traceback ?

2006-01-16 Thread Godefroid Chapelle

Hi,

While seaching for objects of all types containing some text through the 
ZMI find tab, I got the traceback hereunder. (Zope 2.7.8-final on

windows)

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 Shared.DC.Scripts.Bindings, line 306, in __call__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module App.special_dtml, line 175, in _exec
  Module DocumentTemplate.DT_With, line 61, in render
  Module DocumentTemplate.DT_Util, line 198, in eval
   - __traceback_info__: _
  Module string, line 0, in ?
  Module OFS.FindSupport, line 151, in ZopeFind
  Module OFS.FindSupport, line 151, in ZopeFind
  Module OFS.FindSupport, line 113, in ZopeFind
  Module OFS.Image, line 425, in PrincipiaSearchSource
AttributeError: content_typestartswith

I went to the code and found the following :

def PrincipiaSearchSource(self):
 Allow file objects to be searched.

if self.content_type.startswith('text/'):
return str(self.data)
return ''

IOW, the traceback is really strange.

Anybody with a clue ?

--
Godefroid Chapelle (aka __gotcha)http://bubblenet.be

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Strange traceback or Error in the traceback ?

2006-01-16 Thread Leonardo Rochael Almeida
Hi,

Em Seg, 2006-01-16 às 16:20 +0100, Godefroid Chapelle escreveu:
 Hi,
 
 While seaching for objects of all types containing some text through the 
 ZMI find tab, I got the traceback hereunder. (Zope 2.7.8-final on
 windows)
 
 Traceback (innermost last):
[...]
Module OFS.Image, line 425, in PrincipiaSearchSource
 AttributeError: content_typestartswith
 
 I went to the code and found the following :
 
 [...]
  if self.content_type.startswith('text/'):
 [...]
 
 IOW, the traceback is really strange.
 
 Anybody with a clue ?

I've seen this happen a few times before. In your case, content_type is
probably a standard python function (or method). When an unknown
attribute is looked up in a std python function like that, somehow you
get an AttributeError with the name of the function and the looked up
attribute concatenated, instead of separated by a dot (or more commonly,
instead of the attribute name alone).

Don't know if this is a bad interaction between
ExtensionClass/AttributeError and python, or a python bug.

Cheers, Leo


___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )