[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/ - in-place migration to unicode

2006-12-23 Thread Andreas Jung
Log message for revision 71644:
  - in-place migration to unicode
  - the ZMI edit view now *always* uses 'utf-8' and no longer uses 
self.output_encoding (which is only relevant for FTP/WebDAV)
  - 'output_encoding' is now a property
  
  

Changed:
  U   Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
  U   Zope/trunk/lib/python/Products/PageTemplates/utils.py
  U   Zope/trunk/lib/python/Products/PageTemplates/www/ptEdit.zpt

-=-
Modified: Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-21 23:46:14 UTC (rev 71643)
+++ Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-23 12:51:16 UTC (rev 71644)
@@ -40,7 +40,7 @@
 from Products.PageTemplates.PageTemplateFile import guess_type
 from Products.PageTemplates.Expressions import SecureModuleImporter
 
-from Products.PageTemplates.utils import encodingFromXMLPreamble, 
charsetFromMetaEquiv
+from Products.PageTemplates.utils import encodingFromXMLPreamble, 
charsetFromMetaEquiv, convertToUnicode
 
 
 preferred_encodings = ['utf-8', 'iso-8859-15']
@@ -70,6 +70,7 @@
 __implements__ = (WriteLockInterface,)
 
 meta_type = 'Page Template'
+output_encoding = 'iso-8859-15'  # provide default for old instances
 
 func_defaults = None
 func_code = FuncCode((), 0)
@@ -90,6 +91,7 @@
 
 _properties=({'id':'title', 'type': 'ustring', 'mode': 'w'},
  {'id':'content_type', 'type':'string', 'mode': 'w'},
+ {'id':'output_encoding', 'type':'string', 'mode': 'w'},
  {'id':'expand', 'type':'boolean', 'mode': 'w'},
  )
 
@@ -183,8 +185,13 @@
 raise ResourceLockedError(File is locked via WebDAV)
 
 self.expand = expand
-self.pt_setTitle(title, self.output_encoding)
 
+# The ZMI edit view uses utf-8! So we can safely assume
+# that 'title' and 'text' are utf-8 encoded strings - hopefully
+
+self.pt_setTitle(title, 'utf-8') 
+text = unicode(text, 'utf-8')
+
 self.pt_edit(text, content_type, True)
 REQUEST.set('text', self.read()) # May not equal 'text'!
 REQUEST.set('title', self.title)
@@ -194,6 +201,7 @@
% 'br'.join(self._v_warnings))
 return self.pt_editForm(manage_tabs_message=message)
 
+
 security.declareProtected(change_page_templates, 'pt_setTitle')
 def pt_setTitle(self, title, encoding='utf-8'):
 if not isinstance(title, unicode):
@@ -394,6 +402,17 @@
 # acquisition context, so we don't know where it is. :-(
 return None
 
+
+def __setstate__(self, state):
+# Perform on-the-fly migration to unicode.
+# Perhaps it might be work with the 'generation' module here?
+if not isinstance(state['_text'], unicode):
+text, encoding = convertToUnicode(state['_text'], 
state['content_type'])
+state['_text'] = text
+state['output_encoding'] = encoding
+self.__dict__.update(state) 
+
+
 def pt_render(self, source=False, extra_context={}):
 result = PageTemplate.pt_render(self, source, extra_context)
 assert isinstance(result, unicode)

Modified: Zope/trunk/lib/python/Products/PageTemplates/utils.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/utils.py   2006-12-21 
23:46:14 UTC (rev 71643)
+++ Zope/trunk/lib/python/Products/PageTemplates/utils.py   2006-12-23 
12:51:16 UTC (rev 71644)
@@ -56,4 +56,34 @@
 
 return None
 
+  
 
+def convertToUnicode(source, content_type):
+ Convert 'source' to unicode.
+Returns (unicode_str, source_encoding).
+
+
+if content_type.startswith('text/xml'):
+encoding = encodingFromXMLPreamble(source)
+return unicode(source, encoding), encoding  
+
+elif content_type.startswith('text/html'):
+
+encoding = charsetFromMetaEquiv(source)
+
+# Try to detect the encoding by converting it unicode without raising
+# exceptions. There are some smarter Python-based sniffer methods
+# available however we have to check their licenses first before
+# including them into the Zope 2 core
+
+if not encoding:
+for enc in ('utf-8', 'iso-8859-15'):
+try:
+return unicode(source, enc), enc
+except UnicodeDecodeError:
+continue
+
+raise TypeError('Could not auto-detect encoding')
+
+else:
+raise ValueError('Unsupported content-type: %s' % content_type) 

