Re: return str(obj) (SOLVED)

Stefan Palme <[email protected]>
Newsgroups gmane.comp.web.zope.german
Organization Invisible Brain
Message-ID <[email protected]>
Schuld ist folgender Code in ZPublisher/HTTPResponse.py:

def setBody(self, body, title='', is_error=0,
            bogus_str_search=re.compile(" [a-fA-F0-9]+>$").search,
            ...):
  ...
  l = len(body)
  if ((l < 200) and 
       body[:1] == '<' and 
       body.find('>') == l-1 and
       bogus_str_search(body) is not None):
    self.notFoundError(body[1:-1])


Offensichtlich wird ein zurückzugebender Body auf Strings mit
dem Format "<IRGENDWAS HEX-WERT>" geprüft. Wird ein solcher String
gefunden, wird der NotFound-Error geworfen.

Darum funktionieren 
  '<de>' (da fehlt das Leerzeichen vor dem "Hex-Wert" DE) und 
  '< cdex>' (X ist keine gültige Hex-Ziffer),
während '< de>', '< cdef'> und '<ATFolder at de>' aussehen wie 
oben beschriebenes Format und demzufolge mit NotFound quittiert 
werden. 

Weiß jemand, wie die Suche nach diesen "bogus body strings" 
motiviert ist?

Da wir viel mit AJAX arbeiten, könnte es bei uns durchaus vorkommen,
dass ein HTTP-Response aus einem sehr kurzen String besteht, der
zufällig genau diesem Format entspricht.

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.