return str(obj)

Stefan Palme <[email protected]>
Newsgroups gmane.comp.web.zope.german
Organization Invisible Brain
Message-ID <[email protected]>
Hallo,

habe folgendes seltsame Phänomen (folderA ist ein ATFolder):

Script(Python):
obj = context.plone_site.folderA
return str(obj)

-->
2009-04-20T11:06:51 ERROR Zope.SiteErrorLog https://citymag2/.../komischer_bug
Traceback (innermost last):
  Module ZPublisher.Publish, line 118, in publish
  Module ZServer.HTTPResponse, line 262, in setBody
  Module ZPublisher.HTTPResponse, line 327, in setBody
  Module ZPublisher.HTTPResponse, line 648, in notFoundError
NotFound:   <h2>Site Error</h2>
  <p>An error was encountered while publishing this resource.
  </p>
  <p><strong>Resource not found</strong></p>

  Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> ATFolder at folderA</p>
  <hr noshade="noshade"/>

  <p>Troubleshooting Suggestions</p>

  <ul>
  <li>The URL may be incorrect.</li>
  <li>The parameters passed to this resource may be incorrect.</li>
  <li>A resource that this resource relies on may be
      encountering an error.</li>
  </ul>

  <p>For more detailed information about the error, please
  refer to the error log.
  </p>

  <p>If the error persists please contact the site maintainer.
  Thank you for your patience.
  </p>



Folgende Variante des Scripts funktioniert jedoch:
obj = context.plone_site.folderA
print str(obj)
return printed

-->
<ATFolder at folderA>


Das "str(obj)" selbst verursacht den Fehler also nicht, aber ich
kann es offensichtlich nicht direkt "return"en.

Es wird noch seltsamer:


obj = context.plone_site.folderA
return '%s' % obj
--> verursacht obigen Fehler


obj = context.plone_site.folderA
return "'%s'" % obj
--> funktioniert (liefert erwartungsgemäß '<ATFolder at folderA>')


Das ganze lässt sich auch nicht mit beliebigen Ordnern nachvollziehen, 
sondern das passiert nur bei einem einzigen ganz bestimmten Ordner
(ATFolder) meiner Plone-Site.

Kann mir jemand nen Tipp gehen wo ich suchen muss? 

Ich wollte mir gerade mal die Standard-Implementierung von __str__()
ansehen (die das <ATFolder at folderA> liefert), habe sie aber nicht
gefunden. Wo muss ich da suchen?

Danke und Grüße
-stefan-



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.