[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Fix yet another resTructuredText glitch, and add tests (test backported from

2006-08-02 Thread Tres Seaver
Log message for revision 69341:
  Fix yet another resTructuredText glitch, and add tests (test backported from
  2.9, which was not in fact vulnerable).
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   
Zope/branches/Zope-2_8-branch/lib/python/Products/ZReST/tests/test_ZReST.py
  U   Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/__init__.py
  U   
Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/tests/testReST.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2006-08-02 14:16:04 UTC 
(rev 69340)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt   2006-08-03 02:11:19 UTC 
(rev 69341)
@@ -8,6 +8,9 @@
 
 Bugs fixed
 
+  - Fix yet another resTructuredText glitch, and add tests (test
+backported from 2.9, which was not in fact vulnerable).
+
   - Collector #2157: Expose name of broken class in SystemError raised
 from '__getstate__' of a broken instance.
 

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZReST/tests/test_ZReST.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/Products/ZReST/tests/test_ZReST.py 
2006-08-02 14:16:04 UTC (rev 69340)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/ZReST/tests/test_ZReST.py 
2006-08-03 02:11:19 UTC (rev 69341)
@@ -3,7 +3,13 @@
 $Id$
 
 import unittest
+import tempfile
 
+
+csv_text = bin:x:1:1:bin:/bin:/bin/bash
+daemon:x:2:2:Daemon:/sbin:/bin/bash
+
+
 class TestZReST(unittest.TestCase):
 
 def _getTargetClass(self):
@@ -13,6 +19,11 @@
 def _makeOne(self, id='test', *args, **kw):
 return self._getTargetClass()(id=id, *args, **kw)
 
+def _csvfile(self):
+fn = tempfile.mktemp()
+open(fn, 'w').write(csv_text)
+return fn
+
 def test_empty(self):
 empty = self._makeOne()
 
@@ -59,6 +70,24 @@
 resty.source = '.. raw:: html\n  :url: http://www.zope.org/'
 self.assertRaises(NotImplementedError, resty.render)
 
+def test_csv_table_file_option_raise(self):
+
+resty = self._makeOne()
+csv_file = self._csvfile()
+resty.source = '.. csv-table:: \n  :file: %s' % csv_file
+result = resty.render()
+self.failUnless('daemon' not in result, 
+'csv-table/file directive is not disabled!')
+
+def test_csv_table_url_option_raise(self):
+resty = self._makeOne()
+csv_file = self._csvfile()
+resty.source = '.. csv-table:: \n  :url: file://%s' % csv_file
+result = resty.render()
+self.failUnless('daemon' not in result, 
+'csv-table/url directive is not disabled!')
+
+
 def test_suite():
 suite = unittest.TestSuite()
 suite.addTest(unittest.makeSuite(TestZReST))

Modified: Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/__init__.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/__init__.py   
2006-08-02 14:16:04 UTC (rev 69340)
+++ Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/__init__.py   
2006-08-03 02:11:19 UTC (rev 69341)
@@ -74,7 +74,7 @@
 if language_code:
 settings['language_code'] = language_code
 settings['language_code'] = language_code
-settings['file_insertion_enabled '] = 0
+settings['file_insertion_enabled'] = 0
 settings['raw_enabled'] = 0
 # starting level for H elements:
 settings['initial_header_level'] = initial_header_level + 1

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/tests/testReST.py
===
--- Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/tests/testReST.py 
2006-08-02 14:16:04 UTC (rev 69340)
+++ Zope/branches/Zope-2_8-branch/lib/python/reStructuredText/tests/testReST.py 
2006-08-03 02:11:19 UTC (rev 69341)
@@ -48,6 +48,18 @@
 source = '.. raw:: html\n  :url: http://www.zope.org'
 self.assertRaises(NotImplementedError, HTML, source)
 
+def test_csv_table_file_option_raise(self):
+
+source = '.. csv-table:: \n  :file: inclusion.txt'
+result = HTML(source)
+self.failUnless('directive disabled' in result)
+
+def test_csv_table_url_option_raise(self):
+
+source = '.. csv-table:: \n  :url: http://www.evil.org'
+result = HTML(source)
+self.failUnless('directive disabled' in result)
+
 def test_suite():
 from unittest import TestSuite, makeSuite
 return TestSuite((makeSuite(TestReST),))

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[ZWeb] Small change in zope.org front page to include a decription of Zope 3

2006-08-02 Thread Baiju M

Hi all,
What about adding a description/quotes of Zope 3 and an introductory
sub page (www.zope.org/Zope3) to current site.

I think this is not a big change and doing so will not do any harm.

The description can be below Zope for... and above Zope Training
... sections.

Michael, if no one objects can you incorporate this:

http://zissue.berlios.de/z3/zope-org.html

(Please change the words if required, its taken from codespeak.net repos)

If you make the sub-page a wiki/wiki page, I can add content to there.

Regards,
Baiju M
___
Zope-web maillist  -  Zope-web@zope.org
http://mail.zope.org/mailman/listinfo/zope-web


[Zope] adding product-based objects programmatically

2006-08-02 Thread Kees de Brabander
Hi,
Apparently my knowledge of Zope/Python is still to limited.
I have a product that derives from Folder. When I add this product to a
folder via zmi I want to have it populated with other products to it
programmatically. I tried to do so in the __init__ function. That works with
objects like acl_user folders, but not with products in the products
directory. Can anyone send me in the right direction or at least give a hint
where to look for a solution?

With trial and error I came thus far (stripped down to the basics):

Module QuerySet.py:
from Query import manage_addQuery
class QuerySet(Folder):
def __init__(self, id, title):
self.id = id
self.title = title
self.manage_addUserFolder()
manage_addQuery(self, id, title)

manage_addQuery in Query.py looks like:
def manage_addQuery(dispatcher, id, title, REQUEST=None):

nQ=Query(id,title)
dispatcher.Destination()._setObject(id, nQ)
if REQUEST is not None:
dispatcher.manage_main(dispatcher, REQUEST)

Traceback (innermost last):
  Module ZPublisher.Publish, line 101, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Products.QuerySet.QuerySet, line 80, in manage_addQuerySet
  Module Products.QuerySet.QuerySet, line 107, in __init__
  Module Products.Query.Query, line 80, in manage_addQuery
AttributeError: Destination

zope 2.7.8, win32

tia, cb


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


Re: [Zope] adding product-based objects programmatically

2006-08-02 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 2 Aug 2006, at 06:37, Kees de Brabander wrote:


Hi,
Apparently my knowledge of Zope/Python is still to limited.
I have a product that derives from Folder. When I add this product  
to a

folder via zmi I want to have it populated with other products to it
programmatically. I tried to do so in the __init__ function. That  
works with

objects like acl_user folders, but not with products in the products
directory. Can anyone send me in the right direction or at least  
give a hint

where to look for a solution?


Do not do this in __init__ as you have no acquisition at that point.  
Use manage_afterAdd for that.


jens


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFE0IPZRAx5nvEhZLIRAhR3AJ9dWgX2g9oCnmYGZZ78ifk8JapawACcD7IH
rP10ndkIi7DeBIX26taDPhs=
=m63H
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] FW: TSU license exception

2006-08-02 Thread Kowalski, Piotr



Hi.Im looking for 
informations about TSU for Zope. Does somebody have a license 
exception "TSU" for Zope?

[EMAIL PROTECTED]

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


Re: [Zope] FW: TSU license exception

2006-08-02 Thread Andreas Jung



--On 2. August 2006 13:39:41 +0200 Kowalski, Piotr 
[EMAIL PROTECTED] wrote:



Hi.
Im looking for informations about TSU for Zope.  Does somebody have  a
license exception  TSU for Zope?



TSU?

-aj
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] FW: TSU license exception

