[Zope] Startup process of zope

2011-06-29 Thread Marco Bizzarri
Hi all.

I'd like to know if the startup process of a Zope2 instance is documented
somewhere. I'm looking for a detailed description of what happens from when
I type ./bin/zopectl start in one zope instance to when I end with a number
of threads waiting to serve my requests.

Since I'm actually writing it, I'd like to know if I'm duplicating work from
someone else; in case someone already did some of this work, I'd be glad to
contribute, if there is any need to.

I'd also publish whatever I've written up to now (mostly notes taken
following the code), even though it is partial in italian (of course I'll
translate it first) and quite terse.

Regards
Marco

-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Forcing zope to preload objects in cache

2011-02-08 Thread Marco Bizzarri
Hi all.

I've a Zope application; response time in the application is quite different
if the cache is already loaded with data from the ZODB (a Data.fs served
over ZEO).

The Zope/ZEO server is restarted every night, so, the cache is emptied every
night, and the first users to access the objects in the morning suffer from
longer response times.

I'd like to force Zope to reload the cache; of course, I could access
various pages using a wget or something liket that; but how can I force Zope
to 'fill' all connections, and just one?

Regards
Marco


-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] UnicodeDecodeError from PageTemplate rendering after upgrading to Zope 2.12.7

2010-08-31 Thread Marco Bizzarri
On Tue, Aug 31, 2010 at 11:40 AM, Chris Withers ch...@simplistix.co.ukwrote:

 Hi All,

 After a recent upgraded to Zope 2.12, I'm now seeing errors like the
 following when using IE (version 8) or Safari (version 4.0.3) to view
 page templates. Chrome and Firefox work fine.

 Traceback (innermost last):
   Module ZPublisher.Publish, line 127, in publish
   Module ZPublisher.mapply, line 77, in mapply
   Module ZPublisher.Publish, line 47, in call_object
 snip
   Module Shared.DC.Scripts.Bindings, line 324, in __call__
   Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
   Module Products.PageTemplates.ZopePageTemplate, line 335, in _exec
   Module Products.PageTemplates.ZopePageTemplate, line 432, in pt_render
   Module Products.PageTemplates.PageTemplate, line 80, in pt_render
   Module zope.pagetemplate.pagetemplate, line 115, in pt_render
   Module zope.tal.talinterpreter, line 271, in __call__
 snip
   Module zope.tal.talinterpreter, line 343, in interpret
   Module zope.tal.talinterpreter, line 751, in do_insertStructure_tal
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position
 366: ordinal not in range(128)

 Has anyone seen this or anything similar before?
 Any solutions spring to mind?



Hi Chris.

No solution, actually, but I would suggest to sniff the traffic between you
and the server; I suspect different headers cause problems, here.

Regards
Marco



 cheers,

 Chris

 --
 Simplistix - Content Management, Batch Processing  Python Consulting
 - http://www.simplistix.co.uk
 ___
 Zope-Dev maillist  -  Zope-Dev@zope.org
 https://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
  https://mail.zope.org/mailman/listinfo/zope-announce
  https://mail.zope.org/mailman/listinfo/zope )




-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope] [JOB][OT?] Position for a Python/Zope developer in Pula, Cagliari (CA), Italy

2010-07-13 Thread Marco Bizzarri
Hi all.

Sorry if this is a little OT, but maybe someone could be interested:


`Liberologico Srl http://www.liberologico.com`__ (Pisa, PI, Italy)
 

 **Job Description**: Senior Software Developer

Liberologico is looking for an developer with good experience in Zope and
Python.
The developer will be responsible for porting a large IT application
developed with the Zope/Python/PostgreSQL stack to a cloud environment.

**What we expect you know**

 * computer science degree or better;
 * OOA/D (we expect at least you know use cases, design patterns and UML);
 * Python as an OOA/D language (not just for making scripts; we've a large
and complex application);
 * Zope, when developing Python-based products (not just TTW applications);
 * IDE tools (emacs does not count as an IDE; vi* neither; Eclipse+PyDev is
preferred);
 * Subversion and other version control systems (merge and branches,
tracking third-party code);
 * PostgreSQL (a little more than making queries like you would do with any
other database);
 * Linux system administration (you know how to make a script executable on
a Linux, don't you?);
 * Test-driven development
 * Unit-testing

**Where the work will take place**

 * Centro Polaris (http://www.sardegnaricerche.it/), Pula, Cagliari, Italy

 **Contact Info:**

 * **Contact**: Marco Bizzarri
 * **E-mail contact**: m.bizza...@liberologico.com
 * **No telecommuting**
==

-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] [JOB][OT?] Position for a Python/Zope developer in Pula, Cagliari (CA), Italy

2010-07-13 Thread Marco Bizzarri
On Tue, Jul 13, 2010 at 1:44 PM, Kristian Thy t...@42.dk wrote:

 On Tue, Jul 13, Stephan Richter wrote:
  On Tuesday, July 13, 2010, Marco Bizzarri wrote:
* IDE tools (emacs does not count as an IDE; vi* neither;
 Eclipse+PyDev is
   preferred);
 
  I am usually not commenting on things like that, but: What a turn off!
 This is
  one of the worst requirements I have ever seen. ;-)

 Yeah, that one had me shaking my head as well ...

 \\kristian
 --
 ... et nemo ex vobis interrogat me: »Quo vadis?«



Well, it's interesting to see such a reaction; we've seen steep learning
(and adapting) curve from an emacs/vi environment to an IDE like Eclipse;
since we're a development shop working on Eclipse for all our projects
(Java, PHP, Python), we required knowledge and practice of such a tool.

Anyway, I assure no emacs/vi guy got injured in writing this requirement ;)

Regards
Marco



-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] [JOB][OT?] Position for a Python/Zope developer in Pula, Cagliari (CA), Italy

2010-07-13 Thread Marco Bizzarri
On Tue, Jul 13, 2010 at 4:58 PM, Chris Withers ch...@simplistix.co.ukwrote:

 Marco Bizzarri wrote:


 I won't start a religious war on IDE editors :)


 You already did by putting such a ridiculous requirement in a job ad.

 Chris

 --
 Simplistix - Content Management, Batch Processing  Python Consulting
   - http://www.simplistix.co.uk




As I said before, I've no interest in starting such a war; you find this is
a ridiculous requirement: fine, you're more than entitled to have your
opinion.

Regards
Marco
-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Debugging conflict errors in (old) zope

2009-12-18 Thread Marco Bizzarri
Hi all.

I'm facing some of these conflicts:


ZODB.POSException.ConflictError
database conflict error (oid 0x03dc5870, class BTrees._OOBTree.OOBucket,
serial this txn started with 0x0382d2aa7ec19444 2009-12-18 10:18:29.708477,
serial currently committed 0x0382d2aac531e099 2009-12-18 10:18:46.217539)
  File /var/local/zope/base2891/lib/python/Zope2/App/startup.py, line 167,
in zpublisher_exception_hook
v.reraise()
  File /var/local/zope/base2891/lib/python/ZPublisher/Publish.py, line
120, in publish
transactions_manager.commit()
  File /var/local/zope/base2891/lib/python/Zope2/App/startup.py, line 233,
in commit
transaction.commit()
  File /var/local/zope/base2891/lib/python/transaction/_manager.py, line
84, in commit
self.get().commit(sub)
  File /var/local/zope/base2891/lib/python/transaction/_transaction.py,
line 381, in commit
self._saveCommitishError() # This raises!
  File /var/local/zope/base2891/lib/python/transaction/_transaction.py,
line 379, in commit
self._commitResources()
  File /var/local/zope/base2891/lib/python/transaction/_transaction.py,
line 427, in _commitResources
rm.tpc_vote(self)
  File /var/local/zope/base2891/lib/python/ZODB/Connection.py, line 637,
in tpc_vote
s = vote(transaction)
  File /var/local/zope/base2891/lib/python/ZEO/ClientStorage.py, line 893,
in tpc_vote
return self._check_serials()
  File /var/local/zope/base2891/lib/python/ZEO/ClientStorage.py, line 877,
in _check_serials
raise s

Set up is a python 2.3 + Zope 2.8 with ZEO; I've tried to figure what the
object is with a zopectl debug:

 app._p_jar[0x03dc5870]
Traceback (most recent call last):
  File stdin, line 1, in ?
  File /var/local/zope/base2891/lib/python/ZODB/Connection.py, line 207,
in get
p, serial = self._storage.load(oid, self._version)
  File /var/local/zope/base2891/lib/python/ZEO/ClientStorage.py, line 746,
in load
return self.loadEx(oid, version)[:2]
  File /var/local/zope/base2891/lib/python/ZEO/ClientStorage.py, line 769,
in loadEx
data, tid, ver = self._server.loadEx(oid, version)
  File /var/local/zope/base2891/lib/python/ZEO/ServerStub.py, line 192, in
loadEx
return self.rpc.call(loadEx, oid, version)
  File /var/local/zope/base2891/lib/python/ZEO/zrpc/connection.py, line
536, in call
raise inst # error raised by server
TypeError: invalid oid 64772208

The question now is: how can I debug such a problem? Of course, I thought I
could add some debug code in the _check_serials, but I'll do that just if
there is no other way.

Regards
Marco


-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Possible effects of a custom event logger on a running Zope instance

2009-07-14 Thread Marco Bizzarri
Hi all.

I'm planning to create a custom event handler for Zope; the handler,
on an Exception, will automatically open a ticket inside a trac
system.

It could happen of course that the site where the ticket are sent is
down. What could be the possible effect of this? Would the
raising/handling of the exception be compromised?

I could think to have the exception logged on a local file, and then
sent to the ticket system via a process external to Zope, but I wonder
if this is necessary.

Regards
Marco

-- 
Marco Bizzarri
http://code.google.com/p/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] is there a zope product for generating spreadsheets?

2009-05-05 Thread Marco Bizzarri
I could suggest taking a look at oood from erp5 project

http://www.erp5.org/HowToUseOood


it needs a little tweaking to work with calc files, but nothing impossible...

and it seems even stable...

Regards
Marco

On Tue, May 5, 2009 at 3:30 PM, Thomas Bennett bennet...@appstate.edu wrote:
 I don't know if there is a reason not to use this but no one has mentioned
 PyUNO.

 http://wiki.services.openoffice.org/wiki/Python

 From that page:
 OpenOffice.org ships with a python scripting language, version 2.3.4. This
 Python distribution comes with the Uno module which connects the UNO API with
 the python scripting language.

 I'm thinking it should allow you to read from a spreadsheet and then you would
 have to format output as you want.

 There are a lot of other links related to pyuno, I notice one is a tutorial.

 http://www.google.com/search?hl=enq=openoffice+3+pythonbtnG=Search

 and if you add 'calc' to the search you can narrow down the  search and find
 things like

 OpenOffice.org Utility Library, or ooolib in short, is actually more than one
 library module. Included are a Python module (ooolib-python) and a Perl module
 (ooolib-perl).

 The Python module is currently focused on Calc and can be used to create
 OpenDocument Format Calc spreadsheets.





 Thomas




 On Monday 04 May 2009 17:07:28 Krishnakant wrote:
 hello all,
 I am right now browsing through the grok tutorial and found it to be
 really amaising.

 I had been confused a few days regarding how I can put my application
 into zope.  Thanks to all you who patiently answered my queries.

 Now I am wondering whether there is a product which can generate
 spreadsheet like output for some typicle data such as balance sheets or
 ledgers (with cell merging capability)?

 I would also like to know if there is some way I am make grok integrate
 open office in a way that I can generate open office spreadsheets and
 send it to a browser or open it in some way?

 I know there is a python library called odfpy which can fill up
 spreadsheets with data, but I don't know whether similar things are
 possible with zope.

 I have searched but did not find some thing like this.

 so is any thing of the above possible?

 happy hacking.
 Krishnakant.


 ___
 Zope maillist  -  z...@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 )

 --
 ==
 Thomas McMillan Grant Bennett           Appalachian State University
 Operations  Systems Analyst            P O Box 32026
 University Library                                Boone, North Carolina 28608
 (828) 262 6587

 Library Systems Help Desk: https://www.library.appstate.edu/help/
 ==
 ___
 Zope maillist  -  z...@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 )




-- 
Marco Bizzarri
http://sf.net/projects/qt-asterisk/
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Weird undefined symbol: PyUnicodeUCS{2|4}_AsEncodedString errors

2009-02-18 Thread Marco Bizzarri
On Wed, Feb 18, 2009 at 12:00 PM, Chris Withers ch...@simplistix.co.uk wrote:
 Chris Withers wrote:
 ImportError: /usr/lib/zope2.9/lib/python/persistent/cPersistence.so:
 undefined symbol: PyUnicodeUCS4_AsEncodedString

 ImportError: /opt/Zope-2.9/lib/python/persistent/cPersistence.so:
 undefined symbol: PyUnicodeUCS2_AsEncodedString

 Having had a bit of a google, I found this post from Andreas:

 http://mail.zope.org/pipermail/zope3-users/2006-June/003791.html

 So it seems that python2.4 resolves to one python when cron is running
 and another when run from a shell of the same user.

 Has anyone seen this behaviour before or know what could cause it?

 cheers,

 Chris

 PS: I've solved this for now by changing python2.4 to
 /usr/local/bin/python2.4 in the control scripts, which seems to have
 done the trick.

 --
 Simplistix - Content Management, Zope  Python Consulting
- http://www.simplistix.co.uk

Is it possible that you've something in your .bash_profile or .bashrc
which manipulates the PATH environment variable?

The behaviour could be explained because cron could define and execute
your script using /bin/sh as the shell. Even though that one is a sym
or an hard link to /bin/bash, bash could behave like sh and not
reading the .bashrc or .bash_profile scripts before starting.