Modified: Zope/trunk/lib/python/Products/PageTemplates/www/ptEdit.zpt
===
--- 

[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py fix

2006-12-23 Thread Andreas Jung
Log message for revision 71645:
  fix
  

Changed:
  U   Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-23 12:51:16 UTC (rev 71644)
+++ Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-23 13:08:06 UTC (rev 71645)
@@ -337,6 +337,7 @@
 security.declareProtected(change_page_templates, 'PUT')
 def PUT(self, REQUEST, RESPONSE):
  Handle HTTP PUT requests 
+
 self.dav__init(REQUEST, RESPONSE)
 self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
 text = REQUEST.get('BODY', '')
@@ -407,7 +408,7 @@
 # Perform on-the-fly migration to unicode.
 # Perhaps it might be work with the 'generation' module here?
 if not isinstance(state['_text'], unicode):
-text, encoding = convertToUnicode(state['_text'], 
state['content_type'])
+text, encoding = convertToUnicode(state['_text'], 
state.get('content_type', 'text/html'))
 state['_text'] = text
 state['output_encoding'] = encoding
 self.__dict__.update(state) 

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


[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt

2006-12-23 Thread Andreas Jung
Log message for revision 71648:
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2006-12-23 13:38:48 UTC (rev 71647)
+++ Zope/trunk/doc/CHANGES.txt  2006-12-23 13:40:40 UTC (rev 71648)
@@ -44,7 +44,9 @@
 will work only properly for ZPT instances formerly encoded as utf-8 or
 ISO-8859-15. For other encodings you might set the environment variable
 ZPT_REFERRED_ENCODING to insert your preferred encoding in front of 
utf-8 and
-ISO-8859-15 within the encoding sniffer code.
+ISO-8859-15 within the encoding sniffer code. In addition there is a 
new
+'output_encodings' property that controls the conversion from/to 
unicode
+for WebDAV/FTP operations.
 
 
 Bugs Fixed

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


[Zope-dev] Zope Tests: 7 OK

2006-12-23 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Fri Dec 22 12:00:00 2006 UTC to Sat Dec 23 12:00:00 2006 UTC.
There were 7 messages: 7 from Zope Unit Tests.


Tests passed OK
---

Subject: OK : Zope-2.6 Python-2.1.3 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:09:53 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006880.html

Subject: OK : Zope-2.6 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:11:24 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006881.html

Subject: OK : Zope-2.7 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:12:54 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006882.html

Subject: OK : Zope-2.8 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:14:24 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006883.html

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:15:54 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006884.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:17:24 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006885.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Fri Dec 22 21:18:54 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006886.html

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Is there an alternative to zdaemon?

2006-12-23 Thread Jim Fulton

Andreas Jung wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 22. Dezember 2006 15:55:48 -0500 Jim Fulton [EMAIL PROTECTED] wrote:

It has 2 major disadvantages:

- It is ours. :)  We are bearing the burden of maintaining it.
   This is offset by the fact that it hasn't required much maintenance.


..which is actually a sign of it-just-works.


- It is largely undocumented. This makes it much harder to use than it
   needs to be.  It also makes it under appreciated.  I made a start at
   fixing this yesterday:

 http://svn.zope.org/zdaemon/trunk/src/zdaemon/README.txt?view=auto

  It isn't very hard to use, so documenting it isn't really all that hard.


...which is almost True for a lot of parts of the Zope 2 core  :-)



I wonder if we should be using some other daemon manager.  Arguably,
there's
no reason for the Zope project to maintain one if something is available
that does what we need.


I think (meanwhile) that this is not enough to justify the replacement of a 
component. Replacing a Zope 2 component always caused some pain. So as a 
rule for replacing something in the Zope 2 core we consider those rules:


 - the replacement solves  existing functional problems

 - it adds major functional benefits

 - no issues with backward compatibility, well tested etc.

