Re: [Zope] Zope hangs and Python eats all memory

2007-02-08 Thread Nico Grubert
I am running Zope 2.9.6. on a 64-Bit Suse Linux 10.1 machine (9 Gbyte of 
RAM) with Python 2.4.3. installed.
From time to time, Zope hangs and I cannot access it anymore. I tried 
to use the "Zope DeadlockDebugger" but if my Zope hangs I cannot call 
the URL "http://myzopesite:8080/manage_debug_threads?secret_password"; to 
let Zope DeadlockDebugger show any useful information. Zope does not 
response.
If Zope hangs, the python process eats all the memory and the machine 
starts to swap.


I think I have found the reason for this problem:

  The problem comes from a python segmentation fault caused by either
  "egenix mxODBCDA" database adapter or "Easysoft ODBC-ODBC Bridge".


Here is a short description about the problem:
---
From a linux machine I am accessing a remote windows 2003 server machine
to query a Filemaker Pro database. I have "Easysoft ODBC-ODBC Server 
2.0.6 for Windows" installed in my windows machine.


On my linux machine I use the "unixODBC" (Easysoft ODBC-ODBC Client 
2.0.6 for Linux) driver and the Zope product "mxODBCZopeDA" to query the 
Filemaker Database.


After I started Zope and make a few SQL queries, the Zope server shuts
down with a "Segmentation fault".
At the same time there is a log entry on my linux machine in
/var/log/messages that reads:
Jan 23 10:43:09 smut kernel: python[6231]: segfault at 
rip 0043c0d7 rsp 417f6ad0 error 4

From time to time Zope even hangs and eats all memory until the whole 
machine hangs completely. Every time this happen, the last entry in 
/log/trace.log is a request to a Zope Page Template where 
a ZSQL method is called to query the ODBC source (Filemaker). At the 
same time there is a "python segmentation fault" log entry on my linux 
machine in /var/log/messages.


One of the developers of the "mxODBCZopeDA" product told me the error is
definitely coming from the ODBC-ODBC bridge.

However, I can query the Filemaker database and get nice results but
after a while my Zope server shuts down with the error messages above. I
don't do any SQL INSERT or SQL UPDATE. I just do some SQL
"SELECT...FROM...WHERE..." queries.

My setup:
  + 64-Bit Suse Linux 10.1 Professional
  + unixODBC & unixODBC-devel 2.2.11
  + Easysoft ODBC-ODBC Client 2.0.6 for Linux
  + Easysoft ODBC-ODBC Server 2.0.6 for Windows
  + ODBC Source: Filemaker Pro 8 Advanced Server on a Windows2003 Server
  + Python 2.4.3.
  + Zope 2.9.6.
  + mxODBCZopeDA 1.0.10


On a 32-Bit Suse 9.2 with unixODBC & unixODBC-devel 2.2.9, Python 2.5.3. 
and Zope 2.8.8. installed this error never occured. The segmentation 
fault only occurs on my 64 bit OS as described above.


I'm waiting for an answer from the Easysoft ODBC-ODBC support but I'm 
gonna try to update Python 2.4.3. to 2.4.5. in order to see if it may 
solve the problem.



Thanks to Dieter, Suresh and Paul.

Nico
___
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 form server and workflow

2007-02-08 Thread Jonathan


- Original Message - 
From: "Tim Nash" <[EMAIL PROTECTED]>

To: "Jonathan" <[EMAIL PROTECTED]>
Sent: Thursday, February 08, 2007 8:08 PM
Subject: Re: [Zope] zope form server and workflow



Thanks for your comment. I am interested in zope partly because it
does seem to be perfect for REST while python is well suited for JSON.
If you know of any open source zope or plone applications that are
particularly RESTful please let me know. I'd like to learn from others
rather than re-invent. Deciding how to slice your resources up into
http calls seems to me to be a lot like defining an object hierarchy.
Experience matters.


To me REST is a 'design philosophy' rather than a technology and can be 
implemented using almost any infrastructure (but zope is a really good place 
to start!)...  if you are interested in JSON here is some info on a zope 
implementation: http://zif.hill-street.net/jsonserver



Jonathan



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

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


Re: [Zope] emulate a sequence

2007-02-08 Thread Dieter Maurer
Yuri wrote at 2007-2-8 15:09 +0100:
> I need a field in zope object which act as a sequence. I mean every 
>time I create an object, the value is the previous sequence value of the 
>last object created + 1.
>
> also I need to browse the objects by sequence (from the object 1 to the 
>last, by the sequence number)
>
> I think I need a catalog FieldIndex to store the sequence for searches, 
>a property in the object.
>
> Can I use the catalog to retrieve the max value of the index, so when I 
>create the object, I just add 1 and store it in the property?

You can -- but it is unsafe (concurrent transaction can see the same
value and you may use the same id for different objects).

A better alternative is to implement the sequence object directly --
as a persistent object with an integer attribute (and a method to
fetch the next value).



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


Re: [Zope] ZODB access via ZEO