Hope this help

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Periodic task in a Zope 2 environment

2009-02-17 Thread Marco Bizzarri
On Tue, Feb 17, 2009 at 6:48 PM, Chris Withers ch...@simplistix.co.uk wrote:
 Marco Bizzarri wrote:

 Is there a better way to run such tasks in Zope 2 environments?

 Have a look at Stepper:

 http://www.simplistix.co.uk/software/zope/stepper

 ...and then actually *use* cron to trigger stepper ;-)

 Chris

 --
 Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk



Thanks, Chris, but I do not want to use cron... also because I can end
in environments where there is no cron ;)


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Periodic task in a Zope 2 environment

2009-02-16 Thread Marco Bizzarri
Hi all.

A little of background, before.

I need to run some tasks, inside a zope environment, in a periodic
way. Even though I could resort to using cron and wget, I do not like
the solution too much, also because it requires me to rely on
something completly external to the application to schedule the task
itsel (I need to update the cron to change how often a job is run...
).


Now, I can see I can run a task using zopectl run + a script. My
script would therefore be something like:

while True:
 do something
 sleep(for sometime)


of course, there are dozen of ways to write this in a better way, but
that is not the problem. My problem is understanding if it is possible
to run such a script via the zdaemon. Can anyone shred some light on
this topic?

Is there a better way to run such tasks in Zope 2 environments?

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Periodic task in a Zope 2 environment

2009-02-16 Thread Marco Bizzarri
On Mon, Feb 16, 2009 at 5:01 PM, Andreas Jung li...@zopyx.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1


 ClockServer (build-in of Zope). Check your zope.conf.

 - -aj


Thanks for answering, Andreas.

Is it reasonably safe to use Clock Server in Zope 2.8?

(( Reasonably safe = there are no obvious or very well known problems
in such a setup ))

Regards
Marco




-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Periodic task in a Zope 2 environment

2009-02-16 Thread Marco Bizzarri
On Mon, Feb 16, 2009 at 6:50 PM, Thierry Florac thierry.flo...@onf.fr wrote:

 Hi,

 I don't know if it's the best way, but I've implemented a cron like
 task base class for my Zope-2.9 instance, which :
  - is thread based
  - can launch operations in a cron like way
  - can act as the user of your choice.

 It doesn't actually provide any user interface to define task
 scheduling, but the main base class could probably be used as a good
 starting point ; at least, it works ;-).
 I can send you the source code on request...


  Thierry Florac

Hi, Thierry... thanks for sharing your ideas with me :)

I will be glad to look at your code, but first: which licence? Sorry,
but I do not have complete freedom
on this, so...

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Moving an application from Zope 2.8 to Zope 2.11

2009-02-16 Thread Marco Bizzarri
Hi all.

Following the advices I received about upgrading the current release
of Zope, I'm moving an application from Zope 2.8 to Zope 2.11.

I've already solve some minor issues with other Products I have, but
now I would like to know how to handle this: I'm using Localizer
inside the application, and TranslationService Product to proviide
i18n namespace to PageTemplates. However, I think TransationService
should not be used anymore in Zope 2.11, as there should be some other
way to handle this stuff.

Can anyone provide pointers?

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Stepper1.5.0 failed to run

2008-10-16 Thread Marco Bizzarri
, in ?

 Globals.default__class_init__(Owned)

 File
 /home/toutpt/workspace/minitage/zope/plone25-guerir-dev/parts/zope2/lib/python/App/class_init.py,
 line 69, in default__class_init__

 AccessControl.Permission.registerPermissions(self.__ac_permissions__)

 File
 /home/toutpt/workspace/minitage/zope/plone25-guerir-dev/parts/zope2/lib/python/AccessControl/Permission.py,
 line 132, in registerPermissions

 Products.__ac_permissions__=(

 AttributeError: 'module' object has no attribute '__ac_permissions__'

 Have you any idea of what happens ?

 --

 JeanMichel FRANCOIS

 Makina Corpus

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





-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] A question about __setstate__ in Shared/DC/ZRDB/Connection.py

2008-09-20 Thread Marco Bizzarri
On Sat, Sep 20, 2008 at 8:21 AM, Dieter Maurer [EMAIL PROTECTED] wrote:
 Marco Bizzarri wrote at 2008-9-19 09:23 +0200:
 ...
I assume therefore that the ZPsycopgDA object has been ghostified,
during the transaction. But this assumption is not supported by any
evidence. In particular, it is not supported by my knowledge of the
internal behaviour of ZODB on objects during a single transaction.

Can anyone provide suggestion on this topic?

 Cache garbage collection can happen at savepoint time.
 Then, volatile attributes can be lost.

 There is an age old proposal
 http://wiki.zope.org/ZODB/VolatileAttributeLifetimeGarantee;
 which would allow to avoid this problem.

 As we use this feature since ages in our local Zope/ZODB
 version, I could provide an implementing patch (for ZODB 3.8).



 --
 Dieter



I'm working right now with Zope 2.8, which I don't think is running on
that version of ZODB; is is possible to backport such patch to Zope
2.8? I'm not asking to do the work, I'm just asking if, in theory, it
is possible to do it, or if it relies on something which has been
introduced in new releases of ZODB.

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] [Further investigations] Re: A question about __setstate__ in Shared/DC/ZRDB/Connection.py

2008-09-20 Thread Marco Bizzarri
On Sat, Sep 20, 2008 at 8:24 AM, Dieter Maurer [EMAIL PROTECTED] wrote:
 Tres Seaver wrote at 2008-9-19 09:33 -0400:
 ...
There is a special 'STICKY' state which prevents ghostifying, but it
can't be set from Python code.  You could, however, set '_p_changed' on
the connection at the beginning of the method, and then delete it at the
end:  changed objects can't be ghostified.  E.g.:

   def my_method(self):
   self.connection._p_changed = 1
   try:
   self.sql()
   # now do the stuff which used to ghostify the connection
   finally:
   del self.connection._p_changed

 Are you sure that this works?

 According to my (not very clear) memory, _p_changed in a C level attribute
 (that is definite) which could be set to 1 from application level
 but not reset (that is not sure).



 --
 Dieter
 ___



As I said in my previous post, I modified my test case to check if
this works, but I'm afraid it does not (i.e. I can still see two
connections at the database).

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] A question about __setstate__ in Shared/DC/ZRDB/Connection.py

2008-09-19 Thread Marco Bizzarri
Hi all.

I'm working on an application which uses Zope (2.8, at the moment) and
ZPsycopgDA (toghter with a number of other products).

While writing an acceptance test, I encountered a strange problem: the
test locks up.

A further investigation shown that there were two connections at the
database; one of them was not committed, the other one was blocked
waiting for the other to commit.

I therefore used the pdb in order to stop the execution of the test
inside the connect method of the ZPsycopgDA.DA. Once I had that
breakpoint, I was able to get the logs of the two transactions on the
database, and I had the confirmation that indeed there were two
different transactions.

So, I wondered what could possibily happen, I mean why during a test
there could be a second connect to the database.

I issued a bt to see the stack of calls leading to the connect, and
what I could see was that the coonect was called inside the
__setstate__ method of Shared/DC/ZRDB/Connection.py.

I assume therefore that the ZPsycopgDA object has been ghostified,
during the transaction. But this assumption is not supported by any
evidence. In particular, it is not supported by my knowledge of the
internal behaviour of ZODB on objects during a single transaction.

Can anyone provide suggestion on this topic?

Regards
Marco
-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] [Further investigations] Re: A question about __setstate__ in Shared/DC/ZRDB/Connection.py

2008-09-19 Thread Marco Bizzarri
On Fri, Sep 19, 2008 at 9:23 AM, Marco Bizzarri
[EMAIL PROTECTED] wrote:
 Hi all.

 I'm working on an application which uses Zope (2.8, at the moment) and
 ZPsycopgDA (toghter with a number of other products).

 While writing an acceptance test, I encountered a strange problem: the
 test locks up.

 A further investigation shown that there were two connections at the
 database; one of them was not committed, the other one was blocked
 waiting for the other to commit.

 I therefore used the pdb in order to stop the execution of the test
 inside the connect method of the ZPsycopgDA.DA. Once I had that
 breakpoint, I was able to get the logs of the two transactions on the
 database, and I had the confirmation that indeed there were two
 different transactions.

 So, I wondered what could possibily happen, I mean why during a test
 there could be a second connect to the database.

 I issued a bt to see the stack of calls leading to the connect, and
 what I could see was that the coonect was called inside the
 __setstate__ method of Shared/DC/ZRDB/Connection.py.

 I assume therefore that the ZPsycopgDA object has been ghostified,
 during the transaction. But this assumption is not supported by any
 evidence. In particular, it is not supported by my knowledge of the
 internal behaviour of ZODB on objects during a single transaction.

 Can anyone provide suggestion on this topic?

 Regards
 Marco
 --
 Marco Bizzarri
 http://notenotturne.blogspot.com/
 http://iliveinpisa.blogspot.com/


I did further investigation on the topic, and I think I've pinned the
problem. I don't know the solution, but I can reproduce the problem
with a small sample. Here is the sample:


import os
import sys
import unittest

if __name__ == '__main__':
execfile(os.path.join(sys.path[0], '../framework.py'))

from Testing import ZopeTestCase

from OFS import Image

from Products.ZPsycopgDA.DA import manage_addZPsycopgConnection
from Products.ZSQLMethods import SQL


class DoubleTransactionTest(ZopeTestCase.ZopeTestCase):

def _add_big_image(self, value, data):
Image.manage_addFile(self.app, f%06s % value, data , a title)

def test_showdouble(self):
manage_addZPsycopgConnection(self.app, db_connection, ,
host=localhost user=postgres dbname=template1)
self.app._setObject('sql', SQL.SQL(sql, , db_connection,
, select * from pg_tables))
self.app.sql()
data =  * * (1  20)
for x in range(1000):
self._add_big_image(x, data)
print Added %s  % x
self.app.sql()

if __name__ == '__main__':
unittest.main()


I'm doing three things here:

- creating a db connection
- making a query to the db (this causes a transaction to begin)
- creating a lot of big files (expecially, larger than 2 * 2 ^ 16 *)
- making another query to the db;

Once I create a big file I fall into the following branch inside the
OFS.Image._read_data


if size = 2*n:
seek(0)
if size  n: return read(size), size
return Pdata(read(size)), size

# Make sure we have an _p_jar, even if we are a new object, by
# doing a sub-transaction commit.
transaction.savepoint(optimistic=True)

This causes, at the end, to call the ZODB.Connection.savepoint which,
just before returning, calls a cacheGC to be called, which, I'm
afraid, causes the db_connection to be sent out of the cache itself,
thus leaving it without the _v_ attributes.

Hope this can help in giving suggestions.

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] [Further investigations] Re: A question about __setstate__ in Shared/DC/ZRDB/Connection.py