2006-08-02 Thread Kowalski, Piotr

 Hi.
 Im looking for informations about TSU for Zope.  Does somebody have  a
 license exception  TSU for Zope?


TSU?

-aj

(TSU) Technology and software unrestricted

This would ease us to export our product signifiicantly - otherwise we´re 
unable to deploy our stuff to a lot of countries.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] FW: TSU license exception

2006-08-02 Thread Andreas Jung



--On 2. August 2006 16:46:43 +0200 Kowalski, Piotr 
[EMAIL PROTECTED] wrote:





Hi.
Im looking for informations about TSU for Zope.  Does somebody have  a
license exception  TSU for Zope?



TSU?

-aj


(TSU) Technology and software unrestricted

This would ease us to export our product signifiicantly - otherwise
we´re unable to deploy our stuff to a lot of countries.


No idea what that means but the Zope Public License is license that allows 
you to do almost everything with Zope you want (easily said). Isn't that 
sufficient...you might contact Zope Corporation for such legal issues.


-aj



pgp38DsT0gVkT.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] FW: TSU license exception

2006-08-02 Thread David H

Andreas Jung wrote:




--On 2. August 2006 16:46:43 +0200 Kowalski, Piotr 
[EMAIL PROTECTED] wrote:





Hi.
Im looking for informations about TSU for Zope.  Does somebody have  a
license exception  TSU for Zope?



