>On Fri, 30 Jun 2000, Rik Hoekstra wrote:
>> > The problem is hooking them all together. Passing the query to a
>> > PythonMethod is throwing up the following error:
>> >
>> > Error Type: TypeError
>> > Error Value: argument l: expected read-only character buffer, instance
>> The error means you're trying to split up a string, but the argument is
>> no string, but an instance (a Python Object). In many cases this is
>> caused by an omission of parenthesis, like so
>> called_object instead of called_object()
>OK, that makes sense.
>> in which case the object is referenced instead of called and nothing is
>> returned (of course). I did not find the culprit in your description,
>> though.
>> I do not quite get what part you want to parse. Is it 'SB_B208'?
>> accessing this in python is a bit strange due to the returned value. You
>> get to the 'SB_B208'part in the following way:
>> whateverreturnstheresult(<someargument>)[0][0][0], meaning (in this
>> case):
>I was trying to walk the fine line between providing too much detail and
>enough. Briefly, 'SB_B208' is an example of the type of string I'm trying
>parse. I do a string.split('l', '_') (where 'l' is the argument to the
>string-splitting Python method) and get ['SB', 'B208']. 'SB' is one of the
>two-letter codes that gets lookup up in the Tiny Table and 'B208' is an
>office number. Together, these two strings represent a person's location in
>our LDAP directory.
>I don't understand where the weird tuple in the traceback is coming from.
>> > Here's the code for parseLocation ('l' is the argument):
>> >
>> > x = string.split(l, '_')
>> > return x[0]
>> I may be reading badly, but can you explain what the l is (or is
>> supposed to be)? Is it the tuple in the traceback?
>'l' is passed to the Pyton Method. Examples would be: FH_123, SB_A231,
>DO_111, etc.
>> > (BTW, changing it to x = string.split(`l`, '_') eliminates the error,
>> > nothing is rendered.
>> >
>> > qry_person is an ZLDAP filter method that takes one argument (uid). The
>> > original dtml to display this mess looks like:
>> >
>> > <dtml-call "REQUEST.set('user_id', user_id)">

have you tried (untested of course)

<dtml-call "REQUEST.set('user_id', user_id())"> ?

see my previous explanation.

>> > <dtml-in "qry_person(uid = user_id)"><br>
>> >   <dtml-in "buildingCodes(parseLocation(l))">
>> >     <dtml-var building><br>  # 'building' comes from the Tiny Table
>> >   </dtml-in>
>> > </dtml-in>
>Anyone see where the problem lies?


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to