2007-02-08 Thread Dieter Maurer
Adit Ranadive wrote at 2007-2-7 14:10 -0500:
> ...
>Im trying to read from the data.fs file plone product information like home
>attributes.
>Im doing this via ZEO using app.Control_Panel.Products.getObjectItems()
>This returns to me a set of (object ids, objects). Using the object I change 
>the
>home attribute.
>When I restart the script the home attribute is the same as it was before. So
>the change did not take place in the database.
>Is there any way to check back in the retrieved object from data.fs?

I see too possibilities:

  1. You forgot the "import transaction; transaction.commit()"
 to make your changes persistent

  2. The objects in "Control_Panel.Products" can be modified
 during startup for file systems based objects.



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


Re: [Zope] ZPT problems upgrading 2.9.6 to 2.10.2

2007-02-08 Thread Dieter Maurer
Pablo Ziliani wrote at 2007-2-6 21:26 -0300:
>As I mentioned in my previous email I'm in the middle of an upgrade from 
>2.9.6 to 2.10.2, and getting (at least) a couple of errors:
>Sometimes when a ZPT that gets content from the database (postgres, 
>psycopg 2.0.4) is called, it raises the following UnicodeDecodeError:

Zope 2.10 now uses the ZPT implementation of Zope 3 and this
internally works with Unicode.

Therefore, it is likely that more "UnicodeError"s can occur.

In the latest Zope version, Andreas has provided ways to customize
how strings are converted into unicode by the ZPTs.



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


Re: [Zope] cpu load 99 percent a lot in plone evinironment

2007-02-08 Thread Dieter Maurer
Marko Kruijer wrote at 2007-2-5 14:20 +0100:
> ...
>The page loops over a results set from mysql, this set contains 400 - 
>500 results.
>I've noticed that if it loops over 500 results instead of i.e. 20 the 
>page takes almost 3 to 4 seconds longer to load.
>
>I've never seen this kind of behaviour before (i have seen it with bad 
>queries and such, but thats not the case here).

You probably should profile your long running request to find out
where the time is spent.



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


[Zope] PAS Plugin

2007-02-08 Thread javi lopez

Hello everyone and thanks for your help!

I am doing a plugin for PAS and put on that plugin two methods:

authenticatedCredentials and extractCredentials

First works ok, but extract don´t work, it is its code:

creds = {}
   login = request.get('__ac_name', '')

   if login:
   # Look in the request for the names coming from the login form
   login = request.get('__ac_name', '')
   password = request.get('__ac_password', '')

   if login:
   creds['login'] = login
   creds['password'] = password

   if creds:
   creds['remote_host'] = request.get('REMOTE_HOST', '')

   try:
   creds['remote_address'] = request.getClientAddr()
   except AttributeError:
   creds['remote_address'] = request.get('REMOTE_ADDR', '')

   return creds


it looks as if it working because it put welcome user, but when I
press "Continue to the portal" and I go to start page,the user of the
portal isn´t already validate.
What can i do???Thanks
I want to sustitute credentials_cookie_auth and credentials_basic_auth
for my plugin.Thanks again
___
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] emulate a sequence

2007-02-08 Thread Jonathan


- Original Message - 
From: "Tino Wildenhain" <[EMAIL PROTECTED]>

To: "Jonathan" <[EMAIL PROTECTED]>
Cc: "Yuri" <[EMAIL PROTECTED]>; 
Sent: Thursday, February 08, 2007 9:36 AM
Subject: Re: [Zope] emulate a sequence



Jonathan schrieb:


- Original Message - From: "Yuri" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, February 08, 2007 9:09 AM
Subject: [Zope] emulate a sequence


I need a field in zope object which act as a sequence. I mean every time 
I create an object, the value is the previous sequence value of the last 
object created + 1.


also I need to browse the objects by sequence (from the object 1 to the 
last, by the sequence number)


I think I need a catalog FieldIndex to store the sequence for searches, 
a property in the object.


Can I use the catalog to retrieve the max value of the index, so when I 
create the object, I just add 1 and store it in the property?


You could use a catalog if you have other searching requirements, but the 
method objectIds() (see the zopebook for more info) will return a list of 
contained Ids, which you can then sort to get you what you need.  Also, 
len(somefolder.objectIds()) will give you the next available id (assuming 
your object ids have some sequential numbering).


Which both would not exacly emulate a sequence. Sequences live outside
transaction borders so they are inremented every time under any 
circumstances.


All the above methods would fall flat on the tummy when you are hit with 
variuos rollback or retries while other transactions concurrently add 
objects.


Tino has a good point.  For sites that will be saving (committing) many 
objects to the same folder (from simultaneous transactions) we use a 
randomly generated 10 digit id (which is then checked against existing 
object ids).  I have done some load testing with this approach and it has 
worked (so far!).


Jonathan


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

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


Re: [Zope] emulate a sequence

2007-02-08 Thread Tino Wildenhain

Jonathan schrieb:


- Original Message - From: "Yuri" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, February 08, 2007 9:09 AM
Subject: [Zope] emulate a sequence


I need a field in zope object which act as a sequence. I mean every 
time I create an object, the value is the previous sequence value of 
the last object created + 1.


also I need to browse the objects by sequence (from the object 1 to 
the last, by the sequence number)


