[Zope-Annce] ZODB 3.4 beta 1 released

2005-05-20 Thread Tim Peters
I'm pleased to announce the release of ZODB 3.4 beta 1.  This corresponds to
the ZODB that will ship in Zope 2.8b2.  You can download a source tarball or
Windows installer from:

http://zope.org/Products/ZODB3.4

Note that there are two Windows installers, for Python 2.3 (2.3.5 is
recommended) and Python 2.4 (2.4.1 is recommended).

ZODB 3.4b1 contains many bugfixes and new features, including:

- savepoint/rollback support, a powerful generalization of
  subtransactions allowing to revert to any savepoint'ed state
  within a transaction

- auto-synchronization with storages after a transaction commit
  or abort, and at the explict start (transaction.begin()) of a
  transaction

- a way to register callbacks invoked just before a transaction
  starts to commit -- see the new transaction.beforeCommitHook()

- a new release of ZConfig

See the news file for details:

http://zope.org/Products/ZODB3.4/NEWS.html

Note that ZODB 3.4 does not support any version of Zope 2.6 or 2.7.  Current
Zope 2.8 and Zope 3 development use ZODB 3.4.  The ZODB 3.3 line is
officially retired (3.3.1 final was the last release in the 3.3 line).

___
Zope-Announce maillist  -  Zope-Announce@zope.org
http://mail.zope.org/mailman/listinfo/zope-announce

  Zope-Announce for Announcements only - no discussions

(Related lists - 
 Users: http://mail.zope.org/mailman/listinfo/zope
 Developers: http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-Checkins] SVN: Zope/trunk/lib/python/ZServer/ - Make it so webdav-source server is distinguishable from the default http server in the ZMI and event.log

2005-05-20 Thread Sidnei da Silva
Log message for revision 30467:
  
  - Make it so webdav-source server is distinguishable from the default http 
server in the ZMI and event.log
  

Changed:
  U   Zope/trunk/lib/python/ZServer/HTTPServer.py
  U   Zope/trunk/lib/python/ZServer/datatypes.py

-=-
Modified: Zope/trunk/lib/python/ZServer/HTTPServer.py
===
--- Zope/trunk/lib/python/ZServer/HTTPServer.py 2005-05-20 15:56:59 UTC (rev 
30466)
+++ Zope/trunk/lib/python/ZServer/HTTPServer.py 2005-05-20 17:23:05 UTC (rev 
30467)
@@ -380,8 +380,8 @@
 class zhttp_server(http_server):
 http server
 
-SERVER_IDENT='Zope/%s ZServer/%s' % (ZOPE_VERSION,ZSERVER_VERSION)
-
+SERVER_IDENT = 'Zope/%s ZServer/%s' % (ZOPE_VERSION, ZSERVER_VERSION)
+server_protocol = 'HTTP'
 channel_class = zhttp_channel
 shutup=0
 
@@ -389,16 +389,17 @@
 self.shutup=1
 http_server.__init__(self, ip, port, resolver, logger_object)
 self.shutup=0
-self.log_info('HTTP server started at %s\n'
+self.log_info('%s server started at %s\n'
   '\tHostname: %s\n\tPort: %d' % (
-time.ctime(time.time()),
-self.server_name,
-self.server_port
-))
+self.server_protocol,
+time.ctime(time.time()),
+self.server_name,
+self.server_port
+))
 
 def clean_shutdown_control(self,phase,time_in_this_phase):
 if phase==2:
-self.log_info('closing HTTP to new connections')
+self.log_info('closing %s to new connections' % 
self.server_protocol)
 self.close()
 
 def log_info(self, message, type='info'):
@@ -418,3 +419,6 @@
 # override asyncore limits for nt's listen queue size
 self.accepting = 1
 return self.socket.listen (num)
+
+class zwebdav_server(zhttp_server):
+server_protocol = 'WebDAV'

Modified: Zope/trunk/lib/python/ZServer/datatypes.py
===
--- Zope/trunk/lib/python/ZServer/datatypes.py  2005-05-20 15:56:59 UTC (rev 
30466)
+++ Zope/trunk/lib/python/ZServer/datatypes.py  2005-05-20 17:23:05 UTC (rev 
30467)
@@ -58,27 +58,29 @@
 
 
 class HTTPServerFactory(ServerFactory):
+
 def __init__(self, section):
+from ZServer import HTTPServer
 if not section.address:
 raise ZConfig.ConfigurationError(
 No 'address' settings found 
 within the 'http-server' or 'webdav-source-server' section)
 ServerFactory.__init__(self, section.address)
+self.server_class = HTTPServer.zhttp_server
 self.force_connection_close = section.force_connection_close
 # webdav-source-server sections won't have webdav_source_clients:
 webdav_clients = getattr(section, webdav_source_clients, None)
 self.webdav_source_clients = webdav_clients
 
 def create(self):
-from ZServer import HTTPServer
 from ZServer.AccessLogger import access_logger
 handler = self.createHandler()
 handler._force_connection_close = self.force_connection_close
 if self.webdav_source_clients:
 handler.set_webdav_source_clients(self.webdav_source_clients)
-server = HTTPServer.zhttp_server(ip=self.ip, port=self.port,
- resolver=self.dnsresolver,
- logger_object=access_logger)
+server = self.server_class(ip=self.ip, port=self.port,
+   resolver=self.dnsresolver,
+   logger_object=access_logger)
 server.install_handler(handler)
 return server
 
@@ -88,6 +90,12 @@
 
 
 class WebDAVSourceServerFactory(HTTPServerFactory):
+
+def __init__(self, section):
+from ZServer import HTTPServer
+HTTPServerFactory.__init__(self, section)
+self.server_class = HTTPServer.zwebdav_server
+
 def createHandler(self):
 from ZServer.WebDAVSrcHandler import WebDAVSrcHandler
 return WebDAVSrcHandler(self.module, '', self.cgienv)

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


[Zope-Checkins] CVS: Zope/lib/python/ZServer - HTTPServer.py:1.46.2.5 datatypes.py:1.2.8.3

2005-05-20 Thread Sidnei da Silva
Update of /cvs-repository/Zope/lib/python/ZServer
In directory cvs.zope.org:/tmp/cvs-serv16993

Modified Files:
  Tag: Zope-2_7-branch
HTTPServer.py datatypes.py 
Log Message:

- Make it so webdav-source server is distinguishable from the default http 
server in the ZMI and event.log


=== Zope/lib/python/ZServer/HTTPServer.py 1.46.2.4 = 1.46.2.5 ===
--- Zope/lib/python/ZServer/HTTPServer.py:1.46.2.4  Wed Dec  1 18:01:48 2004
+++ Zope/lib/python/ZServer/HTTPServer.py   Fri May 20 13:39:52 2005
@@ -380,8 +380,8 @@
 class zhttp_server(http_server):
 http server
 