For the Zope 2 core we must be very careful about changing stuff. Stability
and backward compatibility are much, much more important for the end-user 
than satisfying our replace-all-with-something-better drive :-)


Don't get me wrong but we've done some minor mistakes with replacing stuff 
in the past  and because of that I became a bit conservative about changing 
things. Of course I am only speaking for the Zope 2 core.


I feel the same need for conservatism.  These are all good arguments.

A strong counter force is that we seem to have more on our plate than we
can handle.  We either need to get more people helping, or we need to do
less.  Something to keep in mind is that many people who help now actually
want and deserver to be able to do new things too. :)

zdaemon is an interesting case because it is s non-zope and
(mostly) non-python specific.  I must say that it amazes me that there
isn't an established alternative out there.

One point in zdaemon's favor that I forgot about in my original analysis
is that it has a (also undocumented) subclassing API that allows applications
to add new commands.  We certainly leverage this to provide the debug and
run commands.

supervisor2 looks very cool.  But it is also ours in some sense.  It also
is much bigger than zdaemon.  It looks like like something that people will
often choose over zdaemon.  zdaemon is still attractive to me over supervisor2
because it is smaller, less ambitious and I already understand it. :) And, of 
course,
there are the good backward compatibility arguments that you make.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Is there an alternative to zdaemon?

2006-12-23 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 23 Dec 2006, at 14:23, Jim Fulton wrote:

zdaemon is an interesting case because it is s non-zope and
(mostly) non-python specific.  I must say that it amazes me that there
isn't an established alternative out there.


When people start talking about such functionalities I only ever see  
Daemontools mentioned. I never used it, but from your description it  
seems to have some shortcomings.



One point in zdaemon's favor that I forgot about in my original  
analysis
is that it has a (also undocumented) subclassing API that allows  
applications
to add new commands.  We certainly leverage this to provide the  
debug and

run commands.

supervisor2 looks very cool.  But it is also ours in some sense.   
It also
is much bigger than zdaemon.  It looks like like something that  
people will
often choose over zdaemon.  zdaemon is still attractive to me over  
supervisor2
because it is smaller, less ambitious and I already understand  
it. :) And, of course,

there are the good backward compatibility arguments that you make.


So with all that said, what's the use case for switching zdaemon out  
for something else? What other functionalities are *you* looking for?  
I don't think it ever caused anyone any headache apart from maybe  
working around different ways in which forking/daemonizing is handled  
on some platforms (OS X comes to mind).


jens


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

iD8DBQFFjTGMRAx5nvEhZLIRAt3TAKCCeKr94fU3Vp9wkyhYDCOLmZpGpgCdFjau
HeEVqYANXGEMMfmmdbhmvRw=
=jy2/
-END PGP SIGNATURE-
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Is there an alternative to zdaemon?

2006-12-23 Thread Jim Fulton

Jens Vagelpohl wrote:
...
So with all that said, what's the use case for switching zdaemon out for 
something else?


Not owning it. :)

 What other functionalities are *you* looking for?

Ditto.

 I don't think it ever caused anyone any headache apart from maybe working
around different ways in which forking/daemonizing is handled on some 
platforms (OS X comes to mind).


Any software we own is an inherent liability.  Of course, hopefully,
most things we own provide enough benefits to overcome this inherent
liability.

I agree that there may not be alternatives compelling enough to
justify a change.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Is there an alternative to zdaemon?

2006-12-23 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 23 Dec 2006, at 14:53, Jim Fulton wrote:
 I don't think it ever caused anyone any headache apart from maybe  
working
around different ways in which forking/daemonizing is handled on  
some platforms (OS X comes to mind).


Any software we own is an inherent liability.  Of course, hopefully,
most things we own provide enough benefits to overcome this inherent
liability.

I agree that there may not be alternatives compelling enough to
justify a change.


To be honest, I'm coming across many situations where maintenance and  
upgrade issues make me wish the original developers had reinvented a  
couple wheels instead of relying on third party packages. Even if  
they work fine right now you'll have the risk of incompatibilities or  
lack of reaction when it comes to fixing bugs that make your life  
harder down the line.


