[Zope3-Users] readline() takes exactly 1 argument

2006-12-18 Thread George Wright


Trying to get started on Zope3 but frustrated by a couple of barriers:

Barrier 1.
 Added a folder. Added a ZPT Page (As in Zope3 Developer's Book page  
12).

Then get system error message:
Traceback (most recent call last):
  Module zope.publisher.publish, line 126, in publish
request.processInputs()
  Module zope.publisher.browser, line 263, in processInputs
fs = FieldStorage(fp=fp, environ=self._environ,  
keep_blank_values=1)

  Module cgi, line 530, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
  Module cgi, line 650, in read_multi
environ, keep_blank_values, strict_parsing)
  Module cgi, line 532, in __init__
self.read_single()
  Module cgi, line 665, in read_single
self.read_lines()
  Module cgi, line 687, in read_lines
self.read_lines_to_outerboundary()
  Module cgi, line 715, in read_lines_to_outerboundary
line = self.fp.readline(116)
TypeError: readline() takes exactly 1 argument (2 given)

I did a search of archives and found references to a patch of http.py  
and tales of success in solving the same problem:


Yes. Apply this patch to the zope3-sources:

/http.py
--- src/zope/publisher/http.py.old 2006-10-04 15:11:04.0 +0200
+++ src/zope/publisher/http.py  2006-10-04 15:11:04.0 +0200
@@ -205,7 +205,7 @@
 return data

 def readline(self,size=None):
-data = self.stream.readline(size)
+data = self.stream.readline()
 self.cacheStream.write(data)
 return data

BUT I'm not sure what to do with it!  What do the little - and + in  
front of the data =  lines mean?  And the @@ -205,7 +205,7 @@ ?


Just which http.py is to be patched?
~/Zope-3.3.0/build/lib.macosx-10.3-fat-2.4/zope/publisher/http.py
OR
~/Zope-3.3.0/build/lib.darwin-8.8.0-Power_Macintosh-2.4/zope/ 
publisher/http.py

OR ?

Maybe this problem has been fixed in a later version?

Barrier 2:
Should I be able to call zope from within terminal?
I can get interface ( probably because it is part of my twisted  
installation which is OK)

But I can't get other zope stuff.

george-g5:~ georgewright$ python
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type help, copyright, credits or license for more information.
 from zope import interface
 from zope import schema
Traceback (most recent call last):
  File stdin, line 1, in ?
ImportError: cannot import name schema
 from zope import component
Traceback (most recent call last):
  File stdin, line 1, in ?
ImportError: cannot import name component


Seems like there is a $PATH problem or $PYTHONPATH?

Lots of other questions of course but maybe I will answer them for  
myself if I can get over these barriers!


Thanks

George Wright
http://users.bigpond.net.au/George.Wright/
http://www.labyrinth.net.au/~gwright



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] readline() takes exactly 1 argument

2006-12-18 Thread Tom Dossis
George Wright wrote:
 Apply this patch to the zope3-sources:
 
 /http.py
 --- src/zope/publisher/http.py.old 2006-10-04 15:11:04.0 +0200
 +++ src/zope/publisher/http.py  2006-10-04 15:11:04.0 +0200
 @@ -205,7 +205,7 @@
  return data
 
  def readline(self,size=None):
 -data = self.stream.readline(size)
 +data = self.stream.readline()
  self.cacheStream.write(data)
  return data
 
 BUT I'm not sure what to do with it!  What do the little - and + in
 front of the data =  lines mean?  And the @@ -205,7 +205,7 @@ ?

Remove the '-' line, replace it with the '+' line.

 
 Just which http.py is to be patched?
 ~/Zope-3.3.0/build/lib.macosx-10.3-fat-2.4/zope/publisher/http.py
 OR
 ~/Zope-3.3.0/build/lib.darwin-8.8.0-Power_Macintosh-2.4/zope/publisher/http.py
 OR ?

Both if need be - but definitely in your runtime path.

 Should I be able to call zope from within terminal?
 I can get interface ( probably because it is part of my twisted
 installation which is OK)
 But I can't get other zope stuff.

cd to your zope INSTANCE_HOME, then you can invoke the python
interpreter with either of:

  ./bin/zopectl debug
or
  ./bin/debugzope

This will add zope (and $INSTANCE_HOME/lib/python) to your python path
and process all the zcml files.  It will also add 'app' to your python
session...

 app