-SERVER_IDENT='Zope/%s ZServer/%s' % (ZOPE_VERSION,ZSERVER_VERSION)
-
+SERVER_IDENT = 'Zope/%s ZServer/%s' % (ZOPE_VERSION, ZSERVER_VERSION)
+server_protocol = 'HTTP'
 channel_class = zhttp_channel
 shutup=0
 
@@ -389,16 +389,17 @@
 self.shutup=1
 http_server.__init__(self, ip, port, resolver, logger_object)
 self.shutup=0
-self.log_info('HTTP server started at %s\n'
+self.log_info('%s server started at %s\n'
   '\tHostname: %s\n\tPort: %d' % (
-time.ctime(time.time()),
-self.server_name,
-self.server_port
-))
+self.server_protocol,
+time.ctime(time.time()),
+self.server_name,
+self.server_port
+))
 
 def clean_shutdown_control(self,phase,time_in_this_phase):
 if phase==2:
-self.log_info('closing HTTP to new connections')
+self.log_info('closing %s to new connections' % 
self.server_protocol)
 self.close()
 
 def log_info(self, message, type='info'):
@@ -418,3 +419,6 @@
 # override asyncore limits for nt's listen queue size
 self.accepting = 1
 return self.socket.listen (num)
+
+class zwebdav_server(zhttp_server):
+server_protocol = 'WebDAV'


=== Zope/lib/python/ZServer/datatypes.py 1.2.8.2 = 1.2.8.3 ===
--- Zope/lib/python/ZServer/datatypes.py:1.2.8.2Fri May 28 02:13:23 2004
+++ Zope/lib/python/ZServer/datatypes.pyFri May 20 13:39:53 2005
@@ -53,26 +53,27 @@
 
 class HTTPServerFactory(ServerFactory):
 def __init__(self, section):
+from ZServer import HTTPServer
 if not section.address:
 raise ZConfig.ConfigurationError(
 No 'address' settings found 
 within the 'http-server' or 'webdav-source-server' section)
 ServerFactory.__init__(self, section.address)
+self.server_class = HTTPServer.zhttp_server
 self.force_connection_close = section.force_connection_close
 # webdav-source-server sections won't have webdav_source_clients:
 webdav_clients = getattr(section, webdav_source_clients, None)
 self.webdav_source_clients = webdav_clients
 
 def create(self):
-from ZServer import HTTPServer
 from ZServer.AccessLogger import access_logger
 handler = self.createHandler()
 handler._force_connection_close = self.force_connection_close
 if self.webdav_source_clients:
 handler.set_webdav_source_clients(self.webdav_source_clients)
-server = HTTPServer.zhttp_server(ip=self.host, port=self.port,
- resolver=self.dnsresolver,
- logger_object=access_logger)
+server = self.server_class(ip=self.host, port=self.port,
+   resolver=self.dnsresolver,
+   logger_object=access_logger)
 server.install_handler(handler)
 return server
 
@@ -82,6 +83,11 @@
 
 
 class WebDAVSourceServerFactory(HTTPServerFactory):
+def __init__(self, section):
+from ZServer import HTTPServer
+HTTPServerFactory.__init__(self, section)
+self.server_class = HTTPServer.zwebdav_server
+
 def createHandler(self):
 from ZServer.WebDAVSrcHandler import WebDAVSrcHandler
 return WebDAVSrcHandler(self.module, '', self.cgienv)

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


[Zope-Checkins] CVS: Zope/doc - CHANGES.txt:1.625.2.332

2005-05-20 Thread Sidnei da Silva
Update of /cvs-repository/Zope/doc
In directory cvs.zope.org:/tmp/cvs-serv18142/doc

Modified Files:
  Tag: Zope-2_7-branch
CHANGES.txt 
Log Message:

- Note about the change


=== Zope/doc/CHANGES.txt 1.625.2.331 = 1.625.2.332 ===
--- Zope/doc/CHANGES.txt:1.625.2.331Tue May 17 14:10:41 2005
+++ Zope/doc/CHANGES.txtFri May 20 13:43:58 2005
@@ -3,15 +3,18 @@
   This file contains change information for the current Zope release.
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
-  
+
 
   after Zope 2.7.6 (unreleased)
 
 Bugs fixed
 
+  - Made WebDAV server distinguishable from the default HTTP
+server both in the ZMI and in event.log.
+
   - Collector #1784: fixed handling of multiple attributes in ZCTextIndex
 
-  - Collector #1751: Improved error reporting reporting during the 
+  - Collector #1751: Improved error reporting reporting during the
 startup phase
 
   - Collector #1745: Fixed ZSQL error KeyError 'query'
@@ -22,8 +25,8 @@
 
 Bugs fixed
 
-  - The previous fix to ZopeUndo/Prefix.py for collector #1726 
-introduced a new bug. This is fixed, but in order to avoid 
+  - The previous fix to ZopeUndo/Prefix.py for collector #1726
+introduced a new bug. This is fixed, but in order to avoid
 bug #1726 in a ZEO environment, you should upgrade the
 ZEO server to at least ZODB 3.2.8 (ships with Zope 2.7.6 final).
 For details, see the ZODB 3.2.8 NEWS file.
@@ -51,9 +54,9 @@
   - Collector #1460: Backported test for this bug (which was *not*
 present on the Zope 2.7 branch).
 
-  - Collector #1726: Transactions from a folder /foo would incorrectly 
+  - Collector #1726: Transactions from a folder /foo would incorrectly
 appear in the Undo management screen for a folder /foobar.
-Fixed so that a prefix must be considered as a path. 
+Fixed so that a prefix must be considered as a path.
 
   - ZPublisher would fail to recognize a XML-RPC request if the
 content-type header included a 'charset' parameter.
@@ -160,7 +163,7 @@
   - Collector #1657: Don't break host-based virtual hosting when
 purging an HTTP accelerator cache.
 
-  - Collector: #1651: removed compiler warning 
+  - Collector: #1651: removed compiler warning
 
   Zope 2.7.4 final (2005/01/15)
 
@@ -180,7 +183,7 @@
   Zope 2.7.4 RC 2 (2005/01/07)
 
 Bugs fixed
-  
+
   - Collector #1407: fixed XML escaping problem introduced in 2.7.4 b1
 
   - moved Docutils back to lib/python/docutils
@@ -210,7 +213,7 @@
 
 Bugs fixed
 
-  - Collector #1617: fixed unchecked buffer accesses and unchecked 
+  - Collector #1617: fixed unchecked buffer accesses and unchecked
 Python API calls in cAccessControl.c (thanks to Tim Peters)
 
   Zope 2.7.4 beta 1 (2004/12/02)
@@ -228,7 +231,7 @@
 
   - The REQUEST now contains a new entry ACTUAL_URL which contains the
 full URL without query string as it appears within the location bar of
-the browser. The key has been added to provide a single key that is 
+the browser. The key has been added to provide a single key that is
 available for vhosted and non-vhosted installations.
 
   - Collector #1605: VHM did not quote URLs

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


[Zope-Checkins] CVS: Zope/lib/python/Products/ZODBMountPoint - MountedObject.py:1.1.2.3

