[Zope-dev] ExternalEditor losing its lock?

2003-02-04 Thread Jean Jordaan
Hi all

A couple of times now, I've noticed this:

 - I open a Python Script using ExternalEditor. A GET is issued,
   My editor starts up, and a LOCK gets set.

 - Now I view and execute the script (more GETs) while editing
   and saving in my editor (PUTs get issued).

 - That's fine. But then the lock goes away, and I successfully
   edit the script in the ZMI: a POST goes thru. But there hasn't
   been any UNLOCK yet. This shouldn't happen, right?

(Zope 2.5.1 (source release, python 2.1, linux2), python 2.1.3, linux2)

Excerpt from Z2.log:

192.168.1.5 - jean [03/Feb/2003:18:25:38 +0200] GET /externalEdit_/test 
HTTP/1.1 200 1088 http://blommie:17081/manage_main; Mozilla/5.0 (X11; 
U; Linux i686; en-US; rv:1.1) Gecko/20021212
192.168.1.5 - jean [03/Feb/2003:18:25:40 +0200] LOCK /test HTTP/1.1 
200 789  Zope External Editor/0.6
192.168.1.5 - jean [03/Feb/2003:18:25:56 +0200] PUT /test HTTP/1.1 204 
251  Zope External Editor/0.6
192.168.1.5 - jean [03/Feb/2003:18:25:58 +0200] GET 
/test/manage_workspace HTTP/1.1 302 467 
http://blommie:17081/manage_main; Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.1) Gecko/20021212
192.168.1.5 - jean [04/Feb/2003:10:32:25 +0200] PUT /test HTTP/1.1 204 
251  Zope External Editor/0.6
192.168.1.5 - jean [04/Feb/2003:10:46:11 +0200] POST /test HTTP/1.1 
200 12877 http://blommie:17081/test/ZPythonScriptHTML_editForm; 
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021212
192.168.1.5 - jean [04/Feb/2003:10:46:11 +0200] GET 
/manage_page_style.css HTTP/1.1 200 3014 http://blommie:17081/test; 
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021212
192.168.1.5 - jean [04/Feb/2003:10:46:16 +0200] PUT /test HTTP/1.1 204 
251  Zope External Editor/0.6
192.168.1.5 - jean [04/Feb/2003:10:46:18 +0200] GET 
/test/manage_workspace HTTP/1.1 302 467 http://blommie:17081/test; 
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021212

--
Jean Jordaan
http://www.upfrontsystems.co.za


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


Re: [Zope-dev] ExternalEditor losing its lock?

2003-02-04 Thread Casey Duncan
Hmmm, I think this may be due to a typo in the helper app code. Try applying 
the attached diff to zopeedit.py and see if it helps.

-Casey

On Tuesday 04 February 2003 03:58 am, Jean Jordaan wrote:
 Hi all
 
 A couple of times now, I've noticed this:
 
   - I open a Python Script using ExternalEditor. A GET is issued,
 My editor starts up, and a LOCK gets set.
 
   - Now I view and execute the script (more GETs) while editing
 and saving in my editor (PUTs get issued).
 
   - That's fine. But then the lock goes away, and I successfully
 edit the script in the ZMI: a POST goes thru. But there hasn't
 been any UNLOCK yet. This shouldn't happen, right?
 
 (Zope 2.5.1 (source release, python 2.1, linux2), python 2.1.3, linux2)
 
 Excerpt from Z2.log:
 
 192.168.1.5 - jean [03/Feb/2003:18:25:38 +0200] GET /externalEdit_/test 
 HTTP/1.1 200 1088 http://blommie:17081/manage_main; Mozilla/5.0 (X11; 
 U; Linux i686; en-US; rv:1.1) Gecko/20021212
 192.168.1.5 - jean [03/Feb/2003:18:25:40 +0200] LOCK /test HTTP/1.1 
 200 789  Zope External Editor/0.6
 192.168.1.5 - jean [03/Feb/2003:18:25:56 +0200] PUT /test HTTP/1.1 204 
 251  Zope External Editor/0.6
 192.168.1.5 - jean [03/Feb/2003:18:25:58 +0200] GET 
 /test/manage_workspace HTTP/1.1 302 467 
 http://blommie:17081/manage_main; Mozilla/5.0 (X11; U; Linux i686; 
 en-US; rv:1.1) Gecko/20021212
 192.168.1.5 - jean [04/Feb/2003:10:32:25 +0200] PUT /test HTTP/1.1 204 
 251  Zope External Editor/0.6
 192.168.1.5 - jean [04/Feb/2003:10:46:11 +0200] POST /test HTTP/1.1 
 200 12877 http://blommie:17081/test/ZPythonScriptHTML_editForm; 
 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021212
 192.168.1.5 - jean [04/Feb/2003:10:46:11 +0200] GET 
 /manage_page_style.css HTTP/1.1 200 3014 http://blommie:17081/test; 
 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021212
 192.168.1.5 - jean [04/Feb/2003:10:46:16 +0200] PUT /test HTTP/1.1 204 
 251  Zope External Editor/0.6
 192.168.1.5 - jean [04/Feb/2003:10:46:18 +0200] GET 
 /test/manage_workspace HTTP/1.1 302 467 http://blommie:17081/test; 
 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021212
 
 -- 
 Jean Jordaan
 http://www.upfrontsystems.co.za
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope )
 