zdaemon is a little different of course, it's a standalone  
functionality in a way. It's not some Zope product that other  
packages rely on.


jens


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

iD8DBQFFjTzTRAx5nvEhZLIRAlQGAJ9CJkklU/H9cyn+ayTPWQDjm8zOUQCggj9p
zaBUE/Pze8m+cEr2P6ghUxk=
=PLqx
-END PGP SIGNATURE-
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Re: [Zope3-dev] Is there an alternative to zdaemon?

2006-12-23 Thread Dieter Maurer
Jim Fulton wrote at 2006-12-22 15:55 -0500:
 
Thoughts?

We are using zdaemon widely and would be sad to loose it.

The underdocumented argument is unjustified in my view:

  *  zdaemon comes with reasonable online documentation
 (the help command)

  *  like for all zconfig based programs, essential documentation
 can be found in the schema file.

 As the configuration options have been carefully documented
 (also quite common for zconfig based programs), this
 is sufficient documentation for the configuration.

  *  There are other forms of documentation than testable documentation
 (aka doctests).



-- 
Dieter
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] problem with the shapelib module.. help

2006-12-23 Thread Dieter Maurer
Please stay on the mailing list. Readded ...

Allen Huang wrote at 2006-12-22 19:47 -0800:
 ...
is there something wrong with how I constructed it?

It is still something wrong with the way you report problems.
See below in my quoted message from yesterday.

And be aware that we might get a bit angry when you do not read
our messages carefully.

 
- Original Message 
From: Dieter Maurer [EMAIL PROTECTED]
To: Allen Huang [EMAIL PROTECTED]
Cc: Zope zope@zope.org
Sent: Saturday, December 23, 2006 3:52:53 AM
Subject: Re: [Zope] problem with the shapelib module.. help
 
Another tip for the future. When you report problems, you need
to include full error information. Beside the Error Type and
Error Value above, this also includes the traceback.
You find all this information in the error_log object in
Zope's Root Folder (Management Interface).



-- 
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 )


[Zope] zope sql_delimiter windows

2006-12-23 Thread garry saddington
I have a Zope application that runs perfectly on Linux. However, my
target audience is likely to use Windows so I am trying to port my app.
to that platform.
Whenever I use a multiple insert Zsql method that includes
sql_delimiter, python.exe crashes.

eg.
dtml-in att
dtml-var sql_delimiter
dtml-if absent
insert into attendance (absent,timeperiod,studentid )
values
(
dtml-sqlvar absent type=string,
dtml-sqlvar timeperiod type=string,
dtml-sqlvar studentid type=int
)
/dtml-if
/dtml-in

The above ZSQL method works on Linux any Zope version but causes the
crash on Windows, Zope versions - 2.8, 2.9, 2.10 have been tested and
all fail, is there an issue with this?
Regards
Garry


___
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] zope sql_delimiter windows

2006-12-23 Thread Jaroslav Lukesh

Does run your multiple INSERT queries at Database Adapter Test tab?

JL.

- Original Message - 
From: garry saddington [EMAIL PROTECTED]




I have a Zope application that runs perfectly on Linux. However, my
target audience is likely to use Windows so I am trying to port my app.
to that platform.
Whenever I use a multiple insert Zsql method that includes
sql_delimiter, python.exe crashes.


___
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 )


Fw: [Zope] problem with the shapelib module.. help

2006-12-23 Thread Allen Huang
shapelib still didn't work for me.. help
 
I've being trying different things for the pass day
 
1. I put the shapefile directly in the Extensions with the external method and 
it work fine
import shapelib, dbflib
def readshp():
shp = shapelib.ShapeFile('taiwan1.shp')
return shp.info()

   and in zope
dtml-var expr=readshp()
 
2. but when I save the shapefiles (taiwan1.shp, taiwan1.shx, taiwan1.dbf) into 
zope and call it using dtml it return the same error message. 
import shapelib, dbflib
def readshp(filename):
shp = shapelib.ShapeFile(filename)
return shp.info()

and in zope
dtml-var expr=readshp(taiwan1.shp)
or
dtml-var expr=readshp('http://localhost/pytest/taiwan1.shp')