I think I need a catalog FieldIndex to store the sequence for 
searches, a property in the object.


Can I use the catalog to retrieve the max value of the index, so when 
I create the object, I just add 1 and store it in the property?


You could use a catalog if you have other searching requirements, but 
the method objectIds() (see the zopebook for more info) will return a 
list of contained Ids, which you can then sort to get you what you 
need.  Also, len(somefolder.objectIds()) will give you the next 
available id (assuming your object ids have some sequential numbering).


Which both would not exacly emulate a sequence. Sequences live outside
transaction borders so they are inremented every time under any 
circumstances.


All the above methods would fall flat on the tummy when you are hit with 
variuos rollback or retries while other transactions concurrently add 
objects.


Regards
Tino
___
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] emulate a sequence

2007-02-08 Thread Jonathan


- Original Message - 
From: "Yuri" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, February 08, 2007 9:09 AM
Subject: [Zope] emulate a sequence


I need a field in zope object which act as a sequence. I mean every time I 
create an object, the value is the previous sequence value of the last 
object created + 1.


also I need to browse the objects by sequence (from the object 1 to the 
last, by the sequence number)


I think I need a catalog FieldIndex to store the sequence for searches, a 
property in the object.


Can I use the catalog to retrieve the max value of the index, so when I 
create the object, I just add 1 and store it in the property?


You could use a catalog if you have other searching requirements, but the 
method objectIds() (see the zopebook for more info) will return a list of 
contained Ids, which you can then sort to get you what you need.  Also, 
len(somefolder.objectIds()) will give you the next available id (assuming 
your object ids have some sequential numbering).


hth

Jonathan 


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

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


[Zope] emulate a sequence

2007-02-08 Thread Yuri

Hi!

I need a field in zope object which act as a sequence. I mean every 
time I create an object, the value is the previous sequence value of the 
last object created + 1.


also I need to browse the objects by sequence (from the object 1 to the 
last, by the sequence number)


I think I need a catalog FieldIndex to store the sequence for searches, 
a property in the object.


Can I use the catalog to retrieve the max value of the index, so when I 
create the object, I just add 1 and store it in the property?


TIA
___
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] documentation about the ":method"

2007-02-08 Thread Martijn Pieters

On 2/8/07, Manuel Spuhler <[EMAIL PROTECTED]> wrote:

quoted from http://www.plope.com/Books/2_7Edition/ScriptingZope.stx


Heh, I completely missed the fact that :method has been renamed to
:action. Thanks for the correction!

--
Martijn Pieters
___
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] documentation about the ":method"

2007-02-08 Thread Manuel Spuhler

Hello Martin,

quoted from http://www.plope.com/Books/2_7Edition/ScriptingZope.stx
"action
Appends the attribute value to the original form action of the form.
This is mostly useful for the case in which you have multiple submit
buttons on one form. Each button can be assigned to a script that gets
called when that button is clicked to submit the form. A synonym for
action is method."

so basically, I interpretted it like: 'foo:action' == 'foo:method',
but it's unclear. Thanks for your precision.

Manuel



2007/2/8, Martijn Pieters <[EMAIL PROTECTED]>:

On 2/7/07, Andreas Jung <[EMAIL PROTECTED]> wrote:
> 

Andreas, that doesn't speak a word about the form-field modifier 'method'.

> > I am looking for some documentation about the ":method" used in some
> > forms, for instance  name="discussion_reply:method", but can't find
> > anything.

If the request finds a form field ending in :method in the request,
the id before it is appended to the request URL. This way you can have
multiple callables (scripts, objects, methods, whatever) process the
information from one form, depending on what submit button was
pressed.

It works as follows:

1/ create a form that POSTS to server/path/
2/ use submit buttons named like 'foo:method' and 'bar:method'
3/ Create 'foo' and 'bar' in /path/ (or have them available there
through acquisition or skins)

Now, when a user clicks the 'foo:method' button, Zope receives a form
for server/path/, and modifies the request to go to server/path/foo
instead. If 'bar:method' was pressed, the request ends  up at
server/path/bar instead.

HTH,

--
Martijn Pieters


___
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] documentation about the ":method"

2007-02-08 Thread Martijn Pieters

On 2/7/07, Andreas Jung <[EMAIL PROTECTED]> wrote:




Andreas, that doesn't speak a word about the form-field modifier 'method'.


> I am looking for some documentation about the ":method" used in some
> forms, for instance  name="discussion_reply:method", but can't find
> anything.


If the request finds a form field ending in :method in the request,
the id before it is appended to the request URL. This way you can have
multiple callables (scripts, objects, methods, whatever) process the
information from one form, depending on what submit button was
pressed.

It works as follows:

1/ create a form that POSTS to server/path/
2/ use submit buttons named like 'foo:method' and 'bar:method'
3/ Create 'foo' and 'bar' in /path/ (or have them available there
through acquisition or skins)

Now, when a user clicks the 'foo:method' button, Zope receives a form
for server/path/, and modifies the request to go to server/path/foo
instead. If 'bar:method' was pressed, the request ends  up at
server/path/bar instead.

HTH,

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