Re: [Zope] Trying ZODB with a background in RDBMS

2008-08-17 Thread Dieter Maurer
Chris Withers wrote at 2008-8-16 23:09 +0100:
> ...
>How important is it that they're strictly incremental?
>If it is, you may want to look at the BTrees.Length module.

"BTrees.Length" is unfit for the generation of unique ids, as
it may hand out the same id to concurrent transactions.

Other solution may do this as well but for them a "ConflictError"
may be risen at transaction commit in this case.
The "BTrees.Length"'s conflict resolution prevents such a "ConflictError".


"Btrees.Length" might be used *PROVIDED* that the conflict
is recognized at another place (e.g. by a folder that stores
objects with the generated ids). But that are special cases.



-- 
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] python split

2008-08-17 Thread Andrew Milton
+---[ Garry Saddington ]--
| Is it possible to split a string at the first occurence of a non-digit 
| character using a python script in zope, or does this need an external method 
| for security purposes?

You can explicitly allow the re module if you want to split using a regex

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


Re: [Zope] python split

2008-08-17 Thread Andreas Jung



--On 17. August 2008 16:29:38 +0100 Garry Saddington 
<[EMAIL PROTECTED]> wrote:



Is it possible to split a string at the first occurence of a non-digit
character using a python script in zope, or does this need an external
method  for security purposes?


You can implement a brute-force solution using an iteration using a 
PythonScript or you use a regular expression (requiring an external method, 
a browser view or any other form of "trusted code".


-aj

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


[Zope] python split

2008-08-17 Thread Garry Saddington
Is it possible to split a string at the first occurence of a non-digit 
character using a python script in zope, or does this need an external method 
for security purposes?
regards
garry
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] uncataloging

2008-08-17 Thread Dieter Maurer
Jens Vagelpohl wrote at 2008-8-16 11:45 +0200:
>
>On Aug 16, 2008, at 11:06 , Dieter Maurer wrote:
>
>> The easiest way to determine the "uid" is probably
>> to locate the object via a catalog search. You will get a catalog  
>> proxy
>> for the object, often also called "brain".
>> This proxy has the method "getPath()"
>> which returns the object's "uid" -- don't ask about the inconsistent
>> naming (at one place "uid", at another one "path").
>
>The naming is not inconsistent. The UID happens to be the path by  
>default, but it doesn't need to be. The getPath method returns the  
>path, not the UID.

You err with the last sentence (which indicates that consistent
naming *is* important):

  "CatalogBrain.getPath" is mapped to "ZCatalog.getpath"
  which is mapped to "Catalog.paths".

  And the comment in "Catalog" says 
  
# self.uids is a mapping of the
# object unique identifier to the rid, and self.paths is a
# mapping of the rid to the unique identifier

  The code confirms this comment:

self.uids[uid] = index
self.paths[index] = uid


Thus, "getPath" *DOES* return the uid and not the path.



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