The error message are

1. in Run Zope in Console
Exception exceptions.AttributeError:ShapeFile instance has no 
attribute 'thisown' in ignored
 
2. in web browser
Site Error
An error was encountered while publishing this resource. 
Error Type: IOError
Error Value: new_ShapeFile failed

 
is there something wrong with how I constructed it? Do I need to do something 
before hand?

3. in error_log
Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module OFS.DTMLMethod, line 143, in __call__
   - DTMLMethod at /testPython/test
   - URL: http://localhost/testPython/test/manage_main
   - Physical Path: /testPython/test
  Module DocumentTemplate.DT_String, line 476, in __call__
  Module DocumentTemplate.DT_Util, line 196, in eval
   - __traceback_info__: readshp
  Module string, line 1, in expression
  Module Products.ExternalMethod.ExternalMethod, line 231, in __call__
   - __traceback_info__: (('http://localhost/testPython/taiwan1.shp',), {}, 
None)
  Module C:\web\ZopeInstance\Extensions\shapetools.py, line 4, in readshp
  Module shapelib, line 44, in __init__
IOError: new_ShapeFile failed





- Forwarded Message 
From: Dieter Maurer [EMAIL PROTECTED]
To: Allen Huang [EMAIL PROTECTED]
Cc: Zope zope@zope.org
Sent: Saturday, December 23, 2006 3:52:53 AM
Subject: Re: [Zope] problem with the shapelib module.. help


Allen Huang wrote at 2006-12-21 23:23 -0800:
I want to do some mapping application with zope.. but I have run into this 
problem over and over..

in Run Zope in Console
Exception exceptions.AttributeError:ShapeFile instance has no attribute 
'thisown' in ignored

Hmm. I doubt that you have really seen this text. There should be something
in between the in and the ignored. It is *vital* that you
are as precise as possible in your problem reports...


Python emits messages of the kind above in some (rare) situations,
e.g. when exceptions occur in destructors.


The exception above seems to have been raised in such a situation.
The missing thing betwenn in and ignored should tell us which situation
this was.

It tells you that something tries to access the attribute thisown
on a ShapeFile instance but this does not have the attribute.


in web browser
Site Error
An error was encountered while publishing this resource. 
Error Type: IOError
Error Value: new_ShapeFile failed


Another tip for the future. When you report problems, you need
to include full error information. Beside the Error Type and
Error Value above, this also includes the traceback.
You find all this information in the error_log object in
Zope's Root Folder (Management Interface).



-- 
Dieter

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ___
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: Fw: [Zope] problem with the shapelib module.. help

2006-12-23 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 23. Dezember 2006 22:27:29 -0800 Allen Huang [EMAIL PROTECTED] wrote:



 2. but when I save the shapefiles (taiwan1.shp, taiwan1.shx, taiwan1.dbf)
 into zope and call it using dtml it return the same error message.
 import shapelib, dbflib
 def readshp(filename):
 shp = shapelib.ShapeFile(filename)
 return shp.info()

 and in zope
 dtml-var expr=readshp(taiwan1.shp)
 or
 dtml-var expr=readshp('http://localhost/pytest/taiwan1.shp')

No idea what shapelib is doing but reading a file from the locale 
filesystem as it seems to work from an external method is *different* from 
a accessing
content that is stored within the ZODB. I really wonder why you think it 
would work the same way? The hierarchical object storage of Zope looks 
similar to a filesystem but it is not a filesystem and the Python APIs for 
accessing filesystems don't apply. We have no idea what the ShapeFile 
constructors expects as data. If it expects a filename of a file within the 
filesystem then you must obtain the content of your data stored within the 
ZODB, create a temporary file and call the constructor as you did within
your external method. Possibly the constructor accepts the data directly
as *string*..in this case this would make things a bit easier. But it is up 
to *you* to check the Shapelib API and take appropriate action.

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

iD8DBQFFjiKYCJIWIbr9KYwRAk0oAKCSyEo5ykswElgi9jFGWf89NthzmwCfRvEM
nSMyeIu/cK7NpecUlof2BR8=
=B0Mw
-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 )