2008-09-19 Thread Marco Bizzarri
On Fri, Sep 19, 2008 at 3:33 PM, Tres Seaver [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Marco Bizzarri wrote:
 On Fri, Sep 19, 2008 at 9:23 AM, Marco Bizzarri
 [EMAIL PROTECTED] wrote:
 Hi all.

 I'm working on an application which uses Zope (2.8, at the moment) and
 ZPsycopgDA (toghter with a number of other products).

 While writing an acceptance test, I encountered a strange problem: the
 test locks up.

 A further investigation shown that there were two connections at the
 database; one of them was not committed, the other one was blocked
 waiting for the other to commit.

 I therefore used the pdb in order to stop the execution of the test
 inside the connect method of the ZPsycopgDA.DA. Once I had that
 breakpoint, I was able to get the logs of the two transactions on the
 database, and I had the confirmation that indeed there were two
 different transactions.

 So, I wondered what could possibily happen, I mean why during a test
 there could be a second connect to the database.

 I issued a bt to see the stack of calls leading to the connect, and
 what I could see was that the coonect was called inside the
 __setstate__ method of Shared/DC/ZRDB/Connection.py.

 I assume therefore that the ZPsycopgDA object has been ghostified,
 during the transaction. But this assumption is not supported by any
 evidence. In particular, it is not supported by my knowledge of the
 internal behaviour of ZODB on objects during a single transaction.

 Can anyone provide suggestion on this topic?

 Regards
 Marco
 --
 Marco Bizzarri
 http://notenotturne.blogspot.com/
 http://iliveinpisa.blogspot.com/


 I did further investigation on the topic, and I think I've pinned the
 problem. I don't know the solution, but I can reproduce the problem
 with a small sample. Here is the sample:


 import os
 import sys
 import unittest

 if __name__ == '__main__':
 execfile(os.path.join(sys.path[0], '../framework.py'))

 from Testing import ZopeTestCase

 from OFS import Image

 from Products.ZPsycopgDA.DA import manage_addZPsycopgConnection
 from Products.ZSQLMethods import SQL


 class DoubleTransactionTest(ZopeTestCase.ZopeTestCase):

 def _add_big_image(self, value, data):
 Image.manage_addFile(self.app, f%06s % value, data , a title)

 def test_showdouble(self):
 manage_addZPsycopgConnection(self.app, db_connection, ,
 host=localhost user=postgres dbname=template1)
 self.app._setObject('sql', SQL.SQL(sql, , db_connection,
 , select * from pg_tables))
 self.app.sql()
 data =  * * (1  20)
 for x in range(1000):
 self._add_big_image(x, data)
 print Added %s  % x
 self.app.sql()

 if __name__ == '__main__':
 unittest.main()


 I'm doing three things here:

 - creating a db connection
 - making a query to the db (this causes a transaction to begin)
 - creating a lot of big files (expecially, larger than 2 * 2 ^ 16 *)
 - making another query to the db;

 Once I create a big file I fall into the following branch inside the
 OFS.Image._read_data


 if size = 2*n:
 seek(0)
 if size  n: return read(size), size
 return Pdata(read(size)), size

 # Make sure we have an _p_jar, even if we are a new object, by
 # doing a sub-transaction commit.
 transaction.savepoint(optimistic=True)

 This causes, at the end, to call the ZODB.Connection.savepoint which,
 just before returning, calls a cacheGC to be called, which, I'm
 afraid, causes the db_connection to be sent out of the cache itself,
 thus leaving it without the _v_ attributes.

 Hope this can help in giving suggestions.

 Thanks for digging further into it;  I couldn't imagine how that was
 occurring.  In this case, the large number of created Pdata objects (one
 per 64k chunk of each of your images) are causing your connection object
 to be evicted from the cache at one of the savepoints, and thus
 ghostified (which is where it loses its volatiles).

 There is a special 'STICKY' state which prevents ghostifying, but it
 can't be set from Python code.  You could, however, set '_p_changed' on
 the connection at the beginning of the method, and then delete it at the
 end:  changed objects can't be ghostified.  E.g.:

   def my_method(self):
   self.connection._p_changed = 1
   try:
   self.sql()
   # now do the stuff which used to ghostify the connection
   finally:
   del self.connection._p_changed

 It is a nasty workaround, but should help prevent the lockup.

 Tres.
 - --
 ===
 Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
 Palladion Software   Excellence by Designhttp://palladion.com
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFI06oM+gerLs4ltQ4RAgq8AJ9yTjrFTtIt+IEPtghZIX

[Zope] Fwd: [Further investigations] Re: A question about __setstate__ in Shared/DC/ZRDB/Connection.py

2008-09-19 Thread Marco Bizzarri
On Fri, Sep 19, 2008 at 4:15 PM, Tres Seaver [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Marco Bizzarri wrote:

 Thanks for the suggestion, Tres, I'm trying it right now.

 I think this could be responsible for the problem I had a few months
 ago, under the name: Asking advice on a Zope stuck (or: what did I
 do wrong?)

 Do you think there will be some sort of general solution to the
 problem? I mean, the problem is actually that there are some objects
 which should not be ghostified, or am I wrong?

 There are two problems here:

  - Some objects need to be able to mark themselves as sticky for
   at least the duration of a transaction;  my workaround is hackish,
   because if you omit the 'del conn._p_changed' it causes the object
   to be written needlessly;  likewise, if the conn object *is* actually
   written to during the transaction, those changes will be discarded.

I'm afraid the workaround is not working for me; I've modified the
test as follows:


class DoubleTransactionTest(ZopeTestCase.ZopeTestCase):

   def _add_big_image(self, value, data):
   Image.manage_addFile(self.app, f%06s % value, data , a title)

   def test_showdouble(self):
   manage_addZPsycopgConnection(self.app, db_connection, ,
host=localhost user=postgres dbname=template1)
   self.app._setObject('sql', SQL.SQL(sql, , db_connection,
, select * from pg_tables))
   self.app.db_connection._p_changed = 1
   self.app.sql()
   data =  * * (1  20)
   for x in range(1000):
   self._add_big_image(x, data)
   print Added %s  % x
   self.app.sql()

But I can still see two transactions (I'm not bothering about removing
the _p_changed flag, because this is a one shot test, just to see if
it works... maybe I'm putting this in the wrong place).


  - We need a way to keep the Pdata objects from evicting precious
   objects;  ideally, Pdata instances would never be added to the cache
   at all.  I worked a bit on a spike in which the Pdata iterator part
   would use a one-off connection with a zero-sized cache, but got
   stuck somewhere;  maybe somebody else can make it work.

I would be glad to help, but my current understanding on inner Zope
are not good enough (and my free time is even less ;))


 Tres.
 - --

Do you mind if I forward this to ML?

Regards
Marco
--
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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 access the content of a file in a test suite in a portable way

2008-09-17 Thread Marco Bizzarri
Hi all.

I'm writing a number of acceptance tests where I need to compare
whether the content of a text file is equals to another file.

The comparision files are in a subdirectory of the acceptance test
directory itself, therefore, once I know where my product is on the
filesystem, I can access the test files from there.

What is the accepted way to do know the directory of a product?

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] How to access the content of a file in a test suite in a portable way

2008-09-17 Thread Marco Bizzarri
On Wed, Sep 17, 2008 at 12:58 PM, Peter Bengtsson [EMAIL PROTECTED] wrote:
 From within the product class you can do this:

 from Globals import package_home
 class MyProduct(...):
meta_type = '...'
def do_something(self):
 print package_home(globals())




Thanks, Peter; but that does not work inside a test case run as:

python tests/testMyTestSuite.py


I'm using at the moment:


def product_prefix(self):
return sys.modules['Products.MyProduct'].__path__[0]


but I'm not sure if it is an horrible hack or now.

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Using page templates to generate large XML files

2008-09-06 Thread Marco Bizzarri
Hi all.

I need to generate a large XML file inside a Zope application; the
file is for backup purposes, so it is stored on the server and can be
downloaded later with whatever suitable tool.

The data are taken from a database, and then they are used to create
the XML. I assume there will be between 40.000 and 100.000 rows to be
dumped.

I thought i could use page template for this purpose, but I'm not sure
if it is possible to send the output from a pt to a file, directly. Of
course, this is a problem which can be easily solved.

I wonder however if the PT has to generate the whole XML in just one
step; in that case, maybe I should resort to use PT on one row at
time, and write the data to different files.

Thanks for your time.

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Using page templates to generate large XML files

2008-09-06 Thread Marco Bizzarri
On Sat, Sep 6, 2008 at 8:36 AM, Andreas Jung [EMAIL PROTECTED] wrote:


 --On 6. September 2008 08:26:17 +0200 Marco Bizzarri
 [EMAIL PROTECTED] wrote:

 Hi all.

 I need to generate a large XML file inside a Zope application; the
 file is for backup purposes, so it is stored on the server and can be
 downloaded later with whatever suitable tool.

 The data are taken from a database, and then they are used to create
 the XML. I assume there will be between 40.000 and 100.000 rows to be
 dumped.

 I thought i could use page template for this purpose, but I'm not sure
 if it is possible to send the output from a pt to a file, directly. Of
 course, this is a problem which can be easily solved.

 If you're using Zope 2.10 or higher, you can either use the native  ZPT
 implementation from Zope 3 (see zope.pagetemplate module) or you use the
 Zope 2 implementation (which is basically only a wrapper around the Z3
 implementation). In this case you might look at the unittests in
 testZopePageTemplates.py or otherwise you check the doctests of
 zope.pagetemplate.

 -aj

Thanks, Andreas. I'm using Zope 2.8, here (yes, I know it is old
software; yes, I know, I should switch; yes, I will do soon, I promise
:-) ))

I will see what I can accomplish with what I have.

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Styles of import in Zope (2 and 3)

2008-08-31 Thread Marco Bizzarri
On Sun, Aug 31, 2008 at 3:04 AM, Chris McDonough [EMAIL PROTECTED] wrote:
 One goal to shoot for when you do imports is to be able to remove an imported
 name by deleting a line as opposed to editing one (it makes reading diffs a 
 bit
 easier).  E.g. instead of:

  from foo import one, two, three

A lot of this in my code :-(

 I usually either do:

  import foo
  foo.one

Yes, I'm looking into this.

 Or:

  from foo import one
  from foo import two
  from foo import three

Too many of them... maybe an hint I should refactor something :-) ?

 Either way makes diffs cleaner.

 One thing I always avoid is from foo import *.

At least, I've avoided this sin ;)

 - C




-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.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] Styles of import in Zope (2 and 3)

2008-08-30 Thread Marco Bizzarri
Please, feel free to point me to The Fine Manual to read, if this has
been answered and written many times.

After reading the article Importing Python Modules
(http://effbot.org/zone/import-confusion.htm), I had many doubts about
the style to use in imports in Zope 2 and Zope 3.

The article points to a style which should be:

from package.subpackage import module

and then use

module.MyClass

Is this the recomended style in Zope2/3 also?

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Styles of import in Zope (2 and 3)

2008-08-30 Thread Marco Bizzarri

 Is this the recomended style in Zope2/3 also?

 PEP8 tells you:

 http://www.python.org/dev/peps/pep-0008/

 -aj

Yes, I've read it; but PEP8 seems not to prescribe any particular
style over the other. Is there any other place where the topic is
addressed?

Regards
Marco
-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/
http://notenotturne.blogspot.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] Asking advice on best way to perform an interaction with an external webservice

2008-08-03 Thread Marco Bizzarri
On Sat, Aug 2, 2008 at 11:36 AM, Andreas Jung [EMAIL PROTECTED] wrote:


 --On 2. August 2008 10:11:10 +0200 Marco Bizzarri [EMAIL PROTECTED]
 wrote:

 Dieter, thanks for your answer.

 I've to implement a SOAP client, and I wonder  how to interact with
 the external webservice from a transactional point of view: I don't
 want to call twice the same service because of ZPublisher redoing
 transactions, and this sort of things.

 The transaction module or the ZODB provides a post-commit hook.

 -aj


Thanks Andreas; I assume the post-commit hook is not available in the
Zope 2.8 world, am I right? (In the meantime, Marco writes another
+1 to the item on his checklist named porting to Zope 2.10)



-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Asking advice on a Zope stuck (or: what did I do wrong?)

2008-08-02 Thread Marco Bizzarri
Hi all.

While using ab to perform stress tests on an application, I've run in
a situation where I have a locked Zope.

I installed DeadlockDebugger, and tried to have a dump from it, but it
is unable to answer, at leasts it seems to me.

So, I followed the recipe from ZopeLabs:

http://www.zopelabs.com/cookbook/1073504990

and got a traceback from gdb.

info threads gives the following:

* 5 Thread 0xb5b29b90 (LWP 17713)  0xe410 in __kernel_vsyscall ()
  4 Thread 0xb5322b90 (LWP 17714)  0xe410 in __kernel_vsyscall ()
  3 Thread 0xb4b21b90 (LWP 17715)  0xe410 in __kernel_vsyscall ()
  2 Thread 0xb4320b90 (LWP 17716)  0xe410 in __kernel_vsyscall ()
  1 Thread 0xb7d4b8c0 (LWP 17687)  0xe410 in __kernel_vsyscall ()


I'm including the traceback. As you can see, the last lines tell (for
all the threads) are:


  File /var/local/zope28/base288/lib/python/Shared/DC/ZRDB/Results.py,
line 55, in __init__
if n != name: aliases.append((n, SQLAlias(name)))
  File string, line 1, in ?


Just one note: environment is Linux, Zope 2.8.8, python2.3

I understand Zope+python is quite old, so I'm just asking if there is
some general purpose advice on what to do in this case.

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/


tb
Description: Binary data
___
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] Asking advice on best way to perform an interaction with an external webservice

2008-08-02 Thread Marco Bizzarri
Dieter, thanks for your answer.

I've to implement a SOAP client, and I wonder  how to interact with
the external webservice from a transactional point of view: I don't
want to call twice the same service because of ZPublisher redoing
transactions, and this sort of things.

Regards
Marco

On Sat, Aug 2, 2008 at 9:59 AM, Dieter Maurer [EMAIL PROTECTED] wrote:
 Marco Bizzarri wrote at 2008-8-1 14:57 +0200:
I need to implement an interaction with an external web service.

The external webservice basically can either provide or accept
messages from my zope application. The messages are either produced by
my application (and need to be sent to the external application via
web service) or produced by the external application, and must be
processed by mine.

 When your application is the client (sent), then you
 can use any of Python frameworks (e.g. ZSI, soaplib) to
 interface between Python and the webservice (I fear all these
 frameworks by now support only SOAP 1.1, not the current
 SOAP 1.2).

 When your application must act as server, you have
 several options (all including some webservice framework)

  * set up an additional (non-Zope) server with the support
of the above mentioned frameworks, let it implement
the services.

If the service needs to access ZODB data, it may
be implemented as a ZEO client (this means, that
you must use ZEO as storage provider for both
your Zope and your service).

  * implement WebService demarshalling/marshalling
in a Zope object. Then, the demarshalling happens
when the Zope object is traversed. Traversal also
changes the response to perform the demarshalling
of the result.

This requires some fix of ZPublisher (as it stupidly
interprets each POST with content-type text/xml als
an XML-RPC request.

  * implement an SOAP ZServer

 The first option is probably the easiest.

 We have implemented the second option. The following list
 demonstrates the complexity in terms of lines, words and characters:

 newdm: wc *.py
189 6506709 Marshalling.py
 10  20 197 Permissions.py
 27  71 745 ReprRpc.py
110 3933727 Response.py
 47 1281286 RpcType.py
161 6135097 SoapRpc.py
132 5174593 WsdlRpc.py
208 7216645 XmlRpc.py
 19  46 464 __init__.py
 86 3222667 utils.py
9893481   32130 total


 The third option is probably the most difficult one.



 --
 Dieter




-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Asking advice on best way to perform an interaction with an external webservice

2008-08-01 Thread Marco Bizzarri
Hi all.

I need to implement an interaction with an external web service.

The external webservice basically can either provide or accept
messages from my zope application. The messages are either produced by
my application (and need to be sent to the external application via
web service) or produced by the external application, and must be
processed by mine.

I'm asking then for best practice for this sort of interaction.

Following what I have read in other threads, I would assume that, for
example for sending, I should do something like:

- create a queue of objects which needs to be sent, in one transaction;

- sent the objects which need to be sent, in another transaction;

The problem, of course, is to minimize (if not avoid at all) the
chance to have a Conflict with a double sending of the message. In
some sense, this is very close to sending an email via an smtp server,
therefore, I assume I should at the right products to look for
inspirations.


Thanks you all for your time.


Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Asking recipe for caching objects

2008-08-01 Thread Marco Bizzarri
Hi all.

I have a zope application which uses a db (postgreSQL) to store and
retrieve data. I would like to cache it.

It is ok for me to cache them on thread-base. Up to now I've used a
simple _v_ attribute, with a dictionary.

The approach works, but:

- the _v_ attribute is not transactional (and transactions could be
rerun due to conflicts),
- the dictionary can grows indefinitively.

Therefore, I'm looking to see if there is a ready solution for this problem.

Thanks you all in advance for your advice

Regards
Marco





-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Asking recipe for caching objects

2008-08-01 Thread Marco Bizzarri
Thanks for your suggestions, Andreas.

Any chance these are going to work under Zope 2.8?

Regards
Marco

On Fri, Aug 1, 2008 at 4:04 PM, Andreas Jung [EMAIL PROTECTED] wrote:


 --On 1. August 2008 15:55:41 +0200 Marco Bizzarri [EMAIL PROTECTED]
 wrote:

 Hi all.

 I have a zope application which uses a db (postgreSQL) to store and
 retrieve data. I would like to cache it.

 It is ok for me to cache them on thread-base. Up to now I've used a
 simple _v_ attribute, with a dictionary.


 Therefore, I'm looking to see if there is a ready solution for this
 problem.

 gocept.cache
 plone memoize

 ?

 -aj



-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Best policy to assign policy to assign ids to objects inside BTreeFolder2

2008-07-07 Thread Marco Bizzarri
Hi all.

I need to create a number of objects inside a BTreeFolder2 container.

I would like to minimize the chances of conflicts, so I'm exploring
possibilities to assign ids; up to now I've found the following:

- timestamps
- random numbers

What is the best choice to reduce the chances of conflicts?

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] ZODB and Zope Database Adapters

2008-06-19 Thread Marco Bizzarri
Hi all.

In the doc/ZODB3.txt of Zope 2.8 (and Zope 2.9) I've found the
following paragraph.


  ZODB 3 and Zope Database Adapters

Most database adapters are *currently* likely to be problematic unless
the underlying extensions and libraries:

  - allow multiple simultaneous database connections,

  - are thread safe,

  - give up the Python global interpreter lock when
making database calls.

This is only a problem when running Zope 2 with multiple
threads.

I would like to know if anyone has experience of some of these
problems with psycopg 1.1 and ZPsycopgDA

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Python instance growing while ZTC

2008-06-12 Thread Marco Bizzarri
Hi all.

Apologies in advance if my question has a somewhat obvious answer.

I'm working on a Zope application, developed as a python product.

I've ZTC in place for this application. While I run all the ZTC, I can
see python process size growing. Can I use this as an indication of a
leak of resources in my application?

Thanks in advance for your attention.

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Marco Bizzarri
Hi all.

I need to query a ZCatalog, and I would like to know how many elements
are there. I'm working from inside a python product, so, I could do
something like:

results = Catalog(criteria)
return len(results)


But this creates a number of objects which are completly useless for
me. After all, I'm interested in just the length, not in the objects.

I could do something like this:

results = Catalog(criteria, sort_limit=1)
return results.actual_result_count

since I should have a LazyMap, which does not (should not) actually
load all the objects (at least, I hope so).

This does not work if I have no result. So, what I should do would be:

results = Catalog(criteria, sort_limit=1)
if len(results) == 0:
return 0
return results.actual_result_count

Am I missing something?

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Marco Bizzarri
On Thu, Jun 5, 2008 at 1:28 PM, Janko Hauser [EMAIL PROTECTED] wrote:

 Am 05.06.2008 um 12:56 schrieb Marco Bizzarri:

 Hi all.

 I need to query a ZCatalog, and I would like to know how many elements
 are there. I'm working from inside a python product, so, I could do
 something like:

 results = Catalog(criteria)
 return len(results)


 But this creates a number of objects which are completly useless for
 me. After all, I'm interested in just the length, not in the objects.

 I could do something like this:

 results = Catalog(criteria, sort_limit=1)
 return results.actual_result_count

 since I should have a LazyMap, which does not (should not) actually
 load all the objects (at least, I hope so).

 This does not work if I have no result. So, what I should do would be:

 results = Catalog(criteria, sort_limit=1)
 if len(results) == 0:
   return 0
 return results.actual_result_count

 Am I missing something?

 Yes, you do the expensive operation just for the test, so there is no
 benefit.

 if result:
   result_len = results.actual_result_count
 else:
   result_len = 0

 return result_len

 HTH,

 __Janko

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



Hi, Janko.

Thanks for your answer, but there is something I do not understand:

if results:

an empty result from ZCatlog is false in a boolen condition?


Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Marco Bizzarri
On Thu, Jun 5, 2008 at 3:35 PM, Tino Wildenhain [EMAIL PROTECTED] wrote:
 Hi,

 Marco Bizzarri wrote:
 ...

 if result:
  result_len = results.actual_result_count
 else:
  result_len = 0

 return result_len

 ...

 Thanks for your answer, but there is something I do not understand:

 if results:

 an empty result from ZCatlog is false in a boolen condition?

 Yes, thats standard Python behavior, empty lists, dictionaries
 and similar objects are assumed False when used as boolean.

 This means you could even write it this way:

 return (results and results.actual_result_count) or 0

 in python2.5 (not yet supported by Zope) even:

 return results.actual_result_count if results else 0

 Cheers
 Tino




Tino, Janko, thanks for the clarification. I understand the standard
behaviour of list and tuples. But what a Catalog returns is not (if I
understand it correctly) a list or a tuple, even though it presents as
such. It is a subclass of Lazy. Is Lazy behaving like a list or a
tuple, in this respect?

Regards
Marco




-- 
Marco Bizzarri
http://iliveinpisa.blogspot.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] Unit Testing DTML and ZPT

2007-07-26 Thread Marco Bizzarri

On 7/26/07, Chris Gray [EMAIL PROTECTED] wrote:

 Is there any standard way of unit testing the two page templating
methods in Zope 2?

Chris



If you're trying to test the output produced by a dtml/zpt, you could
try to invoke it, inside a zopetestcase.

Something like:

self.app.index_html = PageTemplateFile(path_to_your_template, globals())

x = self.app.index_html();

self.assertEquals(some_string, x);

I'm using here PageTemplateFile, but you can do it with standard
ZopePageTemplate.

The problem is what you're trying to test (and, therefore, to assert).
Checking for equality is too fine grained, where you would check for
the structure of the zpt, for example. A little parser could be
useful.

Regards
Marco


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Zope 2 Development Best Practices

2007-04-14 Thread Marco Bizzarri

On 4/13/07, Edward Pollard [EMAIL PROTECTED] wrote:

Greetings,

A few years back our institution adopted Zope to support some CMS-like
development on a zero-dollar budget. We achieved our primary goals in no
time at all, and we very happy.

Since that time we have used Zope to deliver a number of solutions to our
organization.

However, as the complexity of our operation increases, it becomes more and
more apparent that our coding standards for Zope are very low. We've leaned
on the existing Zope community - adopting code, borrowing ideas, trying to
learn - but have never seen anything that helps us better understand the
philosophy and structure that would underly a strong understanding of
Zopishness.

For instance, here are a few gems from our playbook. Please note first that
everything works to our needs and we are trying to find a way out of the
darkness. We're smart folks, but I fear we have strayed far from the path of
wisdom and light.

- We have never developed a python based product, although we have hung a
gigantic amount of external methods off of a half dozen pages to make it go.
And yes, we use ZClasses (shock)

- We have solved problems by modifying the ZServer source code.

- We have developed entire database driven products inside external methods.

- Every Z SQL Method we have has a python script associated with it to
massage input and output (and manually enforces security).

Of course, a google of Zope Best Practices just brings me a bunch of Plone
development stuff. That is of no use.

So where is the knowledge I seek to be found? Understanding that open source
products are prone to such abuses, I've not been able to find anything as a
starting ground to reform our ways.

Thanks in advance.


--
Edward J. Pollard, B.Sc.
Webmaster
Information Technology | WEB Team
University of Lethbridge
e. [EMAIL PROTECTED]
p. 403-380-1828



If you don't have already read, take a look at a thread named
something like Smart development. I sent some suggestions for
development in teams on Zope, and I hope you will find them useful.

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.com/
___
Zope maillist  -  [EMAIL PROTECTED]
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] [Ann] analyseObjects: analyse live objects

2007-04-11 Thread Marco Bizzarri

On 4/11/07, Dieter Maurer [EMAIL PROTECTED] wrote:

Halle Marco,

Marco Bizzarri wrote at 2007-4-10 21:41 +0200:
 ...
am I missing something, or the code is not on the web?

I tried and it was there...




My apologies: yesterday I was unable to find it. Next time I will ask
someone to check for me before sending to the ML.

(BTW: thanks for analyseObjects :-) )

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] [Ann] analyseObjects: analyse live objects

2007-04-10 Thread Marco Bizzarri

On 4/10/07, Dieter Maurer [EMAIL PROTECTED] wrote:



More information and download:

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




Hi Dieter,

am I missing something, or the code is not on the web?

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] smart development debugging

2007-03-25 Thread Marco Bizzarri

On 3/25/07, Roberto Scelzo [EMAIL PROTECTED] wrote:


Hi all,
we are developing a couple of zope apps which now
are becoming pretty complex and, unfortunately,
up to now we're developing TTW since we
haven't yet find
a smart  fast way to do our job avoiding the ZMI.
We've searched a lot around but never found a nice guidence or howto...

It'll be nice to develop by eclipse...
Anyways, since the last upgrade (zope 2.9) even the external editor
doesn't work anymore. (sob...)

Someone suggested us to use a FS dump product, another one instead pointed
us
to zope FS products, but, is there any
article/howto on how to make group development/debugging of middle/large
sized zope apps
a nice and confortable experience?

Thank you!
Roberto



It depends a lot on what you're looking for. You have a number of
different challenges, when you have a team working on a medium to
complex Zope application. I can provide some suggestions based on our
experience with PAFlow, which is the largest application we've
developed so far.

1) develop your application as one or more file system based product;

2) once your application is a file system based product, set up an
svn/cvs for your team;

3) give one or more instance to each of your developer, where he/she
can deploy the application and test it without interfering with the
work of the others; deploy your products inside the Products directory
of the instance, not inside the general Products directory;

4) use Eclipse + PyDev as a development environment;

5) keep in mind that while you're developing your application it will
happen that you will have to test with different releases of Zope, and
you should be able to do so in a simple way.

Hope this can help. I can provide more details on our working
enviroment, if you're interested.

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Understanding LeakFinder output

2007-03-24 Thread Marco Bizzarri

Hi all.

I'm using LeakFinder product in order to hunt some memory leaks in my
application. Before I can do that, however, I need support in order to
understand the output of LeakFinder itself.

I'm posting here a snippet of example code I'm using to understand.

   def createInterface(self, interface_id, *p, **kw):
   if test_folder_XXX in self.objectIds():
   test_folder_XXX = getattr(self, test_folder_XXX)
   self._delObject(test_folder_XXX)
   del test_folder_XXX
   self.manage_addFolder(test_folder_XXX)

The snippet is silly, but I'm using it to test.

Now, I run Zope (2.7.8), and run 1000 invocations of this code from an
external client (using urlopen).

Then, I take a look at LeakFinder:

  Class References  Change from
reference sample
Persistence.PersistentMapping   35590
OFS.Folder.Folder   18170

Now, according to what I can understand, there are 1817 references.
This is strange to me, since I've removed the folder object, and then
I've actually deleted the object. Of course, there is something which
is not clear to me. I would be grateful if someone can clarify the
subject.

Regards
Marco
--
Marco Bizzarri
http://iliveinpisa.blogspot.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] How can run multiple query in an Z sql method

2007-03-09 Thread Marco Bizzarri

On 3/9/07, Jary Busato [EMAIL PROTECTED] wrote:


 Yes, I must do it when I need to know an autonumber PK after an insert.
 when DB support transaction i write:

 begin transaction
 insert foo into bar
dtml-var sql_delimiter
SELECT LAST_INSERT_ID() as lastid
 commit

 Then, a DTML method:

 dtml-in myZSQLinsertandselect()
  dtml-var lastid
 /dtml-in

 Make the insert and write the id returned by the select.

 Illorca



This is not good. Keep in mind that Zope transaction management can
cause your full transaction to be aborted and reissued if there is a
conflict during it; this will normally result in a transaction being
aborted on the database, and reissued.

In other words, you could end with something like:

-- your request
begin (issued by Zope)
sql statemnets
conflict detected
abort (issued by Zope)
begin (issued by Zope)
(again) sql statements
commit (issued by Zope)
-- your response

Issuing an explicit commit inside this can cause very strange
behaviour in your application.

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] How can run multiple query in an Z sql method

2007-03-09 Thread Marco Bizzarri

On 3/9/07, Jary Busato [EMAIL PROTECTED] wrote:

If I understood you're telling me that begin and commit statements are
redundant.


Yes, exactly: they are issued by Zope at the boundaries of a transaction.


Sometimes conflicts are not correctly managed by ZTM (no rollbacks in db)


Are you using a non-transactional database (like old MySQL version)?


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] How can run multiple query in an Z sql method

2007-03-09 Thread Marco Bizzarri

On 3/9/07, Jary Busato [EMAIL PROTECTED] wrote:

Marco Bizzarri ha scritto:
 On 3/9/07, Jary Busato [EMAIL PROTECTED] wrote:
 If I understood you're telling me that begin and commit statements are
 redundant.

 Yes, exactly: they are issued by Zope at the boundaries of a transaction.

 Sometimes conflicts are not correctly managed by ZTM (no rollbacks in
 db)

 Are you using a non-transactional database (like old MySQL version)?


sql server with ZODBC



Sorry, I don't have direct experience with it. However, IIRC, ZODBC is
quite old and could have some problems. I would suggest you to invest
a few Euros in mxODBC: I've never tried it but Egenix has a good
record of producing good products.

Regards
Marco


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Re: zope unresponsive

2007-02-27 Thread Marco Bizzarri

On 2/27/07, Paul Williams [EMAIL PROTECTED] wrote:



Tres Seaver wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Paul Williams wrote:
 Ok, here is what we have.  I did a netstat on both machines, client and
 server.  The client sees and established connection and the server does
 not.  In the server log there is a disconnect.  As far as hardware
 between them, there is a switch (dell powerconnect 6024).  Web Server
 Directors might get hold of it but there are no hops on traceroute.
 Traceroute only shows the client machine and the server machine.

 So the client is just continuously polling the connection but getting
 nothing back.

 That sounds like some weird kernel / networking problem to me:  I don't
 see how Zope could be able to keep calling 'select' on a socket after
 the other side has closed it.

We agree.  This is a strange situation that none of us have seen before.

However, we have until tomorrow to do something and replacing hardware
is not feasable.



 Is there any possibility that some kind of failover / IP takeover has
 happened, such that the storage server now running is not the same host
 / instance as the one to shich the clients originally connected?  Are
 you using LVS + heartbeat, or some kind of hardware load balancer to
 manage such redundancy?

We do have Web Services Directors that do load balancing, but in this
particular case, the storage server is not setup for load balancing, I
am not aware of any features that make the zodb capable of clustering
except for replication services offered through zope.

We are not sure whether the traffic is going to the Web Services
Directores or not.  Even if it is, there are thousands of settings and
there is no-one available that knows what to change.


The storage server is a simple nas server with a static ip address.


 What we are thinking about doing is changing the code in
 zrpc/connection.py to close the connection in wait (line 638 zope
 version 2.9.5) if the wait time gets too large or the poll has happened
 too many times.

 We are great at plone development, but have very little backend zope
 development.  Would someone please advise me as to whether this is going
 to cause more problems?

 According to the log message you posted earlier in the thread, your
 appservers are spewing thousands of log messages from the connection's
 'pending' method, although your deadlock debugger output shows the one
 thread blocked on 'select' inside of the connection's 'wait' method.
 There should be lots of log messages at TRACE level for the wait call,
 including a doubling / backoff of the delay value from 1 mx to 1 sec.
 Do you see those log messages, as well?

These messages are there.  You can see the time doubling.  This is where
we were thinking of breaking the connection once it gets to a certain
point and make zope reconnect.

This solves our hung connection problem, we think.  However, I am hoping
someone can let me know if I am breaking something else by doing this.




I don't remember if you already mentioned it. However: did you tried
to monitor the traffic outgoing and incoming? I mean, setting some
iptables rules and/or using something like tcpdump to monitor what is
going on here?

Regards
Marco


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] zope unresponsive

2007-02-24 Thread Marco Bizzarri

On 2/24/07, Paul Williams [EMAIL PROTECTED] wrote:





I have posted this several times, but have not until now been able to get
DeadlockDebugger installed.  I see several people have had this problem, but
no-one has posted a solution.



I don't know if that can be the case, but is there a firewall between
your Zope and your ZEO? I remember some discussions about firewalls
between Zope and ZEO which could cause problems...

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Resizing an Image with PIL via a Form Upload

2007-02-22 Thread Marco Bizzarri

Jusst a shot in the dark: can you try to use a name without a dot inside?
--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart graphic package in python

2007-02-19 Thread Marco Bizzarri

On 2/17/07, Bill Campbell [EMAIL PROTECTED] wrote:

On Sat, Feb 17, 2007, Marco Bizzarri wrote:
On 2/17/07, Bill Campbell [EMAIL PROTECTED] wrote:
On Sat, Feb 17, 2007, Marco Bizzarri wrote:
Hi all.

I'm looking for an alternative to python gdchart for barchart/piechart
in a web application. I'm looking to python gdchart 2, but I'm not
sure on the status of maintenance of the project itself.

I like gnuplot which makes it pretty easy to create a wide
variety of plots.


I know gnuplot; what is the support for python?

I use it extensively in conjunction with python, buiding gnuplot files and
data that are then used to generate image files.



Ok, I took a look at it. However, my problem is that it forces me to
install gnuplot also (am I wrong?)

Since I'm working on a vertical product, which is already complex to
install, I would avoid adding another tool...

Thanks for your feedback, anyway.

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart graphic package in python

2007-02-19 Thread Marco Bizzarri

On 2/18/07, Richard Jones [EMAIL PROTECTED] wrote:



 I know gnuplot; what is the support for python?

Google. gnuplot python

It's not hard.


Richard


It's a lot harder to avoid making posts like this. If all that I
needed was to get some package for creating charts using python (and
Zope) , I could have completly avoided my post. What I was looking for
(and most of the person which answered did) was to have someone which
actually used the packages, or, better, were using it at the moment.

I can see that there is a package for python with gnuplot. But is it
used? Is it stable? Have it been used inside Zope environment?

Regards
Marco


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart graphicpackage in python

2007-02-19 Thread Marco Bizzarri

On 2/19/07, Jaroslav Lukesh [EMAIL PROTECTED] wrote:


 I can see that there is a package for python with gnuplot. But is it
 used? Is it stable? Have it been used inside Zope environment?

It is very hard to find something at new zope site from 2004

Try ZGDChart, it is simple and good




I tryied ZGDChart, and actually it is what we were using in the past.
But gdchart development has stopped, and using it is more and more a
problem.

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart graphic package in python

2007-02-19 Thread Marco Bizzarri

On 2/19/07, Martijn Pieters [EMAIL PROTECTED] wrote:

On 19. feb. 2007, at 14.29, Marco Bizzarri wrote:
 Yes, pychart looks good, even though I have too look at what is needed
 in order to have it run (PIL?)

Nope, pychart has no dependencies other than Python.

Martijn Pieters



Oh,  a pure python product ;)

That's great. I think I'm looking forward to make some tests with it.

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart

2007-02-19 Thread Marco Bizzarri

On 2/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

ChartDirector. Not open source, but very good and very affordable:

http://www.advsofteng.com/


--
Harlow Pinson
Indepth Learning
Email: [EMAIL PROTECTED]
Phone: 505 994-2135
Fax: 505 994-3603



Thanks, I would consider it for a non opensource project :-)


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart graphic package in python

2007-02-17 Thread Marco Bizzarri

Hi all.

I'm looking for an alternative to python gdchart for barchart/piechart
in a web application. I'm looking to python gdchart 2, but I'm not
sure on the status of maintenance of the project itself.

Can someone provide advice?

Regards
Marco


--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Suggestion for an opensource barchart/piechart graphic package in python

2007-02-17 Thread Marco Bizzarri

On 2/17/07, Bill Campbell [EMAIL PROTECTED] wrote:

On Sat, Feb 17, 2007, Marco Bizzarri wrote:
Hi all.

I'm looking for an alternative to python gdchart for barchart/piechart
in a web application. I'm looking to python gdchart 2, but I'm not
sure on the status of maintenance of the project itself.

I like gnuplot which makes it pretty easy to create a wide
variety of plots.



I know gnuplot; what is the support for python?

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Migrating the OpenFlow project from Zope 2.7.x to 2.9.x (and 2.10.x)

2007-02-10 Thread Marco Bizzarri

Hi all.

I'm in the business of migrating OpenFlow from Zope 2.7.x (where it
lived peacefully) to Zope 2.9 and 2.10 (i.e. I'm in the process of
2.9, and then I will move to 2.10).

As a first step, I've run the unit tests for the project, and just one
is failing, the following one:

code
   def afterSetUp(self):
   self.zope = self.app
   # create an openflow
   self.zope.manage_addProduct['OpenFlow'].manage_addOpenflow(id='OF')
   self.of = getattr(self.zope, 'OF')
   # Create a Process Definition with two activities (Begin, End)...
   self.of.addProcess(id='begin_end', BeginEnd=1)
   self.pd = getattr(self.of, 'begin_end')
   # ...and one transition linking them
   self.pd.addTransition(id='begin_end', From='Begin', To='End')
   loginUnrestricted()

   def testCopyOpenflow(self):
   cataloged_items = len(self.of.Catalog())
   cb = self.zope.manage_copyObjects([self.of.id])
   try:
   for i in [self.of, self.pd] + self.pd.objectValues():
   assert hasattr(i.aq_base, 'getId'), missing %s % i.id
   assert i._getCopy(self.zope) is not None, getcopy not
in %s % i.id
   except AssertionError:
   # this test is tough to make! how to do this?
   return
   self.zope.manage_pasteObjects(cb)
   new_of = getattr(self.zope, 'copy_of_'+self.of.id)
   self.assertEquals(len(new_of.Catalog()),cataloged_items)
/code

Just for a little of further knowledge: OpenFlow creates a Catalog,
which is used to access all the data of the Workflow (processes,
instancess, workitems, etc.)

The assertion failing is the last one, because I get a length of 0 as
a result of the query of the catalog.

Can someone point me to differences between 2.7 and 2.9 in the
handling of the paste action?

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] The product I made isn't in the product management page

2007-01-02 Thread Marco Bizzarri

Two suggestions:

1) run zope in foreground, so that you can see if Zope is complaining
about your project;

2) make helloClass derive from OFS.SimpleItem.SimpleItem.

Regards
Marco

On 1/3/07, Allen Huang [EMAIL PROTECTED] wrote:




I'm using Zope 2.8.8 and I trying to make my own product.



Whenever I make a product with errors in the python coding, I could see my
product name registered in the product management page. But when I fix all
the error, the product disappears; it not in the product management page or
the add menu.



What is the problem here?



here is my coding



__init__.py

---

import helloModule

def initialize(context):
context.registerClass(
helloModule.helloClass,
permission=Add Hello Object,
constructor=(
helloModule.manage_addHelloForm,
helloModule.manage_addHello
)
)




helloModule.py



def manage_addHelloForm(self):
 Form for adding a Hello Object 
return 
html
head
title/title
/head

body
form method=post action=./manage_addHello
input type=text name=id
input type=submit value=Add Hello
/form
/body
/html


def manage_addHello(self):
 Method for adding a Hello Object 
newHello=helloClass(id)
self._setObject(id, newHello)
return self.manage_main(self, REQUEST)

class helloClass:
meta_type='Hello Object'

def __init__(self, name='World'):
self.name=name

def saySomething(self):
return Hello,  + self.name

def edit(self, name):
self.name=name

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






--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Exploring non always repeating tracebacks in test case

2007-01-02 Thread Marco Bizzarri

Hi all.

I'm trying to explore the possible reasons behind some strange
traceback which on some conditions (unknown to me at the moment)
appears while running my ZopeTestCases.

When I run all my tests, sometimes I get no error. Sometimes I get
from 3 to 5 tracebacks, all related to the same part of the code. Here
is one of those tracebacks.


ERROR: testActIntegration.DeterminationTestCase.testProposal
--
Traceback (most recent call last):
 File testActIntegration.py, line 106, in testProposal
   draft.fromScratch(AUTHOR)
 File /var/local/zope27/paflow/zeoclient/Products/PAFlow/Acts.py,
line 1298, in fromScratch
   self.makeDocumentUsingData()
 File /var/local/zope27/paflow/zeoclient/Products/PAFlow/Acts.py,
line 1085, in makeDocumentUsingData
   'application/pdf')
 File /var/local/zope27/paflow/zeoclient/Products/PAFlow/Documents.py,
line 676, in setBinaryFileType
   self.updateData(file, content_type)
 File /var/local/zope27/paflow/zeoclient/Products/PAFlow/Documents.py,
line 558, in updateData
   data, size = self._read_data(file)
 File /var/local/zope27/base278/lib/python/OFS/Image.py, line 518,
in _read_data
   get_transaction().commit(1)
 File /var/local/zope27/base278/lib/python/ZODB/Transaction.py,
line 241, in commit
   ncommitted += self._commit_objects(objects)
 File /var/local/zope27/base278/lib/python/ZODB/Transaction.py,
line 356, in _commit_objects
   jar.commit(o, self)
 File /var/local/zope27/base278/lib/python/ZODB/Connection.py, line
452, in commit
   dump(state)
 File /usr/lib/python2.3/copy_reg.py, line 69, in _reduce_ex
   raise TypeError, can't pickle %s objects % base.__name__
TypeError: can't pickle function objects

Of course, there is a lot of my code here, so basically I'm not asking
about the problem, but on how I could further explore the problem
(aside from putting a conditional break in the code and run the tests
until it is activated).

Another (related) question is related to the following snippet, from OFS.Image:

 File /var/local/zope27/base278/lib/python/OFS/Image.py, line 518,
in _read_data
   get_transaction().commit(1)

Here we have therefore a subtransaction committed. This worries me a
lot, since my code deals, at the same time, with PostgreSQL database
and ZCatalog. In the ZCatalog, the subtransactions where disabled
since they were not compatible with PostgreSQL.

I think there is a similar issue with subtransaction in Image... am I wrong?


Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] zope sql_delimiter windows

2006-12-24 Thread Marco Bizzarri

I suspect it could have something to do with psycopg2. I remember
while I was checking my application (which runs using psycopg1) that I
could get a repeated segmentation fault while I run a test which used
sql_delimiter.

You could try to check on the psycopg2 ml.

Regards
Marco

On 12/24/06, garry saddington [EMAIL PROTECTED] wrote:

On Sun, 2006-12-24 at 16:10 +0100, Andreas Jung wrote:
 -BEGIN PGP SIGNED MESSAGE-