TSU?

-aj



(TSU) Technology and software unrestricted

This would ease us to export our product signifiicantly - otherwise
we´re unable to deploy our stuff to a lot of countries.



No idea what that means but the Zope Public License is license that 
allows you to do almost everything with Zope you want (easily said). 
Isn't that sufficient...you might contact Zope Corporation for such 
legal issues.


-aj


Didn't Sun Tsu write the Art of Zope?

:-)

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Get uploaded file size

2006-08-02 Thread AnThu Nguyen

Hi,

I'm trying to get the size of a file uploaded via an HTML form before 
it's written. context.REQUEST.file only accesses the file name, not 
the content. How do I read the contents? Any help will be much appreciated.


TIA,
AnThu
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Get uploaded file size

2006-08-02 Thread Andreas Jung



--On 2. August 2006 10:13:17 -0700 AnThu Nguyen [EMAIL PROTECTED] 
wrote:



Hi,

I'm trying to get the size of a file uploaded via an HTML form before
it's written. context.REQUEST.file only accesses the file name, not the
content. How do I read the contents? Any help will be much appreciated.



Read the data into a string and determine the length of the string.

-aj


--
ZOPYX Ltd.  Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope  Plone development, Consulting


pgp4MHOmysI8f.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] defunct process with os.spawn*

2006-08-02 Thread Alan

Dears,

Now I am facing an annoying problem.

I have an application in Zope which calls a External Method, which
calls a bash script via:

var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh', arg1,arg2)

The idea is to start some programs in background (which will take
hours running) and I need to pass arguments and track its PID for
eventually checking its status. So os.spawnlp seemed the perfect
solution.

However, when my bash script finished, my processes gets defunct
childed to the Zope process. And only restarting Zope to get rid of
such defunct process, an unthinkable solution.

I am running:

Plone 2.1.2,
Zope (Zope 2.8.5-final, python 2.3.5, sunos5),
Python 2.3.5 (#1, Feb 14 2006, 10:51:41) [C],
--
Alan Wilter S. da Silva, D.Sc. - Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] defunct process with os.spawn*

2006-08-02 Thread Jonathan


- Original Message - 
From: Alan [EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, August 02, 2006 1:52 PM
Subject: [Zope] defunct process with os.spawn*



Dears,

Now I am facing an annoying problem.

I have an application in Zope which calls a External Method, which
calls a bash script via:

var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh', arg1,arg2)

The idea is to start some programs in background (which will take
hours running) and I need to pass arguments and track its PID for
eventually checking its status. So os.spawnlp seemed the perfect
solution.

However, when my bash script finished, my processes gets defunct
childed to the Zope process. And only restarting Zope to get rid of
such defunct process, an unthinkable solution.


It sounds like you are generating zombie processes (child processes which 
have completed, but are not handled by the processes that spawned them). Try 
googling:  python reap spawned process



Jonathan


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] defunct process with os.spawn*

2006-08-02 Thread Chris McDonough
You need to call os.waitpid() at some point to clean up finished  
processes.


- C

On Aug 2, 2006, at 1:59 PM, Jonathan wrote:



- Original Message - From: Alan [EMAIL PROTECTED]
To: zope@zope.org
Sent: Wednesday, August 02, 2006 1:52 PM
Subject: [Zope] defunct process with os.spawn*



Dears,

Now I am facing an annoying problem.

I have an application in Zope which calls a External Method, which
calls a bash script via:

var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh',  
arg1,arg2)


The idea is to start some programs in background (which will take
hours running) and I need to pass arguments and track its PID for
eventually checking its status. So os.spawnlp seemed the perfect
solution.

However, when my bash script finished, my processes gets defunct
childed to the Zope process. And only restarting Zope to get rid of
such defunct process, an unthinkable solution.


It sounds like you are generating zombie processes (child processes  
which have completed, but are not handled by the processes that  
spawned them). Try googling:  python reap spawned process



Jonathan


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



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Can't nest dtml-in using prefix ...

2006-08-02 Thread Dieter Maurer
Jesper Steen Steffensen wrote at 2006-7-29 22:30 +0200:
 ...
@ Dieter - thanks for clearing that up. Maybe [sequence]-var-[variable] or
rather outer-var-role will work then.. Will give it a try when I get back
to work.

I am unaware that this will work -- though I may be wrong.

Usually, you would access the variables defined in the outer loop
directly by their name. This will work as though the inner loop
does not introduce a name conflict (which the inner loop will win).
In such a case, I tend to use a dtml-let to define appropriate
(non conflicting) aliases for problematic variable defined by the outer
loop.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] WebServices

2006-08-02 Thread Dieter Maurer
Alberto Jesus La Rosa Agramonte wrote at 2006-7-30 12:26 -0400:
 ...
I have a question about how I can implement WebServices in Zope..

Have a look at ZSI and/or soappy.

They directly support SOAP (client) access from within your
Zope applications to SOAP services.

Making Zope a SOAP server is a bit more difficult.
Again, the libraries above can help you with it.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How can i improve performance of website under heavy load in Zope2.6.1

2006-08-02 Thread Dieter Maurer
Sudesh Soni wrote at 2006-7-31 12:43 +0530:
I wonder why Zope is default set for handling 4 threads and 7 database 
connections.

Because these values are in general not too bad.

I tried inreasing threads to 20 and database connections to 30 by updating 
z2.py and DB.py, presuming that this will help to improve performance under 
heavy load.

Can anyone suggest what impact will be there if i do this , in Zope 2.6.1 

You may drastically increase the RAM requirements of your Zope process:

  Each connection maintains its own (independent) ZODB cache.

  Main memory requirements therefore increases linearly with the
  number of connections.

 ...
Can anyone suggest any other option to improve performance under heavy load in 
Zope 2.6.1

Cache whatever is cachable...



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Get uploaded file size

2006-08-02 Thread AnThu Nguyen




Roberto,

This is perfect - exactly what I needed!

Thanks,
AnThu

Roberto Benitez wrote On 08/02/06 01:50 PM,:

  Try the following:
  
  def PythonScript1(afile=None):
 '''
 read file info
 afile is name of HTML INPUT TAG
 HTML FORM AS FOLLOWS
 FORM ACTION="" METHOD="POST"
enctype="multipart/form-data"
 INPUT TYPE="file" NAME="afile"
 INPUT TYPE="submit" VALUE="OK"
 /FORM
 NOTE: without [enctype] file will be transerred as string
 '''
 afile.seek(0,2) #move to end
 bytes=afile.tell()
 afile.seek(0) #rewind
   #optional--converto to KB/MB
 megs=bytes / 1048576.0
 if megs  1:
 print "%.2f MB" % megs
 k=bytes / 1024.0
 if k  1:
 print "%d K" % k
 print "%d bytes" % bytes
 return printed
 
  
  AnThu Nguyen [EMAIL PROTECTED] wrote:
  Hi,

I'm trying to get the size of a file uploaded via an HTML form before 
it's written. "context.REQUEST.file" only accesses the file name, not 
the content. How do I read the contents? Any help will be much
appreciated.

TIA,
AnThu
___
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
  
  
   
  Do you Yahoo!?
Get on board. You're
invited to try the new Yahoo! Mail Beta.



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