[Zope] ZRTChat

Robin Becker robin@jessikat.demon.co.uk
Sun, 12 Dec 1999 03:54:56 +0000


In article <3853EE02.9DC18E26@vt.edu>, Jim Washington <jwashin@vt.edu>
writes
>Hi, Robin
>
>Hmmm...

Brilliant deduction as my mail should reveal. I tried already to guard
bits of the form frame without success. I tried the hack you suggest and
all that does is insert my message document; just a dummy with an OK
button saying this is the message document(no wonder I was confused).

Seems as though this problem is tougher as no matter what you won't be
able to over write my document.

>
>user is a variable that is assigned when you first login.  
>
>The source of the bottom frame when 'Jim' is logged in looks like:
>
><CENTER><TABLE CELLSPACING=0 CELLPADDING=0>
><TR><TD>
><nobr><FORM ACTION="formframe" METHOD="POST">
>Your message: <input name=user type=hidden value="Jim">
><textarea name=message rows=3 cols=50></textarea>
><input type=submit value="Post Message">
></form></nobr>
></TD><TD>
><nobr><FORM ACTION="formframe" METHOD="POST">
><input name=user type=hidden value="">
><input type=submit value="Logoff">
></form></nobr>
></TD></TR>
></TABLE></CENTER>
>
>so user should be there in REQUEST.form, because it is passed in the
>hidden field.
>
>BUT the beginning of formframe only checks to see if there is
>[somewhere!] a non-nil variable called message,  AHA!  
>
>So, Robin, I will bet you have a 'message' on the acquisition path.
>
>If so, the right answer is:
>
>The first part of formframe should read: 
>
><dtml-if message>
>  <dtml-if user>
>    <dtml-call "REQUEST.set('dt',ZopeTime())">
>    <dtml-call "REQUEST.set('id',dt.strftime('%Y%m%d%H%M%S')+user)">
>    <dtml-call "ChatItemClass_add(_.None, _, NoRedir=1)">
>  </dtml-if>
></dtml-if>
>
>since we need both user and message here.
>
>Let me know if this works.  My take-home lesson in this is that I
>definitely should use less popular variable names in an acquisition
>system.
>
>-- Jim Washington
>
>Shall we call this kind of bug "Spanish Acquisition"?  
>It has a Pythonish ring...
>And few of us really expect it...
>
>
>Robin Becker wrote:
>> 
>> In message <38533F75.ECF42C90@vt.edu>, Jim Washington <jwashin@vt.edu> writes
>> >Hi, Robin
>> >
>> >Now I'm really curious about how to fix this.  Could you send me the
>> >full error traceback?
>> >
>> >What version of Zope are you using, OS, etc...
>> >
>> >I don't like the idea of putting out products that don't work for some.
>> >
>> >-- Jim Washington
>> >
>> ...
>> I am using latest CVS Zope on Win32.
>> 
>> I could try and download the latest binary and use that.
>> 
>> I have always been a bit concerned that some 'products' seem to conflict with 
>others. I have
>> quite a few products installed.
>> 
>> This is in the lowest frame.
>> 
>>               Zope Error
>> 
>>                Zope has encountered an error while publishing this resource.
>> 
>>                Error Type: NameError
>>                Error Value: user
>> 
>>                Troubleshooting Suggestions
>> 
>>                     This resource may be trying to reference a nonexistent 
>object or variable
>> user.
>>                     The URL may be incorrect.
>>                     The parameters passed to this resource may be incorrect.
>>                     A resource that this resource relies on may be 
>encountering an error.
>> 
>>                For more detailed information about the error, please refer to 
>the HTML source
>> for this page.
>> 
>>                If the error persists please contact the site maintainer. Thank 
>you for your
>> patience.
>> 
>> Traceback (innermost last):
>>   File C:\Python\devel\Zope\lib\python\ZPublisher\Publish.py, line 214, in 
>publish_module
>>   File C:\Python\devel\Zope\lib\python\ZPublisher\Publish.py, line 179, in 
>publish
>>   File C:\Python\devel\Zope\lib\python\Zope\__init__.py, line 211, in 
>zpublisher_exception_hook
>>     (Object: CatalogAware)
>>   File C:\Python\devel\Zope\lib\python\ZPublisher\Publish.py, line 165, in 
>publish
>>   File C:\Python\devel\Zope\lib\python\ZPublisher\mapply.py, line 160, in 
>mapply
>>     (Object: formframe)
>>   File C:\Python\devel\Zope\lib\python\ZPublisher\Publish.py, line 102, in 
>call_object
>>     (Object: formframe)
>>   File C:\Python\devel\Zope\lib\python\OFS\DTMLMethod.py, line 145, in 
>__call__
>>     (Object: formframe)
>>   File C:\Python\devel\Zope\lib\python\DocumentTemplate\DT_String.py, line 
>502, in __call__
>>     (Object: formframe)
>>   File C:\Python\devel\Zope\lib\python\DocumentTemplate\DT_Util.py, line 335, 
>in eval
>>     (Object: ChatItemClass_add(_.None, _, NoRedir=1))
>>     (Info: ChatItemClass_add)
>>   File <string>, line 0, in ?
>>   File C:\Python\devel\Zope\lib\python\OFS\DTMLMethod.py, line 141, in 
>__call__
>>     (Object: ChatItemClass_add)
>>   File C:\Python\devel\Zope\lib\python\DocumentTemplate\DT_String.py, line 
>502, in __call__
>>     (Object: ChatItemClass_add)
>>   File C:\Python\devel\Zope\lib\python\DocumentTemplate\DT_Util.py, line 335, 
>in eval
>>     (Object: REQUEST.set('id',dt.strftime('%Y%m%d%H%M%S')+'_'+user))
>>     (Info: REQUEST)
>>   File <string>, line 0, in ?
>> NameError: (see above)
>> 
>> --
>> Robin Becker

-- 
Robin Becker