zope.app.debug.debug.Debugger object at 0xb741010c
 app.root()
zope.app.folder.folder.Folder object at 0xb4fe706c
 list(app.root())
[u'Folder1', u'Folder2']

 from zope import schema
 dir(schema)
['ASCII', 'ASCIILine', 'Bool', 'Bytes', 'BytesLine', 'Choice',
'Container', 'Date', 'Datetime', 'Dict', 'DottedName', 'Field', 'Float',
'FrozenSet', 'Id', 'Int', 'InterfaceField', 'Iterable', 'List',
'MinMaxLen', 'Object', 'Orderable', 'Password', 'Set', 'SourceText',
'Text', 'TextLine', 'Timedelta', 'Tuple', 'URI', 'ValidationError',
'__builtins__', '__doc__', '__file__', '__name__', '__path__',
'_bootstrapfields', '_bootstrapinterfaces', '_field', '_schema',
'accessors', 'fieldproperty', 'getFieldNames', 'getFieldNamesInOrder',
'getFields', 'getFieldsInOrder', 'interfaces', 'vocabulary']


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] readline() takes exactly 1 argument

2006-12-18 Thread Christian Theune
Hi,

George Wright wrote:
 Trying to get started on Zope3 but frustrated by a couple of barriers:
 
 Barrier 1.
   Added a folder. Added a ZPT Page (As in Zope3 Developer's Book page  
 12).
 Then get system error message:
 Traceback (most recent call last):
Module zope.publisher.publish, line 126, in publish
  request.processInputs()
Module zope.publisher.browser, line 263, in processInputs
  fs = FieldStorage(fp=fp, environ=self._environ,  
 keep_blank_values=1)
Module cgi, line 530, in __init__
  self.read_multi(environ, keep_blank_values, strict_parsing)
Module cgi, line 650, in read_multi
  environ, keep_blank_values, strict_parsing)
Module cgi, line 532, in __init__
  self.read_single()
Module cgi, line 665, in read_single
  self.read_lines()
Module cgi, line 687, in read_lines
  self.read_lines_to_outerboundary()
Module cgi, line 715, in read_lines_to_outerboundary
  line = self.fp.readline(116)
 TypeError: readline() takes exactly 1 argument (2 given)

This looks like a known incompatibility with Python 2.4.4. (If you're
interested in the details, see http://www.zope.org/Collectors/Zope3-dev/535)

 I did a search of archives and found references to a patch of http.py  
 and tales of success in solving the same problem:
 
 Yes. Apply this patch to the zope3-sources:
 
 /http.py
 --- src/zope/publisher/http.py.old 2006-10-04 15:11:04.0 +0200
 +++ src/zope/publisher/http.py  2006-10-04 15:11:04.0 +0200
 @@ -205,7 +205,7 @@
   return data
 
   def readline(self,size=None):
 -data = self.stream.readline(size)
 +data = self.stream.readline()
   self.cacheStream.write(data)
   return data

This is a standard patch format and there is a utility that can apply
this patch for you automatically. The patch is made for a checkout and
maybe also works on the source distribution for Zope 3.3

You should be able to store that patch in a file, e.g. called
'patchname.patch' and then run 'patch -p0  patchname.patch' in your
terminal. (I guess MacOS X comes with patch by default.)

Watch out for messages saying Hunk X out of X FAILED though.

Then reinstall your Zope server using make install, that should get your
installation directory updated with the right file.

 BUT I'm not sure what to do with it!  What do the little - and + in  
 front of the data =  lines mean?  And the @@ -205,7 +205,7 @@ ?
 
 Just which http.py is to be patched?
 ~/Zope-3.3.0/build/lib.macosx-10.3-fat-2.4/zope/publisher/http.py
 OR
 ~/Zope-3.3.0/build/lib.darwin-8.8.0-Power_Macintosh-2.4/zope/ 
 publisher/http.py
 OR ?

This looks like you did 'make' in your Zope-3.3.0 directory multiple
times on different versions of your operating system. Or this is an
idiom specific to Python on Mac OS X.

 Maybe this problem has been fixed in a later version?

It's not yet fixed finally, but if you watch the bug that I posted
above, you should be able to

The bugfix release should be available in early Januar 07.

Christian

-- 
gocept gmbh  co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development




signature.asc
Description: OpenPGP digital signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users