OK, sorry for the lack of info. What happens is that Zope stops
responding when I fire off a ZSQL method containing a 'sql_delimiter'
and then I get the standard Windows message:
python.exe has encountered a problem and needs to closeetc.
All I can say is that it has something to do with msvcr71.dll which is
in the detail of the above error message. There is no other hint in any
logs as to what is happening and when I close the above dialogue, Zope
comes back to life and the offending ZSQL has not run.
Only ZSQL methods which rely on sql_delimiter are affected. I have
repeated the error on XP pro sp2 and XP home SP2 with Zope versions
2.8,.2.9 and 2.10 using the Pythons that ship with these versions (ie
standard Windows installs). DA is psycopg2 and database is Postgresql.
Any Ideas, can I provide any further information?
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 )




--
Marco Bizzarri
http://iliveinpisa.blogspot.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] conditional python expresion inside ZPT

2006-12-05 Thread Marco Bizzarri

What about putting the code snippet in a python script and then calling it
from ZPT?

Put it in a script like mycondition, and then

div tal:define=x here/mycondition
!-- use x here --

/div

Regards
Marco


On 12/5/06, Daniel de la Cuesta [EMAIL PROTECTED] wrote:


 Hello,

How can I insert a conditional python expresion inside a ZPT.

Example:

if (my_expresion):
toreturn = a
else:
toreturn = b

return toretun

Thank you!







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






--
Marco Bizzarri
http://iliveinpisa.blogspot.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] storing persisten object in python dictionaries

2006-10-26 Thread Marco Bizzarri

Storing persistent object in object outside of ZODB can incur in the
problem of passing object(s) between threads, and, therefore, passing
one object which is related to a connection on the ZODB to another
context with a different connection.

Also, AFAIK, keep in mind _v_ attributes are not involved in
transaction machinery of Zope. This means that if you have an error
inside you transaction after you modified the _v_ cache, you will have
the cache modified even tough the transaction has been aborted.

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] storing persisten object in python dictionaries

2006-10-26 Thread Marco Bizzarri

On 10/26/06, Jürgen Herrmann [EMAIL PROTECTED] wrote:


On Thu, October 26, 2006 14:53, Marco Bizzarri wrote:
 Storing persistent object in object outside of ZODB can incur in the
 problem of passing object(s) between threads, and, therefore, passing
 one object which is related to a connection on the ZODB to another
 context with a different connection.



ok, this is probably the problem here, so would haveing a cache dict
for each thread help? there are only about 50-100 containers so the
memory overhead would be neglible compared to the performance gained.


Yes, this should probably resolve your issue.



 Also, AFAIK, keep in mind _v_ attributes are not involved in
 transaction machinery of Zope. This means that if you have an error
 inside you transaction after you modified the _v_ cache, you will have
 the cache modified even tough the transaction has been aborted.
not a real problem as class instance containers are very static.


I understand, we hit this problem while caching object obtained from
database rows... and in case of failure cache became unreliable.

I'm keeping the answer on the ML, if you don't mid.

--
Marco Bizzarri
http://iliveinpisa.blogspot.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] Help! Zope Crashed! Production Server!

2006-10-05 Thread Marco Bizzarri

Since you're running it with runzope (i.e. in foregreound mode):

1) Can you confirm Zope provided the message Zope Ready to handle requests

2) What is the top command showing? Is python/zope process using CPU,
or is it simple unresponsive?

3) Can you check if there are different processes when you start and
when you do your first request? With some C extensions of python, you
can end with hanging python processes (at least on Linux; don't know
on FreeBSD).

4) Is the zope process able to write to Z2.log, event.log and (if
used) trace.log?

Hope this can help.

Regards
Marco

--
Marco Bizzarri
http://notenotturne.blogspot.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] Legacy Perl code and Zope. A pipe dream?

2006-10-03 Thread Marco Bizzarri

If I can provide any suggestion, take a look at Refactoring, by
Martin Fowler, and start applying the refactorings there provided.
This is not, I think a Zope/Perl/Python/PHP issue, but rather a
refactoring/migration problem, and it should be explored in that
places (just a suggestion, of course).

Regards
Marco


On 10/3/06, Derek Basch [EMAIL PROTECTED] wrote:

--- Jonathan [EMAIL PROTECTED] wrote:




Yes, the application is currently deployed but it is the gnarliest mess of ten 
year old spaghetti
code you have ever seen. No session handling, no automatic CGI variable 
parsing, no
authenticationno fun. I am attempting to find a path towards a proper web 
application
framework without having to rewrite every single line of legacy code. For 
example, all new
projects would adhere to framework xyz and the legacy code would still play 
nicely with the
framework.


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




--
Marco Bizzarri
http://notenotturne.blogspot.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] Can't Install Plone!

2006-09-30 Thread Marco Bizzarri

1) you're posting to the wrong list: I suspect you should try to post
to plone mailing list, where you will find more useful responses;

2) it looks like the Plone you're using is not matching the ZCatalog
in Zope: did you say you installed a new version of Plone? Most
probably, it is not compatible with Zope 2.7.8.

Regards
Marco


--
Marco Bizzarri
http://notenotturne.blogspot.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] Unicode in zope ?

2006-09-21 Thread Marco Bizzarri

I think it would be better if you explain more what you're trying to
obtain: your question is too generic.

Regards
Marco

On 9/21/06, Luc Van Tien [EMAIL PROTECTED] wrote:

Anyone know show me tutorial how to user unicode in zope ?
Thank you very much .

 
Hãy ghé qua trang chủ Yahoo! Việt Nam!
___
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 )






--
Marco Bizzarri
http://notenotturne.blogspot.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] Localizer/TranslationService question

2006-09-14 Thread Marco Bizzarri

IIRC, iHotfix is required by Localizer when you have a version like 1.1 or 1.2

I think itools is also required, regardless of version (1.0, 1.1, 1.2)

Regards
Marco

You could try to ask to the localizer mailing list... it is not very
active, but it is responsive ;)

Regards
Marco

On 9/14/06, Pascal Peregrina [EMAIL PROTECTED] wrote:

Hi,

Does anyone know if Localizer requires iTools/iHotFix to work with Zope 2.8
if I only use MessageCatalogs (and not plain files) ?

(I'm downloading the Products from here:
http://www.ikaaro.org/download/index.html)

Until now I was using the 1.0.1 version of Localizer.

Thanks.

Pascal



**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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 )




--
Marco Bizzarri
http://notenotturne.blogspot.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] Reportlab issue

2006-08-28 Thread Marco Bizzarri

Did you try to get the report outside of FF or IE? I mean, did you try
with tools like wget or the same, and looking at the result?

Do you have the same behaviour if you exit the browser, clear the
caches and the access a report again?

Regards
Marco

On 8/28/06, David H [EMAIL PROTECTED] wrote:

Hi Zope List,

I have an Zope application that uses ReportLab to generate acrobat
viewable reports. (I already posted this to reportlab list - so far no
solutions).

Heres the problem:

I display an acrobat report (using Firefox or IE 6) and say scroll down
to page 10.  I then use the browser back button to re-enter my Zope
application.

Now, even if I click various unrelated pages in the application
(clearing the request,etc) and then return to the Report (which is
always freshly generated) it will try to re-display at page 10 - instead
of top of page.

This occurs even if the data being reported has changed, and this occurs
even if a different report is generated!

Note: that I use

import tempfile and
tmpFile2 = tempfile.mktemp()

to keep pdfPath's unique ...

I've tried combinations of Content-Disposition params like changing
filename=, etc.  Nothing is changing this behavior.

I've tried (a reportlab mailing list suggestion) varying to forms
action=  like

   form name=printform method=post action=extensions/pyBudgetReports
 tal:attributes=action python:
'extensions/pyBudgetReports/?random=' + context.python.pyTime()

No help either.

Anyone seen this?

David H

I'm using ReportLab 1.20, Zope 2.78 and an external python script +
ReportLab to generate the PDFs.  The Server is Linux Ubuntu 5.10.
___
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 )




--
Marco Bizzarri
http://notenotturne.blogspot.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] Renamed user account and OpenFlow

2006-08-07 Thread Marco Bizzarri

This is mostly an OpenFlow question, so you would better post it to
openflow mailing list.

The simplest way would be creating a python script which:

1) search the old (inactive) workitem;

2) unassign them

3) reassign them

Regards
Marco



On 8/7/06, Tit-Liviu Leontin [EMAIL PROTECTED] wrote:

Hello everyone,

I'm currently taking over the administration of a running instance of Zope and 
OpenFlow. These have been used to create a workflow for a decision making 
process. The users are authenticated via LDAP.

The problem is, one of the workflow users got married and the username has been 
changed to reflect the new last name. Instances already in the workflow are 
assigned to the old username, and the person cannot log in to interact with 
them. I can assign the new username to the correct role, but what about the old 
instances?

Is there an easy way of migrating the instances assigned to the old username to 
the new one, or maybe creating a local user with the old username? Any 
step-by-step suggestion is welcome, as I'm barely getting familiar with the 
admin interface.

Thanks in advance,
Titel

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




--
Marco Bizzarri
http://notenotturne.blogspot.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] (no subject)

2006-08-03 Thread Marco Bizzarri

Please take a look at the Zope book, in the section about security
where it speaks about trusted and untrusted code.

Basically, you can access from a Python script (i.e. untrused code)
only those modules which are explicity declared so in Zope.

time module is most probably not in those modules.

Regards
Marco

On 3 Aug 2006 10:36:12 -, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:


I'm new to Zope, though I've been writing Python for some time.  I have a fresh 
installation to which I've added a simple Python script (code below) in the 
root directory.  When I test the script through the ZMI or attempt to access it 
via the web, I get an error:

Error Type: Unauthorized
Error Value: You are not allowed to access localtime in this context

I'm logged in as a Manager and have tried setting the Proxy of the script to 
both Manager and Owner, to no avail.

Can someone please help me understand what is happening and how to fix it?

Thanks

code of the script:

import time
t=time.localtime()
print t
return printed



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




--
Marco Bizzarri
http://notenotturne.blogspot.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] How can i improve performance of website under heavy load in Zope2.6.1

2006-07-31 Thread Marco Bizzarri

1) improve the number of object in the cache: the default is 400 which
is incredibly low for a normal site; put it to 5000 and check;

2) (if possible) upgrade to a newer release of Zope, namely 2.8, which
removes many possible conflict, and therefore improves response time;

3) install a Zope/ZEO configuration, with more than one Zope server
responding; don't mix too much with threads which is, as far as I
know, tricky stuff; use more than one physical server, running Zope,
connected to a ZEO backend; distribute the load using whatever load
balancer of your choice;

4) review your application needs; check what are the actual
bottlenecks; is there any static content you could better serve using
apache (like images, documents..) ?

5) make a google search with improving Zope performance ;)

Regards
Marco

On 7/31/06, Sudesh Soni [EMAIL PROTECTED] wrote:



Hi,

I am using Zope 2.6.1

I wonder why Zope is default set for handling 4 threads and 7 database
connections.

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

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

OR

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

Any help will be appreciated.

Suson


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






--
Marco Bizzarri
http://notenotturne.blogspot.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] OracleStorage - DCOracle2

2006-06-27 Thread Marco Bizzarri

On 6/26/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi all!!

I need save the zope objects in an Oracle 8.1.7 Database,who I'm trying do
it with DCOracle2 Product.

My initial problem is I need save objects in Oracle Database who reside in
other machine distinc Zope resides. Due to it, I have a compilation
problem because Oracle server resides in other machine(error:
/ora00/ora8i/u01/app/oracle/product/8.1.7/lib/libclntsh.so not readable;


Does this file exist on the Zope machine?
Is it readable by the user you're using to compile DCOracle2?

Regards
Marco
--
Marco Bizzarri
http://notenotturne.blogspot.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] setting up fast_cgi

2006-06-17 Thread Marco Bizzarri

Oops, of course I should have attached the file...

On 6/17/06, Marco Bizzarri [EMAIL PROTECTED] wrote:

I'm not sure it will be useful to you: here is the site configuration
I use with Apache2, Fastcgi and Zope.

Keep in mind:

1) virtual server name is emmebi.paflow.icube.it
2) server is running on port 81
3) Zope fastcgi server is running on port 12081

Regards
Marco

On 6/15/06, Adinda Praditya [EMAIL PROTECTED] wrote:
 Hi,

 I just installed FastCGI-2.4.0-12 and add manually my mod_fastcgi.conf then
 restart apache. I got this error

 # /etc/init.d/apache2 restart
 Syntax error on line 1 of
 /etc/apache2/conf.d/mod_fastcgi.conf:
 Invalid command 'FastCgiIpcDir', perhaps misspelled or defined by a
 module not included in the server configuration

 Right, as if the module hasn't been installed yet. Here's the configuration
 file:

 
 FastCgiIpcDir /tmp
 FastCgiExternalServer /srv/www/htdocs/zope \
   -socket zope.soc\
   -pass-header Authorization
 

 Did i miss something during installation? I know there's apache2-mod_fcgid
 package, but it's not fast_cgi, as the description said, Alternative
 FastCGI module for Apache2. I need fast_cgi because i want to integrate
 zope to apache and there's no manual doing that with apache2-mod_fcgid. I'm
 using 10.1 on i686. Please help.

 Regards,

 Adinda Praditya


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





--
Marco Bizzarri
http://notenotturne.blogspot.com/




--
Marco Bizzarri
http://notenotturne.blogspot.com/


emmebi.conf
Description: Binary data
___
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: Any known leaks in ExtFile and OpenFlow?

2006-06-04 Thread Marco Bizzarri

As (a co-author) of OpenFlow there is no known leak in that product...
we will try to provide support in order to see what are the problems.
Feel free to contact me directy.

Regards
Marco

On 6/4/06, Michael Vartanyan [EMAIL PROTECTED] wrote:

Hi all,

One of my Zope (2.8.4 on Python 2.4.2, SLES9) sites constantly hits the
memory limit. It makes heavy use of two products - ExtFile (1.5.0) and
OpenFlow (1.1.0). ExtFile class (of ExtFile) and workitem class (of
OpenFlow) are leading the refcount list with a not-constant but overall
increasing numbers of references. Refcounts for both reach numbers that
are incomparably higher than the numbers of their instances in ZoDB. I
wanted to ask if there are known leaks in these products before going
into (painful) hunting and debugging leaks in my own code.

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




--
Marco Bizzarri
http://notenotturne.blogspot.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] workflow product

2006-06-02 Thread Marco Bizzarri

You can try OpenFlow (http://www.openflow.it)

Regards
Marco

On 6/1/06, Best [EMAIL PROTECTED] wrote:

Hello!

Are there any zope products for creating and managing workflows... I heard
for a product called Metaflow but I can't find any download links :S

Thanks in advance!

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






--
Marco Bizzarri
http://notenotturne.blogspot.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] Internet Explorer does not follows redirect, while Firefox does

2006-06-02 Thread Marco Bizzarri

Thanks Kees, I will check today and I will report if this solves the issue :-).

Regards
Marco

On 5/31/06, Kees de Brabander [EMAIL PROTECTED] wrote:

Either
  dtml-call RESPONSE.setHeader('pragma','no-cache')
or
  dtml-call RESPONSE.setHeader('Expires',(_.DateTime()-1).rfc822())
or both in the head section of your page will do the trick.
cb

- Original Message -
From: Marco Bizzarri [EMAIL PROTECTED]
To: Zope Users Mailing List zope@zope.org
Sent: Wednesday, May 31, 2006 7:33 AM
Subject: [Zope] Internet Explorer does not follows redirect,while Firefox
does


 Hi all.

 I don't think this is a specific Zope problem. However, I'm
 experiencing it in a Zope context, and this is why I'm here asking.

 In a custom Zope application, we have a problem with Internet Explorer.

 The application follows a page - submit - redirect - page cycle.

 To state more clearly: the page presented to the user can have a link.
 When the user clicks on the link, something is done, and eventually
 the user is redirected to the same page which will display different
 data based on the results of its previous click.

 The problem is that when IE sees that the result page has the same URL
 as the first page  it does not reload the page and instead shows me
 the cached version.

 The problem is not shown with Firefox.

 As far as I can understand, this is an HTTP header issue, but I would
 like to know if anyone already has experienced this problem, and has
 some solution about it.

 Regards
 Marco
 --
 Marco Bizzarri
 http://notenotturne.blogspot.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 )






--
Marco Bizzarri
http://notenotturne.blogspot.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] Internet Explorer does not follows redirect, while Firefox does

2006-06-01 Thread Marco Bizzarri

Ok, I've been able to experiment. All my pages have the following in
the head section:

   meta http-equiv=Cache-Control content=no-cache
   meta http-equiv=Pragma content=no-cache
   meta http-equiv=Expires content=Date.Now
   meta http-equiv=Pragma-directive content=no-cache
   meta http-equiv=cache-directive content=no-cache

Also, I added, before every redirect, the following:

   request.get('RESPONSE').setHeader('pragma', 'no-cache')

Any suggestion?

On 5/31/06, Kees de Brabander [EMAIL PROTECTED] wrote:

Either
  dtml-call RESPONSE.setHeader('pragma','no-cache')
or
  dtml-call RESPONSE.setHeader('Expires',(_.DateTime()-1).rfc822())
or both in the head section of your page will do the trick.
cb

- Original Message -
From: Marco Bizzarri [EMAIL PROTECTED]
To: Zope Users Mailing List zope@zope.org
Sent: Wednesday, May 31, 2006 7:33 AM
Subject: [Zope] Internet Explorer does not follows redirect,while Firefox
does


 Hi all.

 I don't think this is a specific Zope problem. However, I'm
 experiencing it in a Zope context, and this is why I'm here asking.

 In a custom Zope application, we have a problem with Internet Explorer.

 The application follows a page - submit - redirect - page cycle.

 To state more clearly: the page presented to the user can have a link.
 When the user clicks on the link, something is done, and eventually
 the user is redirected to the same page which will display different
 data based on the results of its previous click.

 The problem is that when IE sees that the result page has the same URL
 as the first page  it does not reload the page and instead shows me
 the cached version.

 The problem is not shown with Firefox.

 As far as I can understand, this is an HTTP header issue, but I would
 like to know if anyone already has experienced this problem, and has
 some solution about it.

 Regards
 Marco
 --
 Marco Bizzarri
 http://notenotturne.blogspot.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 )






--
Marco Bizzarri
http://notenotturne.blogspot.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] Internet Explorer does not follows redirect, while Firefox does

2006-05-30 Thread Marco Bizzarri

Hi all.

I don't think this is a specific Zope problem. However, I'm
experiencing it in a Zope context, and this is why I'm here asking.

In a custom Zope application, we have a problem with Internet Explorer.

The application follows a page - submit - redirect - page cycle.

To state more clearly: the page presented to the user can have a link.
When the user clicks on the link, something is done, and eventually
the user is redirected to the same page which will display different
data based on the results of its previous click.

The problem is that when IE sees that the result page has the same URL
as the first page  it does not reload the page and instead shows me
the cached version.

The problem is not shown with Firefox.

As far as I can understand, this is an HTTP header issue, but I would
like to know if anyone already has experienced this problem, and has
some solution about it.

Regards
Marco
--
Marco Bizzarri
http://notenotturne.blogspot.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] Defining constants for an Interface in a Zope2 product.

2006-04-28 Thread Marco Bizzarri
Hi all.I would like to be able to define an interface which specifies both methods and constants, something like this:class IMyTest(Interface): A = Constant(1) B = Constant(2) C = Constant(3)
 def aMethod(self, a_value):  something A, B and C could be any meaningful constant for this interface, like possible return values for the aMethod. Then I could possibly test any class using and object which implements this simply by testing it against the IMyTest and if the return values are 
IMyTest.A, IMyTest.B, IMyTest.C.Is this possible in some way? RegardsMarco-- Marco Bizzarrihttp://notenotturne.blogspot.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] Strategies for testing generated sql?

2006-04-14 Thread Marco Bizzarri
On 4/12/06, Paul Winkler [EMAIL PROTECTED] wrote:
Functionally, we are missing some important testables:* we have no way to verify that these queries are syntactically correct sql.* we have no way to verify that these queries behave as expected against
a sample data set.How do people test this sort of thing? Do you go whole-hog andfire up MySQL or whatever?Or use gadfly? sqlite? or what?Are there other tools I should know about?

Sorry, It is taking a little more than I expected to prepare the
sample. However, I can provide some idea on this topic. We do this
using ZopeTestCase.

Basically, we have a test database (postgresql, but it can be used for
whatever transactional database). Each user has its own database, based
on its username.

The test does actual queries on the test database. At the end of each
test (single test, not test suite), there is a rollback (if you're
using a Z Database Adapter, this is done automatically by the
transaction machinery).

So, each single test runs with a fresh copy of the database.

Regards
Marco
-- Icube Srlhttp://www.icube.it/
___
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] Strategies for testing generated sql?

2006-04-14 Thread Marco Bizzarri
Ok, here it is. It is a demo product, which has one class,
GenerateInsert, which will generate an insert based on your parameters.
I've also written a small test, which tries to show what I would do:
test that given the proper parameters, it will generate the proper
string. The case I'm showing is very simple, but it could be extended
to other cases as well...

Also, if you want to take a look at some tests in database environment,
you could take a look at paflow (www.paflow.it) where there is quite a
lot of tests...

Regards
MarcoOn 4/12/06, Paul Winkler [EMAIL PROTECTED] wrote:
On Wed, Apr 12, 2006 at 06:51:18PM +0200, Marco Bizzarri wrote: The problem is what you want to test. I'm not familiar with Zope 3, therefore I'm talk on the base of ZSQLMethod.SQL.SQL from Zope 2.
 If I understand correctly, you've some high level construct which creates an nvSQL instance.Correct. Now, if you put yourself at the end of the line, what you need to do is to parse the output of nvSQL, in order to see if the generated
 SQL is correct. What you're doing therefore is to test whether nvSQL is able to generate correctly the SQL. But I think this is not what you want to test. You could safely assume that, given the proper input, nvSQL will generate the proper
 output. Therefore, what you should test is that the generated nvSQL has the appropriate characteristics.Exactly!I am also open to suggestions on what kind of characteristics
I should be interested in.I have never written tests of generatedSQL before. I will try to post a sample for Zope2, just to give an idea of what could be done.That would be very helpful, thank you.
--Paul Winklerhttp://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 )-- Icube Srlhttp://www.icube.it/



SimpleSQLTests.tar.gz
Description: GNU Zip compressed data
___
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] Strategies for testing generated sql?

2006-04-12 Thread Marco Bizzarri
The problem is what you want to test. I'm not familiar with Zope 3,
therefore I'm talk on the base of ZSQLMethod.SQL.SQL from Zope 2.

If I understand correctly, you've some high level construct which
creates an nvSQL instance. Now, if you put yourself at the end of the
line, what you need to do is to parse the output of nvSQL, in order to
see if the generated SQL is correct.

What you're doing therefore is to test whether nvSQL is able to
generate correctly the SQL. But I think this is not what you want to
test. You could safely assume that, given the proper input, nvSQL will
generate the proper output.

Therefore, what you should test is that the generated nvSQL has the appropriate characteristics.

I will try to post a sample for Zope2, just to give an idea of what could be done.

Regards
MarcoOn 4/12/06, Paul Winkler [EMAIL PROTECTED] wrote:
This is a very general question: I'm looking for ideas on how toeffectively test dynamically generated sql queries.Both unit and functional test ideas welcome.We have a bunch of views (in the zope 3 / Five sense, but that's not
really relevant) which typically construct a Shared.DC.ZRDB.DA.nvSQLinstance, passing it a dictionary to use as the namespace mapping (I'msimplifying, there's more indirection than that).We have a bunch of tests for this stuff, but typically they just assert
that the generated sql query exactly matches some expected string. Thisstrikes me as only a minimal useful regression test when it passes, butit suffers from a number of drawbacks:* When a test fails, it can be very difficult to spot what changed.
I'm getting really tired of staring at stuff like (contrived example,but some of my test failures actually look pretty close to this):AssertionError: select , aabb, aacc, aadd, aaee, aaff, aagg,
bbaa, , bbcc, bbdd, bbee, bbff, bbgg, ccaa, ccbb, , ccdd,ccee, ccff, ccgg, ddaa, ddbb, ddcc, , ddee, ddff, ddgg, eeaa,eebb, eecc, eedd, , eeff, eegg, ffaa, ffbb, ffcc, ffdd, ffee,, ffgg, ggaa, ggbb, ggcc, ggdd, ggee, ggff, , case when
bbcc != '' then bbcc when aaddd != '' then aaddd end as bbcc fromblarftable b where (b.aacc = fred and b.aaee != joe) order byaabb != select , aabb, aacc, aadd, aaee, aaff, aagg, bbaa,
, bbcc, bbdd, bbee, bbff, bbgg, ccaa, ccdd, , ccbb, ccee,ccff, ccgg, ddaa, ddbb, ddcc, , ddee, ddff, ddgg, eeaa, eebb,eecc, eedd, , eeff, eegg, ffaa, ffbb, ffcc, ffdd, ffee, ,ffgg, ggaa, ggbb, ggcc, ggdd, ggee, ggff, , case when bbcc
!= '' then bbcc when aaddd != '' then aaddd end as bbcc fromblarftable b where (b.aacc = fred and b.aaee != joe) order by aabb Gee thanks!* I think it would be a lot more useful to be able to reliably parse out
and make assertions about some of the sub-clauses.So I could write tests that make assertions like: - this query is selecting columns a, b, c, d in that order. - the where clause should compare column X against value Y
 etc.I could of course do some ad-hoc stuff with string methods andmaybe regexes, but I have to wonder if there's some sql-specificlibrary that I could leverage. Googling suggests thatthere's a parser in gadfly (of course), and an example sql
parser in pyparsing.Worth the effort or should I stickwith simple string stuff?Functionally, we are missing some important testables:* we have no way to verify that these queries are syntactically correct sql.
* we have no way to verify that these queries behave as expected againsta sample data set.How do people test this sort of thing? Do you go whole-hog andfire up MySQL or whatever?Or use gadfly? sqlite? or what?
Are there other tools I should know about?--Paul Winklerhttp://www.slinkp.com___Zope maillist-
Zope@zope.orghttp://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 )-- 
Icube Srlhttp://www.icube.it/
___
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] FileSystemSite does not register file extension

2005-09-16 Thread Marco Bizzarri
Hi all.

I'm using the FileSystemSite product in a pure Zope application.

Inside it, I'm registering some extensions (gif, png, jpg, etc.) in order to work with a subclass of FSImage.

The problem now is that the registration works for all extensions but
the gif one. This has changed from one day to another. Now, I
understand this is something we did, but I've no clue in what we could
have changed.

Works = With a png, I've my FSImage subclass used. With a gif, I've the
FSImage used. Also, with the gif I've the '.gif' added to the id of the
object, while with the other image I don't have it.
Any suggestion?
-- Icube Srlhttp://www.icube.it/
___
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] ERROR(200) KeywordIndex unindex_object could not remove documentId -702398584 from index workitems_from. This should not happen.

2005-09-09 Thread Marco Bizzarri
We are seeing traceback in the event log like this:

2005-09-09T09:28:32 ERROR(200) KeywordIndex unindex_object could not remove documentId -702398584 from index w
orkitems_from. This should not happen.
Traceback (most recent call last):
 File /home/zope/zope-2.7.4/lib/python/Products/PluginIndexes/common/UnIndex.py, line 185, in removeForward
IndexEntry
 indexRow.remove(documentId)
 File /home/zope/zope-2.7.4/lib/python/ZODB/Connection.py, line 599, in setstate
 invalid = self._is_invalidated(obj)
 File /home/zope/zope-2.7.4/lib/python/ZODB/Connection.py, line 628, in _is_invalidated
 raise ReadConflictError(object=obj)
ReadConflictError: database read conflict error (oid 0x38f00c, class BTrees.IIBTree.IISet)
What is the meaning of the first line? Is it something
we should worry about? (workitems_from is an index of the ZCatalog, of
course).-- Icube Srlhttp://www.icube.it/
___
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: Defining and creating a temporary storage for each user

2005-09-06 Thread Marco Bizzarri
Florent, thanks for your suggestion.

Could you point me on more detailed information about this topic (i.e. how object stored in ZODB are actually managed)?

Is this more a ZODB mailing list question than Zope? Should I directly point to ZODB documentaiton?

Regards
MarcoOn 9/5/05, Florent Guillaume [EMAIL PROTECTED] wrote:
Marco Bizzarri wrote: You mean mantaining just in the memory... uhmmm I should double check with the fact that the object in memory should mantain some reference to an object on the ZODB... which should be no problem at all.
Beware, an object stored in the ZODB cannot be used by another connection tothe database. That means, by another thread, in the most common case. Exceptif you're very sure about what you're doing, the only kinds of references to
persistent objects you should have in memory are their paths.Florent--Florent Guillaume, Nuxeo (Paris, France) CTO, Director of RD+33 1 40 33 71 59 http://nuxeo.com
 [EMAIL PROTECTED]-- Icube Srlhttp://www.icube.it/
___
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] Defining and creating a temporary storage for each user

2005-09-05 Thread Marco Bizzarri
You mean mantaining just in the memory... uhmmm I should double
check with the fact that the object in memory should mantain some
reference to an object on the ZODB... which should be no problem at all.

Thanks for your input, I have to think about this possibility.

Regards
Marco
On 9/5/05, Chris Withers [EMAIL PROTECTED] wrote:
Marco Bizzarri wrote: Since these are temporary data, we would like to create them in a temporay storage, either one for each user or one for all of them.If they are temporary, then why do they need ot be stored in a storage
at all?Chris--Simplistix - Content Management, Zope  Python Consulting- http://www.simplistix.co.uk
-- Icube Srlhttp://www.icube.it/
___
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: Defining and creating a temporary storage for each user

2005-09-05 Thread Marco Bizzarri
Yes, it is this kind of problems thats most probably led us to think to
put objects on a temporary folder rather than in memory...

Regards
Marco
On 9/5/05, Florent Guillaume [EMAIL PROTECTED] wrote:
Marco Bizzarri wrote: You mean mantaining just in the memory... uhmmm I should double check with the fact that the object in memory should mantain some reference to an object on the ZODB... which should be no problem at all.
Beware, an object stored in the ZODB cannot be used by another connection tothe database. That means, by another thread, in the most common case. Exceptif you're very sure about what you're doing, the only kinds of references to
persistent objects you should have in memory are their paths.Florent--Florent Guillaume, Nuxeo (Paris, France) CTO, Director of RD+33 1 40 33 71 59 http://nuxeo.com
 [EMAIL PROTECTED]-- Icube Srlhttp://www.icube.it/
___
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] Defining and creating a temporary storage for each user

2005-09-02 Thread Marco Bizzarri
On 9/2/05, Peter Bengtsson [EMAIL PROTECTED] wrote:
On 9/1/05, Marco Bizzarri [EMAIL PROTECTED] wrote: Hi Peter.No, it should work good for me also... there still is a point on how to
 create them for a custom product (I've a product and I would like to create the folder inside the product).Are you going to go for multiple temp folders or not?No, I don't know how to create them programmatically. Surely you can
figure it out from the source code.
Actually, it doesn't make that much difference to me. While using Zope
2.6.x we tried this, using a
TemporaryFolder.constructTemporaryFolder, but we had mixed results... I
will try it again.
Also, I would like to test that against ZopeTestCase environment.
Do you have some working code?None. Sorry.
Thanks for your input, in any case :)

Regards
Marco
-- Icube Srlhttp://www.icube.it/
___
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] Defining and creating a temporary storage for each user

2005-09-02 Thread Marco Bizzarri
On 9/2/05, Chris Withers [EMAIL PROTECTED] wrote:
Marco Bizzarri wrote: Users should have their own storage, so that they can create/modify objects inside that, without influencing the general, shared database.The ZODB mounting machinery isn't designed for this case and it would
take a lot of work on your part to make it do what you need, although itshould certainly be possible.
Ok, I will not purse this for this moment.
What about not influencing the general, shared database (can you tell usmore about what that is?) means that you think you need seperate storages?

I will try to better explain myself on what we are actually doing. 

The context is PAFlow, which is a pure (no CMF/Plone) vertical application for (italian) public administration.

Inside this application, we are using an in house developed framework
where more or less each page shown to the user is connected to an
object (which we call controller) on the ZODB.

When one user requests a page, PAFlow creates a controller for it
(actually, creates also the page, but this is not important now),
storing there all the data meaningful for that page, so that later the
page can be built simply by invoking methods from the controller (I
hope this is clear, otherwise I will post some code example).

Of course, the creation/destruction of all these objects is a major performance problem, because they happen all on the ZODB.

Since these are temporary data, we would like to create them in a
temporay storage, either one for each user or one for all of them.

We could create them in the /temp_folder, but this could provide some
non trivial security issue (?), also because you can have more than one
PAFlow Site installed in a ZODB.

What are the data stored on the ZODB, apart from the controllers?
Workflow data for ongoing processes. All the domain data are stored on
a RDBMS.

I hope I explained myself.

Thanx for your inputs :) 
cheers,ChrisPS: You shouldn't be using DBTab in this day and age, upgrade your Zope
version and use zope.conf...
I did not explain myself: I'm not using dbtab, actually. I was
exploring the way in which I could achieve what I would like to do and,
exploring the code, I stumbled upon dbtab. We're working on 2.7.x, with
zope.conf
--Simplistix - Content Management, Zope  Python Consulting- 
http://www.simplistix.co.uk-- Icube Srlhttp://www.icube.it/
___
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] Defining and creating a temporary storage for each user

2005-09-02 Thread Marco Bizzarri
On 9/2/05, Peter Bengtsson [EMAIL PROTECTED] wrote:
The context is PAFlow, which is a pure (no CMF/Plone) vertical application for (italian) public administration.Inside this application, we are using an in house developed framework where
 more or less each page shown to the user is connected to an object (which we call controller) on the ZODB.When one user requests a page, PAFlow creates a controller for it (actually, creates also the page, but this is not important now), storing
 there all the data meaningful for that page, so that later the page can be built simply by invoking methods from the controller (I hope this is clear, otherwise I will post some code example).
All of this sounds quite cool but smells complicated.
Indeed it is ;) 

I don't see a need for multiple temp_folders. Just stick folders (foreach instance) and folders inside them (for each user).

Yes, if I only could add a new temp_folder inside my object without configuring it inside zope.conf..
Good luck

Thanx :)
--Peter Bengtsson,work www.fry-it.com
home www.peterbe.comhobby www.issuetrackerproduct.com-- Icube Srl
http://www.icube.it/
___
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] Defining and creating a temporary storage for each user

2005-09-01 Thread Marco Bizzarri
Hi all.

My work environment is Zope 2.7.x

I would like to create a different temporary storage for each user. Of course, I can't simply write them in the zope.conf.

Users should have their own storage, so that they can create/modify
objects inside that, without influencing the general, shared database.

Is this configuration possible? I've seen I could manipulate entries in
the dbtab object, but I'm not sure this is safe after the first startup.

Regards
Marco
___
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] Defining and creating a temporary storage for each user

2005-09-01 Thread Marco Bizzarri
Hi Peter.

No, it should work good for me also... there still is a point on how to
create them for a custom product (I've a product and I would like to
create the folder inside the product).

Also, I would like to test that against ZopeTestCase environment.

Do you have some working code?

Regards
MarcoOn 9/2/05, Peter Bengtsson [EMAIL PROTECTED] wrote:
I suggest you use the one temporary storage (temp_folder) and in itcreate one Folder per user. I've done this myself for a similar scope.Or am I missing something? What's the difference of multiple tempfolders over multiple folders inside one temp folder??
With early zope 2.7. releases I also found temp_folder to be ratherunreliable. I got weird zodb errors that no one on the mailing listcould explain or help me solve. (and by that I don't mean anythingnegative about the mailing list people but, that it was difficult to
phrase the bug report since it was quite sporadic)On 9/1/05, Marco Bizzarri [EMAIL PROTECTED] wrote: Hi all.My work environment is Zope 
2.7.xI would like to create a different temporary storage for each user. Of course, I can't simply write them in the zope.conf.Users should have their own storage, so that they can create/modify objects
 inside that, without influencing the general, shared database.Is this configuration possible? I've seen I could manipulate entries in the dbtab object, but I'm not sure this is safe after the first startup.
RegardsMarco ___ 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 )--Peter Bengtsson,work 
www.fry-it.comhome www.peterbe.comhobby www.issuetrackerproduct.com-- Icube Srl
http://www.icube.it/
___
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] Uninstalling a product in a ZopeTestCase

2005-08-19 Thread Marco Bizzarri

Hi all.

I'm trying to write a ZopeTestCase where I can check if the import of a 
missing module is catch or no. I would therefore test something like this:


def testImportIsCaught(self):
import sys
oo_path = filter(lambda x: 'program' in x, sys.path)
sys.path.remove(oo_path[0])
ZopeTestCase.installProduct('PAFlow')


What I'm doing here is to remove the path where the openoffice support 
is in the system, and then I try to install the product. If the 
exception import is caught, this should not raise an exception.


The problem is that if I run all the tests, I will end with my product 
already installed, and, therefore, the test won't be run correctly.


Do anyone has any suggestion?

Regards
Marco
begin:vcard
fn:Marco Bizzarri
n:Bizzarri;Marco
org:Icube S.r.l.
adr:;;via Ridolfi 15;Pisa;PI;56124;Italy
email;internet:[EMAIL PROTECTED]
title:Amministratore Delegato
tel;work:+39-050-970-207
tel;fax:+39-050-3136-588
tel;cell:+39-348-640-4861
x-mozilla-html:FALSE
url:http://notenotturne.blogspot.com/
version:2.1
end:vcard

___
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] product organization

2005-07-27 Thread Marco Bizzarri
Nicholas Wieland wrote:
 As usual, my question is rather simple :)
 I'd like to know what are the best practices for product organization -
 for example I have _tons_ of queries to sqlserver, and my main class is
 becoming less manageble every time I look at it :/
 I like the way SQL integrates in Zope, what I don't like is having a
 giant __init__ and a lot of _sqlSomething at the end of the class.
  
 Can I associate queries to something else than a _variable ? Something
 like a dictionary or a class ? Can I move SQL calls outside the
 initializer ? I'd prefer to have a class for data access and another one
 to glue all the parts together, maybe I'm plain wrong but I think that
 my product would be a lot cleaner.
 What are the best practices for FS based products ? 
 
 
 *Yahoo! Mail*
 http://us.rd.yahoo.com/mail_it/taglines/*http://it.mail.yahoo.com:
 gratis 1GB per i messaggi, antispam, antivirus, POP3
 
 
 
 
 ___
 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 )

I can't talk for best practise. You can put your queries also outside of
the init, in this way:

class YourProduct:

_my_query = SQL('doMyQuery', '',
'your_connection', '', 'select * from data')

def __init__(self):
pass


Also, if you have a *LOT* of queries, consider in building your query on
the fly.

Regards
Marco
begin:vcard
fn:Marco Bizzarri
n:Bizzarri;Marco
org:Icube S.r.l.
adr:;;via Ridolfi 15;Pisa;PI;56124;Italy
email;internet:[EMAIL PROTECTED]
title:Amministratore Delegato
tel;work:+39-050-970-207
tel;fax:+39-050-3136-588
tel;cell:+39-348-640-4861
x-mozilla-html:FALSE
url:http://notenotturne.blogspot.com/
version:2.1
end:vcard

___
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] Error in treating custom exception

2005-07-19 Thread Marco Bizzarri

Hi all.

It looks like I've hit something which is already known (I've found this 
reference:


http://mail.zope.org/pipermail/zope-collector-monitor/2004-October/004316.html

)

I've a custom standard_error_html page, made with a Zope Page Template. 
I'm trying to provide a custom __str__ for a custom exception. This 
works, most of the time, but in some cases I encounter the following error:


TypeError: unbound method __str__() must be called with InvalidFolderId 
instance as first argument (got nothing instead)


InvalidFolderId is the custom exception, of course.

This is the code of the exception:

class InvalidFolderId(Exception):

def __init__(self, folder_id):
self.folder_id = folder_id

def __str__(self):
return folder id %s could not be found in the database % 
self.folder_id



folder_id is a number. What could be done to avoid this problem?

Thank you in advance for the help.

Regards
Marco
begin:vcard
fn:Marco Bizzarri
n:Bizzarri;Marco
org:Icube S.r.l.
adr:;;via Ridolfi 15;Pisa;PI;56124;Italy
email;internet:[EMAIL PROTECTED]
title:Amministratore Delegato
tel;work:+39-050-970-207
tel;fax:+39-050-3136-588
tel;cell:+39-348-640-4861
x-mozilla-html:FALSE
url:http://notenotturne.blogspot.com/
version:2.1
end:vcard

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


  1   2   >