Submitted by : koegler at: 2004-08-12T09:46:05+00:00 (13 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

(Zope 2.6.1 , python 2.1.3, openbsd3), ZWiki-0-33-0, allow_dtml==True in Wiki root, Proxy via Apache 1.3 mod_rewrite

after upgrading zwiki calling SOMEPAGE/issuetracker gives the following:

  Traceback (innermost last):

      * Module ZPublisher.Publish, line 49, in publish
      * Module ZPublisher.mapply, line 32, in mapply
      * Module ZPublisher.Publish, line 38, in call_object
      * Module Products.ZWiki.UI, line 468, in issuetracker
      * Module App.special_dtml, line 58, in __call__
      * Module DocumentTemplate.DT_String, line 361, in __call__
      * Module DocumentTemplate.DT_Let, line 70, in render
      * Module DocumentTemplate.DT_In, line 620, in renderwob
      * Module DocumentTemplate.DT_Let, line 70, in render
      * Module DocumentTemplate.DT_Util, line 175, in eval
      __traceback_info__: REQUEST
      * Module <string>, line 0, in ?

  TypeError: 'in <string>' requires character as left operand

however, /filterissues or rendering the issues works fine. I didn't find anything suspicious, but I will look deeper into that.


comments:

property change --koegler, Thu, 12 Aug 2004 09:47:01 -0700 reply
Category: general => tracker

(new) --Simon Michael, Thu, 12 Aug 2004 11:34:37 -0700 reply
I would guess it's this line in issuetrackerdtml:

 <dtml-let bold="x_sequence_item in REQUEST.get('status','')">

Perhaps it's a blank line in your issue_statuses property ?

re: (new) -- Thu, 12 Aug 2004 13:05:20 -0700 reply
no blank line, also neither in issue_severities nor in issue_categories. i think i'll flesh out issuetrackerdtml and look what happens

got it (Python 2.3 vs. 2.1) --koegler, Thu, 12 Aug 2004 15:14:41 -0700 reply
it was right before our eyes: "'in ' requires character as left operand"

in Python 2.3 you can write:

  >>> "ab" in "abc"
  True

in Python 2.1:

  >>> "ab" in "abc"
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: 'in <string>' requires character as left operand

the offending lines:

  <dtml-let bold="x_sequence_item in REQUEST.get('status','')">
  [...]
  <dtml-let bold="x_sequence_item in REQUEST.get('category','')">

There are two possible fixes (I don't know which one is proper, because I don't know wether status / category are strings, as in the comparison, or lists, as suggested in line 8/9:

  category="REQUEST.get('category',[])"
  status="REQUEST.get('status',[])"

the defaults here are lists, not strings.

First fix (works for me), string comparison compatible to Python 2.1:

  <dtml-let bold="REQUEST.get('status','').find(x_sequence_item) > -1">

Second fix (I'm not entirely sure why this works, too), list defaults instead of string defaults:

  <dtml-let bold="x_sequence_item in REQUEST.get('status',[])">

BTW: you should be able to write "x_sequence_item" as "x_item", from the Zope Help (dtml-in):

  prefix=string
    Provide versions of the tag variables that start with this prefix instead of "sequence", 
    and that use  underscores () instead of hyphens (-). The prefix must start with a letter 
    and contain only alphanumeric characters and underscores ().

I was a bit puzzled about this "x_sequence_item" because of the "instead" in the docu.

got it (Python 2.3 vs. 2.1) --SimonMichael, Sat, 28 Aug 2004 08:48:42 -0700 reply
Thanks koegler, that makes it clear. A python 2.3-ism. And yet..:

 > python2.1
 Python 2.1.3+ (#1, Feb 25 2004, 08:52:22)
 [GCC 3.3.3 (Debian)] on linux2
 Type "copyright", "credits" or "license" for more information.
 >>> 'a' in 'abc'
 1
 >>> 'a' in ''
 0

So I still don't understand.

got it (Python 2.3 vs. 2.1) --SimonMichael, Sat, 28 Aug 2004 19:47:49 -0700 reply
Ohh.. it only works with a single character. Fixed for 0.34. I didn't know about x_item, cool.

property change --SimonMichael, Sat, 28 Aug 2004 19:48:09 -0700 reply
Status: open => closed