*** zopeedit.py.old	Tue Feb  4 09:06:48 2003
--- zopeedit.py	Tue Feb  4 09:07:14 2003
***
*** 415,421 
  return 0 # Already have a lock token
  
  headers = {'Content-Type':'text/xml; charset=utf-8',
!'Timeout':'infinite',
 'Depth':'infinity',
}
  body = ('?xml version=1.0 encoding=utf-8?\n'
--- 415,421 
  return 0 # Already have a lock token
  
  headers = {'Content-Type':'text/xml; charset=utf-8',
!'Timeout':'infinity',
 'Depth':'infinity',
}
  body = ('?xml version=1.0 encoding=utf-8?\n'



[Zope-dev] Testing a value returned from a Zope Python Script

2003-02-04 Thread Asad Habib
Hello. I am trying to test a value returned from a
Python script using the following syntax:

dtml-if expr=dtml-call
expr=checkRowLength(fileObject_index, rowLength) ==
0
/dtml-if

checkRowLength is the name of the script. Apparently
Zope flags me with an error saying that this is an
invalid attribute tag for a dtml-if. Is there any
other way of achieving this? Any help would be
appreciated. 

-Asad

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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



Re: [Zope-dev] Why is it _setObject(), and why is it undocumented

2003-02-04 Thread Dieter Maurer
Leonardo Rochael Almeida wrote at 2003-2-3 18:42 -0200:
  ...
  Let's not confuse this with TTW public methods. _setObject should
  obviously not be made TTW accessible (let alone TTW public :-), but it
  should be a public method, that is, have a sensible name and be
  specified in an eventual IObjectManager interface
I think an additional reason for the _ in the name of
_setObject is to prevent acquisition.

With acquisition, you may not set the object where you think you will.


Dieter

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



[Zope-dev] Creating a variable in a DTML method that may be modified

2003-02-04 Thread Asad Habib
Hello. Does anyone know how to create a variable in a
DTML method which may be updated by a Python script? I
am currently using the set method of the REQUEST
object to create a variable. However, creating a
variable in this fashion renders it permanent. Any
help would be appreciated. Thanks.

-Asad

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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



Re: [Zope-dev] Creating a variable in a DTML method that may be modified

2003-02-04 Thread Jeff Rush
Other than explictly passing arguments, the shareable namespace, _, is 
the logical place to exchange such variables btw DTML and 
Script(Python).  However, the namespace object, a TemplateDict, only 
allows you to PUSH/POP spaces, not set/change variables, so you have to 
find or provide something in the namespace that is mutable.  You found 
REQUEST, and there is also SESSION.  And you can provide your own 
mutable namespace as a dictionary:

- cut here - DTML Method
dtml-let myvars={ 'somevar': 5 } !-- Create My Own Namespace --
  dtml-with myvars mapping !-- and Push onto the Search Stack --

Before: dtml-var somevar
dtml-call mypython
After: dtml-var somevar

  /dtml-with
/dtml-let

- cut here - Script(Python) Method
## Script (Python) mypython
##bind container=container
##bind context=context
##bind namespace=_
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
_['myvars']['somevar'] = 7

When the DTML Method is invoked, this will print:

  Before: 5
  After: 7

When the end of the DTML-WITH is reached, the namespace will be 
popped/discarded, so it won't be permanent, as you wish to avoid.

Hope this helps,

Jeff Rush


Asad Habib wrote:
Hello. Does anyone know how to create a variable in a
DTML method which may be updated by a Python script? I
am currently using the set method of the REQUEST
object to create a variable. However, creating a
variable in this fashion renders it permanent. Any
help would be appreciated. Thanks.



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