2005-05-20 Thread Tres Seaver
Update of /cvs-repository/Zope/lib/python/Products/ZODBMountPoint
In directory cvs.zope.org:/tmp/cvs-serv32014/lib/python/Products/ZODBMountPoint

Modified Files:
  Tag: Zope-2_7-branch
MountedObject.py 
Log Message:


  - Collector #1781: made 'create_mount_points' ZConfig option actually
work (thanks to Dieter Maurer for the patch).


=== Zope/lib/python/Products/ZODBMountPoint/MountedObject.py 1.1.2.2 = 1.1.2.3 
===
--- Zope/lib/python/Products/ZODBMountPoint/MountedObject.py:1.1.2.2Sat Dec 
20 11:58:07 2003
+++ Zope/lib/python/Products/ZODBMountPoint/MountedObject.pyFri May 20 
14:37:03 2005
@@ -115,7 +115,9 @@
 '''
 meta_type = 'ZODB Mount Point'
 _isMountedObject = 1
-_create_mount_points = 0
+# DM 2005-05-17: default value change necessary after fix of 
'_create_mount_point' handling
+#_create_mount_points = 0
+_create_mount_points = True
 
 icon = 'p_/broken'
 manage_options = ({'label':'Traceback', 'action':'manage_traceback'},)
@@ -165,7 +167,9 @@
 try:
 obj = root[real_root]
 except KeyError:
-if container_class or self._create_mount_points:
+# DM 2005-05-17: why should we require 'container_class'?
+#if container_class or self._create_mount_points:
+if self._create_mount_points:
 # Create a database automatically.
 from OFS.Application import Application
 obj = Application()
@@ -181,7 +185,10 @@
 try:
 obj = obj.unrestrictedTraverse(real_path)
 except (KeyError, AttributeError):
-if container_class or self._create_mount_points:
+# DM 2005-05-13: obviously, we do not want automatic
+#  construction when _create_mount_points is false
+#if container_class or self._create_mount_points:
+if container_class and self._create_mount_points:
 blazer = CustomTrailblazer(obj, container_class)
 obj = blazer.traverseOrConstruct(real_path)
 else:
@@ -270,7 +277,10 @@
 return res
 
 
-def manage_addMounts(dispatcher, paths=(), create_mount_points=0,
+# DM 2005-05-17: change default for 'create_mount_points' as
+#  otherwise (after our fix) 'temp_folder' can no longer be mounted
+#def manage_addMounts(dispatcher, paths=(), create_mount_points=0,
+def manage_addMounts(dispatcher, paths=(), create_mount_points=True,
  REQUEST=None):
 Adds MountedObjects at the requested paths.
 
@@ -293,7 +303,9 @@
 faux.id = mo.id
 faux.meta_type = loaded.meta_type
 container._setObject(faux.id, faux)
-del mo._create_mount_points
+# DM 2005-05-17: we want to keep our decision about automatic
+#  mount point creation
+#del mo._create_mount_points
 container._setOb(faux.id, mo)
 setMountPoint(container, faux.id, mo)
 count += 1

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


[Zope-Coders] Zope tests: 6 OK

2005-05-20 Thread Zope tests summarizer
Summary of messages to the zope-tests list.
Period Thu May 19 11:01:01 2005 UTC to Fri May 20 11:01:01 2005 UTC.
There were 6 messages: 6 from Zope Unit Tests.


Tests passed OK
---

Subject: OK : Zope-2_6-branch Python-2.1.3 : Linux
From: Zope Unit Tests
Date: Thu May 19 22:40:47 EDT 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-May/002151.html

Subject: OK : Zope-2_6-branch Python-2.3.5 : Linux
From: Zope Unit Tests
Date: Thu May 19 22:42:18 EDT 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-May/002152.html

Subject: OK : Zope-2_7-branch Python-2.3.5 : Linux
From: Zope Unit Tests
Date: Thu May 19 22:43:48 EDT 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-May/002153.html

Subject: OK : Zope-2_7-branch Python-2.4.1 : Linux
From: Zope Unit Tests
Date: Thu May 19 22:45:18 EDT 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-May/002154.html

Subject: OK : Zope-trunk Python-2.3.5 : Linux
From: Zope Unit Tests
Date: Thu May 19 22:46:48 EDT 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-May/002155.html

Subject: OK : Zope-trunk Python-2.4.1 : Linux
From: Zope Unit Tests
Date: Thu May 19 22:48:18 EDT 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-May/002156.html

___
Zope-Coders mailing list
Zope-Coders@zope.org
http://mail.zope.org/mailman/listinfo/zope-coders


Re: [Zope] Answer's Time

2005-05-20 Thread Hoang-Vu PHUNG
Hi,

I had this problem as well in the past (not specially
with zope). It could be a hidden browser process (you
can see in the process list) that blocks. Try to look
at the access log to see if the request is sent to the
server. Finally it could be a problem with your
application.

Hope that helps
Cheers

Hoang-Vu

--- Fernando Lujan [EMAIL PROTECTED] a écrit:
 I'm having the following problem and wanna know
 whether it can be
 associated with Zope.
 
 I have a page in my system with various links, and
 when I click in a
 link, for instance link 1.
 
 The cursor starts being busy, the browser appear to
 send the request
 but there is no response. When it happens, if I open
 another window
 and click in the same link, I have the response
 immediately.
 
 It's tuly very weird... How can I debug it? I'm
 using Zope 2.74 with
 python 2.3.4.
 
 Suggestions will be welcome. Thanks and regards.
 
 Fernando Lujan
 ___
 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 )
 






_ 
Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, 
photos et vidéos ! 
Créez votre Yahoo! Mail sur http://fr.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 )


[Zope] how to accumulate data using ZPT

2005-05-20 Thread prabuddha ray
I've this report wherein i've to print the column total iin last row.
column values are from database.
so far I'm a total loss. do i need to have cookies to store this total?

plz gimme ideas.

-- 
Share the vision of difference with ME
___
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 to accumulate data using ZPT

2005-05-20 Thread Hugo Ramos
Yellow,

What DBMS are you using??? MySQL???
If so just have a sql method do this:
==
SELECT COUNT( '*' )  AS total
FROM yourtable
==

Then call the variable total where you need it!

Regards
hr


On 5/20/05, prabuddha ray [EMAIL PROTECTED] wrote:
 I've this report wherein i've to print the column total iin last row.
 column values are from database.
 so far I'm a total loss. do i need to have cookies to store this total?
 
 plz gimme ideas.
 
 --
 Share the vision of difference with ME
 ___
 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 )
 


-- 
Hugo Ramos - [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] how to accumulate data using ZPT

2005-05-20 Thread Tino Wildenhain
Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
 Yellow,
 
 What DBMS are you using??? MySQL???
 If so just have a sql method do this:
 ==
 SELECT COUNT( '*' )  AS total
 FROM yourtable
 ==

Are you sure about the ' '? looks strange.

 Then call the variable total where you need it!
 
 Regards
 hr
 
 
 On 5/20/05, prabuddha ray [EMAIL PROTECTED] wrote:
  I've this report wherein i've to print the column total iin last row.
  column values are from database.
  so far I'm a total loss. do i need to have cookies to store this total?

simplest solution if you need the data anyway:
a python script where you do the zsql method

results=context.whateverZSQLMethod(args...)

return context.yourPageTemplate(results=results,count=len(results))

and use

tal:content=options/count in the template where you need count.
If its a sum you need, just work over your resultset or use a separate
query. 

Easiest to work over result set (especially if the select is costy)


results=context.whateverZSQLMethod(args...)

total=0
for item in results:
   if item.value: # this handles the case of nulls
   total+=item.value

and use the total as argument:

return context.yourPageTemplate(results=results,
count=len(results),
total=total)


-- 
Tino Wildenhain [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] how to accumulate data using ZPT

2005-05-20 Thread Hugo Ramos
On 5/20/05, Tino Wildenhain [EMAIL PROTECTED] wrote:
 Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
  Yellow,
 
  What DBMS are you using??? MySQL???
  If so just have a sql method do this:
  ==
  SELECT COUNT( '*' )  AS total
  FROM yourtable
  ==
 
 Are you sure about the ' '? looks strange.

It works both ways... With or without the ' ' !


  Then call the variable total where you need it!
 
  Regards
  hr
 
 
  On 5/20/05, prabuddha ray [EMAIL PROTECTED] wrote:
   I've this report wherein i've to print the column total iin last row.
   column values are from database.
   so far I'm a total loss. do i need to have cookies to store this total?
 
 simplest solution if you need the data anyway:
 a python script where you do the zsql method
 
 results=context.whateverZSQLMethod(args...)
 
 return context.yourPageTemplate(results=results,count=len(results))
 
 and use
 
 tal:content=options/count in the template where you need count.
 If its a sum you need, just work over your resultset or use a separate
 query.
 
 Easiest to work over result set (especially if the select is costy)
 
 
 results=context.whateverZSQLMethod(args...)
 
 total=0
 for item in results:
if item.value: # this handles the case of nulls
total+=item.value
 
 and use the total as argument:
 
 return context.yourPageTemplate(results=results,
 count=len(results),
 total=total)
 
 
 --
 Tino Wildenhain [EMAIL PROTECTED]
 
 


-- 
Hugo Ramos - [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] how to accumulate data using ZPT

2005-05-20 Thread Tino Wildenhain
Am Freitag, den 20.05.2005, 10:36 +0100 schrieb Hugo Ramos:
 On 5/20/05, Tino Wildenhain [EMAIL PROTECTED] wrote:
  Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
   Yellow,
  
   What DBMS are you using??? MySQL???
   If so just have a sql method do this:
   ==
   SELECT COUNT( '*' )  AS total
   FROM yourtable
   ==
  
  Are you sure about the ' '? looks strange.
 
 It works both ways... With or without the ' ' !
 
well. another reason to avoid mysql I guess ;)



___
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] Keyword index search

2005-05-20 Thread Garito
Hi all
I have a ZCatalog object with a keywordindex called keywords
I would like to search some objects with keywords ['k1', 'k2', k3', 
'k4'] for that I use:

return context.catalog({'keywords': {'query': ['k1', 'k2', k3', 'k4'], 
'operator': 'and'}})

but these query returns objects with keyword = ['k2', 'k3'] (for me 
incorrect, I would like to find objects with *all* keywords

How can I make these kind of querys?
Thanks!
--
Mis Cosas
http://blogs.sistes.net/Garito/
___
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] Keyword index search

2005-05-20 Thread Chris McDonough
On Fri, 2005-05-20 at 12:41 +0200, Garito wrote:
 Hi all
 
 I have a ZCatalog object with a keywordindex called keywords
 
 I would like to search some objects with keywords ['k1', 'k2', k3', 
 'k4'] for that I use:
 
 return context.catalog({'keywords': {'query': ['k1', 'k2', k3', 'k4'], 
 'operator': 'and'}})
 
 but these query returns objects with keyword = ['k2', 'k3'] (for me 
 incorrect, I would like to find objects with *all* keywords

Do you mean you'd like to find objects that have *all* of the keywords
in the query list or do you mean you'd like to find objects with *any*
of the keywords in the query list?  Can you give an example of two or
three objects, their keywords, a query, and the desired results?

- C


___
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] Re: how to accumulate data using ZPT

2005-05-20 Thread prabuddha ray
sorry for delay, 
 but the options you gave are ruled out.
actually not all the rows in the column have the values.
further the total i'm looking for will result in a very complex query 
that i dont want to do onsidering the no. of rows are high.
  
  I just need something like a var in my ZPT which can just sum up the
values if they  are present.
value's prsence i'm checking using tal:condition but how to add the
value repeatedly in the sum var.

kindly help.



On 5/20/05, Tino Wildenhain [EMAIL PROTECTED] wrote:
 Am Freitag, den 20.05.2005, 10:36 +0100 schrieb Hugo Ramos:
  On 5/20/05, Tino Wildenhain [EMAIL PROTECTED] wrote:
   Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
Yellow,
   
What DBMS are you using??? MySQL???
If so just have a sql method do this:
==
SELECT COUNT( '*' )  AS total
FROM yourtable
==
   
   Are you sure about the ' '? looks strange.
  
  It works both ways... With or without the ' ' !
  
 well. another reason to avoid mysql I guess ;)
 
 
 
 


-- 
Share the vision of difference with ME
___
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] Re: how to accumulate data using ZPT

2005-05-20 Thread Chris McDonough
Use two things: a page template and a Python script... here's an
example:

page template body
--

div tal:define=L python: [1,2,3,4];
 A python: context.sum_of(L)
   div tal:repeat=V L
 tal:content=V1/div
   div tal:content=Atotal/div
/div

python script sum_of body
---
## Script (Python) sum_of
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=L
##title=
##
x = 0
for val in L:
   x = x + val
return x


On Fri, 2005-05-20 at 03:54 -0700, prabuddha ray wrote:
 sorry for delay, 
  but the options you gave are ruled out.
 actually not all the rows in the column have the values.
 further the total i'm looking for will result in a very complex query 
 that i dont want to do onsidering the no. of rows are high.
   
   I just need something like a var in my ZPT which can just sum up the
 values if they  are present.
 value's prsence i'm checking using tal:condition but how to add the
 value repeatedly in the sum var.
 
 kindly help.
 
 
 
 On 5/20/05, Tino Wildenhain [EMAIL PROTECTED] wrote:
  Am Freitag, den 20.05.2005, 10:36 +0100 schrieb Hugo Ramos:
   On 5/20/05, Tino Wildenhain [EMAIL PROTECTED] wrote:
Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
 Yellow,

 What DBMS are you using??? MySQL???
 If so just have a sql method do this:
 ==
 SELECT COUNT( '*' )  AS total
 FROM yourtable
 ==

Are you sure about the ' '? looks strange.
   
   It works both ways... With or without the ' ' !
   
  well. another reason to avoid mysql I guess ;)
  
  
  
  
 
 

___
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] Re: how to accumulate data using ZPT

2005-05-20 Thread Tino Wildenhain
Am Freitag, den 20.05.2005, 03:54 -0700 schrieb prabuddha ray:
 sorry for delay, 
  but the options you gave are ruled out.
 actually not all the rows in the column have the values.

Which is perfectly met by the if statement. Please read
_my_ post again and to the end.

 further the total i'm looking for will result in a very complex query 
 that i dont want to do onsidering the no. of rows are high.
   
   I just need something like a var in my ZPT which can just sum up the
 values if they  are present.
 value's prsence i'm checking using tal:condition but how to add the
 value repeatedly in the sum var.

No, you definitively dont want that type of algorithm implement in
ZPT. Thats better done in python scripts. The skeleton again 
in my mail. Forget about the count() for a moment.

Regards
Tino
-- 
Tino Wildenhain [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 )


[Zope] Webdav and emacs, eldav, nd problem.

2005-05-20 Thread Gaute Amundsen
Hi.

We just upgraded to Zope 2.7.5-1.fc3, python 2.3.4, and now I am having 
problems with authoring Script (Python)

(using ssh tunnel:  ssh -L 2001:localhost:8081 [EMAIL PROTECTED])

I am using emacs, using eldav, using nd.
I have traced the problem to this command issued by eldav in the process of 
saving changes to a file.

nd -S -p /localpath/script.py -a Zope 
http://localhost:2001/path/on/remote/server/script.py;

The problem is replicated on the commandline.

What happens is that the python script gets saved as Page Template with  
Content-Type: text/plain.
( I have tried nd's -T option, but to no avail )

As nothing else have changed, ( afaik ) I must assume there has been some 
changes made to zopes webdav support.

Any ideas anyone?

Hm.. I notice we have ExternalEditor (0.5) installed.
Could this have any influence? Perhaps I will try using it :)

Gaute



___
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] Webdav and emacs, eldav, nd problem.

2005-05-20 Thread Chris McDonough
Does a (Script) Python object actually get created or is it another
object type like DTML Document when it is initially created?  As far as
I can tell, it would have to be the latter, as Python Scripts don't
allow you to change their content-types (at least via the ZMI).

On Fri, 2005-05-20 at 17:05 +0200, Gaute Amundsen wrote:
 Hi.
 
 We just upgraded to Zope 2.7.5-1.fc3, python 2.3.4, and now I am having 
 problems with authoring Script (Python)
 
 (using ssh tunnel:  ssh -L 2001:localhost:8081 [EMAIL PROTECTED])
 
 I am using emacs, using eldav, using nd.
 I have traced the problem to this command issued by eldav in the process of 
 saving changes to a file.
 
 nd -S -p /localpath/script.py -a Zope 
 http://localhost:2001/path/on/remote/server/script.py;
 
 The problem is replicated on the commandline.
 
 What happens is that the python script gets saved as Page Template with  
 Content-Type: text/plain.
 ( I have tried nd's -T option, but to no avail )
 
 As nothing else have changed, ( afaik ) I must assume there has been some 
 changes made to zopes webdav support.
 
 Any ideas anyone?
 
 Hm.. I notice we have ExternalEditor (0.5) installed.
 Could this have any influence? Perhaps I will try using it :)
 
 Gaute
 
 
 
 ___
 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] SQL Database Connections

2005-05-20 Thread Andreas Jung

--On Freitag, 20. Mai 2005 9:05 Uhr -0700 Jonathan Daugherty 
[EMAIL PROTECTED] wrote:

Greetings,
I connect to PostgreSQL from Zope and whenever I upgrade postgres on
my server, my persistent database connections in Zope fail.  I have to
log in to the ZMI and reconnect the connection objects manually to
restore the connections; is there a way to attempt a reconnection
automatically when postgres goes down or is upgraded?
Depends on the underlaying DAso which one are you using? In general
a DA should reconnect automatically.
-aj


pgpmRjFbWVs7B.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] SQL Database Connections

2005-05-20 Thread Jonathan Daugherty
# Depends on the underlaying DAso which one are you using? In
# general a DA should reconnect automatically.

I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.

-- 
  Jonathan Daugherty
  http://www.parsed.org
___
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] SQL Database Connections

2005-05-20 Thread Andreas Jung

--On Freitag, 20. Mai 2005 9:18 Uhr -0700 Jonathan Daugherty 
[EMAIL PROTECTED] wrote:

# Depends on the underlaying DAso which one are you using? In
# general a DA should reconnect automatically.
I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.
Try to upgrade...
-aj


pgpWEdvNFsUxh.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] Modifying __bases__

2005-05-20 Thread Dan Pozmanter



Hey,

 I 
noticed that the version of python that ships with zope is 
restricted,
such that when you 
create an instance of a class, you are no longer able to 
modify
__bases__ for that 
class object.

 
This is not the case with standard python.

 Is this intentional? If so, what is the reasoning behind 
this?

Dan
___
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] Re: code completion for ZPT

2005-05-20 Thread Derrick Hudson
On Wed, May 18, 2005 at 11:55:20AM +0200, Milos Prudek wrote:
| Hi,
| 
| is there an editor that would support code completion for Page Templates 
| and maybe even code completion for Zope3 new technologies?
| 
| Currently I use ViM on Linux - but a lot of typing is required, like 
| tal:attributes - 14 keystrokes.

Use ^N.  The following excerpt is from vim's ':help'

---
Completing keywords from different sources  *compl-generic*

*i_CTRL-N*
CTRL-N  Find next match for words that start with the
keyword in front of the cursor, looking in places
specified with the 'complete' option.  The found
keyword is inserted in front of the cursor.

*i_CTRL-P*
CTRL-P  Find previous match for words that start with the
keyword in front of the cursor, looking in places
specified with the 'complete' option.  The found
keyword is inserted in front of the cursor.

CTRL-N  Search forward for next matching keyword.  This
keyword replaces the previous matching keyword.

CTRL-P  Search backwards for next matching keyword.  This
keyword replaces the previous matching keyword.
---

-D

-- 
\begin{humor}
Disclaimer:
If I receive a message from you, you are agreeing that:
   1. I am by definition, the intended recipient
   2. All information in the email is mine to do with as I see fit and make
such financial profit, political mileage, or good joke as it lends
itself to. In particular, I may quote it on USENET or the WWW.
   3. I may take the contents as representing the views of your company.
   4. This overrides any disclaimer or statement of confidentiality that may
be included on your message
\end{humor}
 
www: http://dman13.dyndns.org/~dman/jabber: [EMAIL PROTECTED]


signature.asc
Description: Digital 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] Modifying __bases__

2005-05-20 Thread Andreas Jung

--On Freitag, 20. Mai 2005 12:32 Uhr -0400 Dan Pozmanter [EMAIL PROTECTED] 
wrote:

Hey,
I noticed that the version of python that ships with zope is
restricted,
such that when you create an instance of a class, you are no longer able
to modify
__bases__ for that class object.
This is not the case with standard python.
Is this intentional?  If so, what is the reasoning behind this?
You mean the Windows binaries? This should be a standard Python version.
However by do you want to modify __bases__? This sounds like a very evil 
hack
to me. What's your usecase?

-aj


pgp5H2vY29Msi.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] Re: Zope 3 for Debian?

2005-05-20 Thread Derrick Hudson
On Tue, May 17, 2005 at 06:20:22PM +0100, David Given wrote:
| Does anyone know what the timescale is for Zope 3 packages being put together 
| for Debian?

This is unforeseeable without someone stepping up to do the work.

| I have a project I'd like to work on, and I suspect that Zope 3 
| is a better bet than Zope 2

It is, IMO.

| --- but Zope 3's not out yet

I'm not even sure of the quality of the zope 2 package in debian.  A
couple developers recently started taking over the packages and fixing
them up.  I'm sure their doing a good job (and I hope they keep it
up), but I don't know how close to done they are (ie things may
change or be reorganized, or you might deviate sufficiently that it
would be easier to work from the zope.org source).

| Is it worth waiting 
| or should I just go for Zope 2?

Don't wait, unless you're the one to do the packaging work.

| (No, I don't want to install Zope 3 manually. It's sufficiently large and 
| sufficiently complex that it'd be a dependency nightmare.)

As Andreas pointed out, it is really quite simple and not a nightmare.
Furthermore, if you want to have some help from the packaging system,
create a dummy package using 'equivs' to depend on the system
components your z3 application will need.
 
HTH,
-D

-- 
In my Father's house are many rooms; if it were not so, I would have
told you.  I am going there to prepare a place for you.  And if I go and
prepare a place for you, I will come and take you to be with me that you
also may be where I am.
John 14:2-3
 
www: http://dman13.dyndns.org/~dman/jabber: [EMAIL PROTECTED]


signature.asc
Description: Digital 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] Modifying __bases__

2005-05-20 Thread Dan Pozmanter
Well, when I run it, I am able to do the following:


class A: 
pass

class B(A):
pass

b = B()

B.__bases__ = ()

print B.__bases__


Not so on the version that comes with zope.
(B.__bases__ will remain unchanged.)

What I aim to do is have the User Object inherit from a custom class
(AlienUser).

-Original Message-
From: Andreas Jung [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 20, 2005 12:46 PM
To: Dan Pozmanter; zope@zope.org
Subject: Re: [Zope] Modifying __bases__



--On Freitag, 20. Mai 2005 12:32 Uhr -0400 Dan Pozmanter
[EMAIL PROTECTED]
wrote:

 Hey,

 I noticed that the version of python that ships with zope is 
 restricted, such that when you create an instance of a class, you are 
 no longer able to modify __bases__ for that class object.

 This is not the case with standard python.

 Is this intentional?  If so, what is the reasoning behind this?


You mean the Windows binaries? This should be a standard Python version.
However by do you want to modify __bases__? This sounds like a very evil
hack to me. What's your usecase?

-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] Modifying __bases__

2005-05-20 Thread Tino Wildenhain
Am Freitag, den 20.05.2005, 13:48 -0400 schrieb Dan Pozmanter:
 Well, when I run it, I am able to do the following:
 
 
 class A: 
   pass
 
 class B(A):
   pass
 
 b = B()
 
 B.__bases__ = ()
 
 print B.__bases__
 
 
 Not so on the version that comes with zope.
 (B.__bases__ will remain unchanged.)
 
 What I aim to do is have the User Object inherit from a custom class
 (AlienUser).

Well, you can just inherit with a class from zopes extension classes.
You cannot modify the class bases like this with extension classes.

You can work around that like I did with the history (monkey) patch:

http://www.zope.org/Members/tino/PatchHistory/view

Otherwise it sounds evil and you failed to show the true
motivation with your example above.

Tino.

PS: Votes for a true implementation in current zope instead
of the monkey patch? If so, tell me.



___
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] SQL Database Connections

2005-05-20 Thread Tino Wildenhain
Am Freitag, den 20.05.2005, 18:28 +0200 schrieb Andreas Jung:
 
 --On Freitag, 20. Mai 2005 9:18 Uhr -0700 Jonathan Daugherty 
 [EMAIL PROTECTED] wrote:
 
 # Depends on the underlaying DAso which one are you using? In
 # general a DA should reconnect automatically.
 
  I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.
 
 
 Try to upgrade...

Well, afaic this is a problem of the upgrade ;) 
this feature was introduced in the recent version
of the psycopgda. 
Maybe this can be hacked...



___
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] Modifying __bases__

2005-05-20 Thread Paul Winkler
On Fri, May 20, 2005 at 01:48:46PM -0400, Dan Pozmanter wrote:
 What I aim to do is have the User Object inherit from a custom class
 (AlienUser).

You can do that in two ways off the top of my head:

1) the good way: write a custom UserFolder.
You could probably get away with just inheriting from UserFolder and 
overriding _doAddUser(). 

2) the hacky way: monkeypatch User.py to replace SimpleUser
with your class.

either way the stuff you are interested in is in AccessControl/User.py.


-- 

Paul Winkler
http://www.slinkp.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: [Zope] Modifying __bases__

2005-05-20 Thread Chris McDonough
You might also be able to do the __bases__ hack with Zope 2.8 (as long
as Python 2.3+ allows you to assign to it), as it reimplements
ExtensionClass using metaclasses instead of custom C hackery.

On Fri, 2005-05-20 at 14:46 -0400, Paul Winkler wrote:
 On Fri, May 20, 2005 at 01:48:46PM -0400, Dan Pozmanter wrote:
  What I aim to do is have the User Object inherit from a custom class
  (AlienUser).
 
 You can do that in two ways off the top of my head:
 
 1) the good way: write a custom UserFolder.
 You could probably get away with just inheriting from UserFolder and 
 overriding _doAddUser(). 
 
 2) the hacky way: monkeypatch User.py to replace SimpleUser
 with your class.
 
 either way the stuff you are interested in is in AccessControl/User.py.
 
 

___
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] Webdav and emacs, eldav, nd problem.

2005-05-20 Thread Dieter Maurer
Gaute Amundsen wrote at 2005-5-20 17:05 +0200:
We just upgraded to Zope 2.7.5-1.fc3, python 2.3.4, and now I am having 
problems with authoring Script (Python)

(using ssh tunnel:  ssh -L 2001:localhost:8081 [EMAIL PROTECTED])

I am using emacs, using eldav, using nd.
I have traced the problem to this command issued by eldav in the process of 
saving changes to a file.

nd -S -p /localpath/script.py -a Zope 
http://localhost:2001/path/on/remote/server/script.py;

The problem is replicated on the commandline.

Unfortunately, the Zope world is much more complex than
WebDAV expects. WebDAV knows only two types of resources:
collection resources and non-collection resources.
Zope, on the other hand, knows arbitrary many resouce types:
Folders, PageTemplate, PythonScripts, DTMLMethods, Files, Images, 

When you create a new object via WebDAV (or FTP or another
filesystem oriented protocol), then Zope does not have
enough information to determine which type of object it should
create. Therefore, it calls a hook, the so called PUT_Factory,
to determine the object type.

Obviously, the PUT_Factory active in your context got it wrong.
There is a HowTo around, how to set up your own PUT_Factory.

Note, in a CMF/Plone context (you did not tell us your context),
the PUT_Factory is called content_type_registry.


-- 
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] Keyword index search

2005-05-20 Thread Dieter Maurer
Garito wrote at 2005-5-20 12:41 +0200:
 ...
I have a ZCatalog object with a keywordindex called keywords

I would like to search some objects with keywords ['k1', 'k2', k3', 
'k4'] for that I use:

return context.catalog({'keywords': {'query': ['k1', 'k2', k3', 'k4'], 
'operator': 'and'}})

but these query returns objects with keyword = ['k2', 'k3'] (for me 
incorrect, I would like to find objects with *all* keywords

How can I make these kind of querys?

A long standing bug in KeywordIndex...


Maybe, you give my Managable KeywordIndex a try
(part of ManagableIndex).

I cannot promiss you that
ManagableIndex is free of bugs but I definitely can
promiss you that a bug resulting in wrong search results
is fixed much much more quickly than in the Zope core :-)


  http://www.dieter.handshake.de/pyprojects/zope


-- 
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] zmi issues

2005-05-20 Thread Dieter Maurer
Yuri wrote at 2005-5-19 18:01 +0200:
 I'm doing an import of a large .zexp (from ZMI), and I see thay Zope is 
first loading it all in memory, than doing the work of importing it!

How do you see this?

In fact, Zope does not work this way.
Instead it reads the zexp incrementally and as it reads builds
the Python object described by it.

But, it may not make that much of a difference.
Due to its persistency design, Zope must keep everything
in memory until a [sub-]transaction boundary.
As the Python object is likely to have a size in the order
of that of the zexp, your memory requirement is in that order.

I 
mean, isn't it a little bit *inefficient? :)

What do you expect?

 Also, renaming a folder with a lot of zclasses in (40.000), takes a lot 
of time. After 10 minutes, it was still there... and this is a 2,4 Ghz 
P4 and 512 MB of Ram...

Zope objects are often identified by their paths.
Thus, if you rename some node, then the path of this node
and all its descendants is changed. To allow for the necessary
updates, Zope calls manage_beforeDelete followed by manage_afterAdd
for the renamed node and all its descendants.
This makes an operation expensive, you deem to be inexpensive...

 Can this be fixed/improved? :)

In principle, yes -- provided you do nowhere identify Zope objects
by their path. Especially, you do not use a (standard) catalog
(which does identify objects by their path).

When you know that nothing in your application depends on the path,
then you can override manage_renameObject to perform
the renaming without the call to manage_beforeDelete and
manage_afterAdd.
Expect some minor non-trivialities...


-- 
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] response.redirect not working

2005-05-20 Thread Artras

Hello,


I have a web page, a form on it, and on form submit action (to the same page) I 
do some database actions (update some record, to be correct). The exact code 
looks like this (filename edit_html):

.

(1) dtml-if form
(2)   dtml-call RESPONSE.redirect('index_html')

  p style=color:greenbSaved./b/p

(3)  dtml-in db_fulluseredit(zd=_['zd'], orig_login=_['uid'], 
login=_['login'], vardas=_['vardas'], pavarde=_['pavarde'], 
nickas=_['nickas'], email=_['email'], address=_['address'], 
phone=_['phone'], pastabos=_['pastabos'], 
date_gime=_['date_gime'], date_valid=_['date_valid'], planas=_['planas'], 
current_user_login=AUTHENTICATED_USER.getUserName())

.

On #1 line I check if form variable is defined (it's defined in form, so if the 
form is opened for the first time, the form is naturally null, and if the form 
is submitted - it's defined to 1 [input type=hidden name=form value=1] ). #2 
line let's skip for a moment. On #3 line I do database actions with result 
checking. (On a wider scope - the form is for user properties management - 
name, surname, address, login, phone, notes  etc.).

The problem is on line #2. According to what's written, zope should drop 
everything and do immediate redirect to page index_html (ok, it's not where the 
first error appeared, I just managed to generate this error as the most 
clearest and best visible one), but instead zope calmly executes database 
actions and does other stuff till the end of the document.


Id be very thankful for any ideas... it's sad not to control own code :/

If you want, I can send you the whole code as well as to provide access to the 
live system.

Zope version: 2.6.4-1.8. Debian, postgresql 7.4 (latest 7th, I don't remember 
exact version now).

 
Artras
[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] response.redirect not working

2005-05-20 Thread Paul Winkler
On Fri, May 20, 2005 at 11:45:58PM +0300, Art??ras wrote:
 The problem is on line #2. According to what's written, zope should
 drop everything and do immediate redirect to page index_html (ok, it's
 not where the first error appeared, I just managed to generate this
 error as the most clearest and best visible one), but instead zope
 calmly executes database actions and does other stuff till the end of
 the document.

I don't think RESPONSE.redirect() can reasonably be expected to stop all 
further processing of your script or template. 
It simply adds a header to the response, which has no effect until
the client receives it.

-- 

Paul Winkler
http://www.slinkp.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: [Zope] Modifying __bases__

2005-05-20 Thread Dan Pozmanter
Going with 2.8 sounds like a rather good solution.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Chris McDonough
Sent: Friday, May 20, 2005 3:01 PM
To: Paul Winkler
Cc: zope@zope.org
Subject: Re: [Zope] Modifying __bases__

You might also be able to do the __bases__ hack with Zope 2.8 (as long
as Python 2.3+ allows you to assign to it), as it reimplements
ExtensionClass using metaclasses instead of custom C hackery.

On Fri, 2005-05-20 at 14:46 -0400, Paul Winkler wrote:
 On Fri, May 20, 2005 at 01:48:46PM -0400, Dan Pozmanter wrote:
  What I aim to do is have the User Object inherit from a custom class

  (AlienUser).
 
 You can do that in two ways off the top of my head:
 
 1) the good way: write a custom UserFolder.
 You could probably get away with just inheriting from UserFolder and 
 overriding _doAddUser().
 
 2) the hacky way: monkeypatch User.py to replace SimpleUser with your 
 class.
 
 either way the stuff you are interested in is in
AccessControl/User.py.
 
 

___
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] response.redirect not working

2005-05-20 Thread David H
Artras wrote:
Hello,
I have a web page, a form on it, and on form submit action (to the same 
page) I do some database actions (update some record, to be correct). The exact 
code looks like this (filename edit_html):
.
(1) dtml-if form
(2)   dtml-call RESPONSE.redirect('index_html')
 p style=color:greenbSaved./b/p
(3)  dtml-in db_fulluseredit(zd=_['zd'], orig_login=_['uid'], login=_['login'], vardas=_['vardas'], pavarde=_['pavarde'], 
   nickas=_['nickas'], email=_['email'], address=_['address'], phone=_['phone'], pastabos=_['pastabos'], 
   date_gime=_['date_gime'], date_valid=_['date_valid'], planas=_['planas'], current_user_login=AUTHENTICATED_USER.getUserName())

.
On #1 line I check if form variable is defined (it's defined in form, so if the form is 
opened for the first time, the form is naturally null, and if the form is submitted - 
it's defined to 1 [input type=hidden name=form value=1] ). #2 line let's skip for 
a moment. On #3 line I do database actions with result checking. (On a wider scope - the 
form is for user properties management - name, surname, address, login, phone, notes 
 etc.).
The problem is on line #2. According to what's written, zope should drop 
everything and do immediate redirect to page index_html (ok, it's not where the 
first error appeared, I just managed to generate this error as the most 
clearest and best visible one), but instead zope calmly executes database 
actions and does other stuff till the end of the document.
Id be very thankful for any ideas... it's sad not to control own code :/
If you want, I can send you the whole code as well as to provide access to the 
live system.
Zope version: 2.6.4-1.8. Debian, postgresql 7.4 (latest 7th, I don't remember 
exact version now).
Artras
[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 )

__ NOD32 1.1103 (20050520) Information __
This message was checked by NOD32 antivirus system.
http://www.nod32.com

 

Arturas,
RESPONSE.redirect drops request (including form vars).  Maybe thats a 
clue? 
David

___
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] Modifying __bases__

2005-05-20 Thread Dan Pozmanter
Out of curiosity, I've noticed the word evil attached to patching
of various and monkey kinds.  Not bad, or unwise, but evil,
implying a morality associated with the act.

What is morally wrong with modifying live objects in a dynamic language
to achieve desired functionality?
The idea is I want to modify the zope core in a way that survives
version to version, yet does not
impose a specific use case on all zope users.

-Original Message-
From: Tino Wildenhain [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 20, 2005 2:38 PM
To: Dan Pozmanter
Cc: Andreas Jung; zope@zope.org
Subject: RE: [Zope] Modifying __bases__

Am Freitag, den 20.05.2005, 13:48 -0400 schrieb Dan Pozmanter:
 Well, when I run it, I am able to do the following:
 
 
 class A: 
   pass
 
 class B(A):
   pass
 
 b = B()
 
 B.__bases__ = ()
 
 print B.__bases__
 
 
 Not so on the version that comes with zope.
 (B.__bases__ will remain unchanged.)
 
 What I aim to do is have the User Object inherit from a custom class 
 (AlienUser).

Well, you can just inherit with a class from zopes extension classes.
You cannot modify the class bases like this with extension classes.

You can work around that like I did with the history (monkey) patch:

http://www.zope.org/Members/tino/PatchHistory/view

Otherwise it sounds evil and you failed to show the true motivation with
your example above.

Tino.

PS: Votes for a true implementation in current zope instead
of the monkey patch? If so, tell me.



___
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] response.redirect not working

2005-05-20 Thread Artūras
Hello


The  dtml-return RESPONSE.redirect('index_html') did the trick :) Thank 
you, Jo :)


For David: this redirect was for exceptional situation - if user ID was changed 
the the whole page had to be reloaded with new ID, that was 
redirect('user_html?id=') style. All other variables should have been 
dropped. This was the expected behavior :)


Thank you all for your support and ideas :)
 
Artras
 

-Original Message-
From: Jo Meder [mailto:[EMAIL PROTECTED] 
Sent: 2005 m. gegus 21 d. 00:10
To: Art??ras
Subject: Re: [Zope] response.redirect not working

Am 20.05.2005, 22:45 Uhr
schrhb Art??ras [EMAIL PROTECTED]:


 (1) dtml-if form
 (2)   dtml-call RESPONSE.redirect('index_html')

dtml-call ... won't stop processing of the rest of the page. Have
you tried 

dtml-return RESPONSE.redirect('index_html')

instead?

Jo.


___
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] Modifying __bases__

2005-05-20 Thread Paul Winkler
On Fri, May 20, 2005 at 05:10:30PM -0400, Dan Pozmanter wrote:
 What is morally wrong with modifying live objects in a dynamic language
 to achieve desired functionality?
 The idea is I want to modify the zope core in a way that survives
 version to version, yet does not
 impose a specific use case on all zope users.

I don't want to overgeneralize, but the moral issue I have with
monkey-patching is illustrated by an anecdote.

Once I was attempting to debug a problem with a core Zope product.
It was behaving in a baffling fashion that contradicted what the
source code was telling me. It was only during a tedious pdb session
that I discovered that a third-party product had monkey-patched
the method in question. (This turned out not to be the cause of the
problem we were having - but the mystery wasted an hour of my time 
when I was facing a deadline.)

The lesson is: python code may be eminently readable, and on this list
we are fond of telling users to use the source - but a monkeypatch in
some obscure corner of an add-on package can turn the source code into a
big fat lie.

That's evil :-)

Of course, sometimes it is a necessary (or at least expedient)
evil... sometimes you need a hook where there just isn't one
and you have no choice but to bash your way in there like a
500-pound gorilla.  So, I monkeypatch, and I feel guilty :-)

-PW

-- 

Paul Winkler
http://www.slinkp.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: [Zope-DB] ZODBCDA

2005-05-20 Thread Philip Kilner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Carlos,

Carlos A. Micucci wrote:
 I have a problem with ZODBCDA. When query a DB which instances have a
 null values, this values return as cero values (0) not  nulls values,
 and  this  is a problem  for me,  because  I need  differentiate  them.
 In my opinion, it's a serious error. There is somebody who know the
 solution?
 

ZODBCDA is obsolete and unmaintained - unless you are using a /really/
old version of Zope, you are likely to encounter much more serious
problems than this.

There is another free ODBC adapter (for Windows only) at: -

http://www.zope.org/Members/timmorgan/products/ZODBCDA/document_view

There is also an ADO adapter: -

http://sourceforge.net/projects/zadoda/

YMMV - I have not tried these, and both are early versions.

Finally there is the commercial eGenix product at: -

http://www.zope.org/Members/lemburg/mxODBC_Zope_DA

I /have/ worked with this one - on fact I earn my living with it, in
effect. Recommended.

HTH!


- --

Regards,

PhilK

Email: [EMAIL PROTECTED] / Voicemail  Facsimile: 07092 070518

Never increase, beyond what is necessary, the number of entities
required to explain anything --- William of Ockham (1285-1349)

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

iD8DBQFCjhgWuk+q3Pfz3LYRAmtRAJ996Zg8WQfAteyqOkvLXBlVnc79DQCePQc1
AOawgCkXSCz9Y58jf/4F/M8=
=lNzr
-END PGP SIGNATURE-
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db