[Zope-dev] Multithread transaction problems in ZODB

2001-09-26 Thread Cyril Elkaim

Hi,

   We are testing ZODB directly from Python and have a multitread 
ConflictError problem.

   In short :-) if we open a connection in a first thread, then a second 
connection in a second thread and then commit the first one and then the 
second (the transactions are so interlaced)...

   Not only we have the ConflicError, even if obviously we do not modify 
or create the same objects. But in fact the last transaction doesn't 
even have its own objects saved.

   We are using ZODB from Zope 2.4. We have a similar problem using 
Berkeley Storage too (beta4).

   If the two threads are serialized eveything works fine (but that's no 
more multithreading no? ;-)

   So is it possible to access ZODB from a multithreaded application?


Thanks in advance

    Cyril Elkaim


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] manage_main don't work with Mozilla

2001-03-15 Thread Cyril Elkaim


Brian wrote:

>I think what he's saying is that Moz used to tolerate a 
>form like:

>
>...
>

>...which doesn't make much sense (and appeared in the Zope 
>UI by mistake). I believe that it is still ok to use the 
>XHTML form for non-container tags, e.g.:

>

>The 'select' tag problem in the Zope UI has since been fixed
>and the fix will be in 2.3.1 b2 (out today).


YES!

Cyril 

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] manage_main don't work with Mozilla

2001-03-15 Thread Cyril Elkaim

   
Matt wrote:
> should have a corresponding  right?  In which case no,
>it should not have a trailing slash.  They are only needed for single tags
>that have no corresponding close, eg   etc.

  I agree but in the management interface of Zope it's not the case. You
have  Some stuff...  and you should have
 stuff . That's the reason why it doesn't work anymore with
Mozilla.

Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] manage_main don't work with Mozilla

2001-03-15 Thread Cyril Elkaim

Yes, I know, but that's what they say :-). I've already that problem with
the script tag and they refuse to change this behavior, at least for now...

 Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] manage_main don't work with Mozilla

2001-03-15 Thread Cyril Elkaim


   Hi,

   The last builds of Mozilla do not accept anymore this kind of HTML tags:

   I have discuss with Moz developers and they say it's not in the standard.
So now we must use something like . All the other tags must follow
the same syntax, of course.

The problem with the management interface of Zope is it uses '/>' in many
places. So it's not possible to use Moz for creating new objects for example.

So should it be possible to do something about it :-)

Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Python Script

2001-02-23 Thread Cyril Elkaim

   Thanks Steve, I will try...

   Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Python Script

2001-02-23 Thread Cyril Elkaim

Steve Alexander wrote:
>   for name,object in container.objectItems():
> if string.strip(name) == image:
>   image_width = int(object.getProperty("width"))
>   image_height = int(object.getProperty("height"))

Thanks again :-), I passed too much time with Javascript and not enough
with Python, but that will changed soon :-)

Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Python Script

2001-02-23 Thread Cyril Elkaim

   Hi Steve,

In the zclass definition I have a bunch of Image objects together with the
following script.

SCRIPT s_center(width, height, image):

import string

result = None

for item in container.objectItems():
  if string.strip(item[0]) == image:
image_width = int(item[1].getProperty("width"))
image_height = int(item[1].getProperty("height"))

left = (int(width) - image_width) / 2
top = (int(height) - image_height) /2

result = "left:" + str(left) + "px; top:" + str(top) + "px"

return result

/END_SCRIPT

This script works fine if I test it inside the test tabs of the zclass. But
if I run it from an instance 'container.objectItems()' returns nothing. I 
understand why but my problem is how to get access of the images from
the instance.

What I need is something giving a reference to the zclass definition from
one of its instance. I think I can use the DOM model and walk through until
I find it but it should be better to have a direct access from the instance
itself, wrong?

Thanks,

Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Python Script

2001-02-23 Thread Cyril Elkaim

   Thanks Steve,

> In this case, container is the ZClass instance.

Understood, that was my conclusion and it's logical.

One more question please :-)

How can I access the methods definitions of the zclass from an instance ?

I don't talk about calling them but getting an 'attribute' of the zclass
knowing only its name at _runtime_ not _compile_ time?

Thanks,
Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Python Script

2001-02-23 Thread Cyril Elkaim


   Hi All,

I must say that I have very hard time with both Scripts and Zclass.
My problem is the context and the container proprties of a script inside a Zclass.

If I understand well the context is an URL point of view, the object accessed
through the web.

The container is fixed, it's the object in the database, OK?

Now what is the container in the case of a Zclass _instance_. When I test
a script inside the zclass _definition_ the container.objectItems() returns
correctly all the other methods of the definition. When I run the script
inside an _instance_ of that zclass it returns nothing.

So is an instance the same container of its zclass definition or something
else?

What I should want to do is to access the images inside a zclass definition
from the script running in an _instance_ 'context' of that zclass.

BTW some pointers explaining the hierarchy in both the URL point of view
and the database point of view would be very welcomed :-)

Thanks in advance,
Cyril



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Cyril Elkaim

   
   Erik,
 
>What do you need the reference for?  How are you going to use it?  And
>when you're talking about «inside ZODB», does that mean that you're
>not using Zope to access it?

 I'm using Zope but I made up my application by components. So I want
to access an object anywhere in the database even if it's not in the URL path.
Anyway, it's not a big problem for now.


>Shouldn't be a problem.  Also have a look at objectValues(),
>objectIds() and objectItems() in lib/python/OFS/ObjectManager.py;
>around line 320.  They could save you some time.

I'll take a look at it.

Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Cyril Elkaim

   
   Eric,

   Thanks that works :-) And you know what I've tried that before posting
but inside the test tab of my zclass. I should tried it inside the client Folder.

Anyway that's OK.

>I'm not quite sure what you mean, could you elaborate please?  Do you
>mean like you want to search for any object and get a reference
>(kewords: ZCatalog, getobject and searchResults) or just to have a
>HTML link (keywords: relative_url and absolute_url) or what?  :)

  I want to give the id (eventually qualified) of an object and get
a reference to it. I'm talking about persistent objects inside the ZODB.

  A question is the ZODB using the DOM? Because getparentNode() is a DOM method.

  For example it should be interesting to walk through the database using only
DOM methods. Is that the case ? with them I can anywhere I want. I'm using
Mozilla exclusivley and all my Javascript code use the DOM so I will be
'at home'.

Maybe all that questions already answered, sorry if that's the case.

Thanks,
Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Cyril Elkaim


   Hi all,

My question is in the title. I think I'm stupid because I have really searched
 anywhere, and found nothing. The answer is certainly trivial but too many hours
you know... :-)

I'm able to get all the children of the current container or context but unable
to get its parent. Maybe it's silly but a 'parent' property for all the 
objects seems to me a good idea. Of such a property may already exist but what is
its name ?

Of course I have tried REQUEST.PARENTS[0] but this is the parent inside the
URL, I'm searching the PARENT inside the object system.

Another question how can I get a reference of any object in OBJECT system,
I've tried unrestrictedTraverse but it seems very 'restrictive' :-)

Aside from my problems Zope rocks really.

Thanks in advance
Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )