[Zope-Checkins] SVN: Zope/trunk/ Merged 2.10 branch r70085:70086 and r70356:70357 into the trunk.

2006-12-14 Thread Stefan H. Holek
Log message for revision 71555:
  Merged 2.10 branch r70085:70086 and r70356:70357 into the trunk.
  
  Collector #2187: PUT_factory broken.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZPublisher/BaseRequest.py
  A   Zope/trunk/lib/python/webdav/tests/testPUT_factory.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2006-12-14 21:52:49 UTC (rev 71554)
+++ Zope/trunk/doc/CHANGES.txt  2006-12-15 07:42:41 UTC (rev 71555)
@@ -109,6 +109,8 @@
 
   - The defaultView directive now only looks up views, not attributes.
 
+  - Collector #2187: PUT_factory broken (fwd port from 2.10 branch).
+
 Other Changes
 
   - Disabled docutils file inclusion completely, rather than trying

Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-12-14 21:52:49 UTC 
(rev 71554)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-12-15 07:42:41 UTC 
(rev 71555)
@@ -72,37 +72,41 @@
 if name[:1]=='_':
 raise Forbidden(Object name begins with an underscore at: %s % 
URL)
 
-try:
-if hasattr(object,'__bobo_traverse__'):
+
+if hasattr(object,'__bobo_traverse__'):
+try:
 subobject=object.__bobo_traverse__(request, name)
 if type(subobject) is type(()) and len(subobject)  1:
 # Add additional parents into the path
-# XXX This needs handling. Check the publish refactor 
branch...
-parents[-1:] = list(subobject[:-1])
-object, subobject = subobject[-2:]
+# XXX There are no tests for this:
+request['PARENTS'][-1:] = list(subobject[:-1])
+object, subobject = subobject[-2:]
+except (AttributeError, KeyError, NotFound), e:
+# Try to find a view
+subobject = queryMultiAdapter((object, request), Interface, 
name)
+if subobject is not None:
+# OFS.Application.__bobo_traverse__ calls
+# REQUEST.RESPONSE.notFoundError which sets the HTTP
+# status code to 404
+request.response.setStatus(200)
+# We don't need to do the docstring security check
+# for views, so lets skip it and return the object here.
+return subobject.__of__(object)
+# No view found. Reraise the error raised by __bobo_traverse__
+raise e
+else:
+# No __bobo_traverse__
+# Try with an unacquired attribute:
+if hasattr(aq_base(object), name):
+subobject = getattr(object, name)
 else:
-# Try getting unacquired attributes:
-if hasattr(aq_base(object), name):
-subobject = getattr(object, name)
-else:
-subobject=object[name]
- 
-except (AttributeError, KeyError, NotFound), e:
-# Nothing was found with __bobo_traverse__ or directly on
-# the object. We try to fall back to a view:
-subobject = queryMultiAdapter((object, request), Interface, name)  
  
-if subobject is not None:
-# OFS.Application.__bobo_traverse__ calls
-# REQUEST.RESPONSE.notFoundError which sets the HTTP
-# status code to 404
-request.response.setStatus(200)
-# We don't need to do the docstring security check
-# for views, so lets skip it and return the object here.
-return subobject.__of__(object)
+# We try to fall back to a view:
+subobject = queryMultiAdapter((object, request), Interface, 
name)
+if subobject is not None:
+return subobject.__of__(object)
 
-# And lastly, of there is no view, try acquired attributes, but
-# only if there is no __bobo_traverse__:
-if not hasattr(object,'__bobo_traverse__'):
+# And lastly, of there is no view, try acquired attributes, but
+# only if there is no __bobo_traverse__:
 try:
 subobject=getattr(object, name)
 # Again, clear any error status created by 
__bobo_traverse__
@@ -111,8 +115,11 @@
 return subobject
 except AttributeError:
 pass
-raise e
 
+# Lastly we try with key access:
+subobject = object[name]
+
+
 

[Zope-dev] Zope Tests: 7 OK

2006-12-14 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Wed Dec 13 12:00:00 2006 UTC to Thu Dec 14 12:00:00 2006 UTC.
There were 7 messages: 7 from Zope Unit Tests.


Tests passed OK
---

Subject: OK : Zope-2.6 Python-2.1.3 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:07:39 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006817.html

Subject: OK : Zope-2.6 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:09:09 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006818.html

Subject: OK : Zope-2.7 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:10:40 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006819.html

Subject: OK : Zope-2.8 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:12:10 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006820.html

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:13:40 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006821.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:15:10 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006822.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Wed Dec 13 21:16:40 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006823.html

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


Re: [ZWeb] zope.org wiki without cookies?

2006-12-14 Thread Simon Michael

Hi Christian, all

Zwiki always tried to keep login effort to a minimum; until now, the 
lightweight optional username cookie has been enough. (It's no longer 
optional on wiki.zope.org of course.)


There has been talk of moving up to the next level, ie some kind of real 
authentication and member management, partly prompted by one or two 
persistent vandal incidents (swiftly reverted by Michael H.). I'm undecided 
myself, but do you have any ideas for a good, low-labour setup ?


I'm aware of two Zope 2 products that manage membership - Plone and the 
venerable exUserFolder.


-Simon


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


Re: [Zope] if object does not exist in python

2006-12-14 Thread Chris Withers

Garito wrote:

Checks for named object inside the container that the script is in.
  

hasattr(container, 'id')


NO!

This is bad for two reasons:

1. It'll acquire id from other places

2. It'll swallow any exceptions found in trying to get hold of 'id', 
inlcuding ConflictErrors, which is bad :-S


cheers,

Chris

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

___
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] acquisition

2006-12-14 Thread Peter Bengtsson



Dennis Schulz wrote:
I found no example how to define it in the class generally for all 
instances


i would like to access the supplier container under a different name 
inside one instance of Purchase Requisition.


class PurchaseRequisition( SimpleItem, Implicit ):

suppliers = property ( lambda self: str( 
self.context.aq_inner.aq_parent.supplier) )



Keep it simple like Andreas suggested::

from Acquisition import aq_inner, aq_parent
class PurchaseRequisition( SimpleItem, Implicit ):

def suppliers(self):
parent = aq_parent(aq_inner(self))
return parent.supplier

# does exactly the same thing thanks to automatic
# acquisition:
def suppliers(self):
return self.supplier






Andreas Jung escribió:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 13. Dezember 2006 19:12:13 +0100 Dennis Schulz 
[EMAIL PROTECTED] wrote:


 

Hi

I want to acquire an persistent zope object (supplier) that is inside my
productfolder

myproductfolder/supplier

How to get a reference to this object? Also, Is there a method to get 
the

product root?




context.myproductfolder.supplier?

That's basic acquisition and should be documented in the Zope Book:

http://www.plope.com/Books/2_7Edition/Acquisition.stx

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFgEOjCJIWIbr9KYwRAs/LAJ9ROWS1ArpGH/Mf5+7CesUjXRdGTwCg6U66
BUalSLllgOaxmn4C0kBiCns=
=E1/0
-END 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 )



--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.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] Questions about demostorage

2006-12-14 Thread Duncan Booth
Can someone explain to me what is and is not safe to do with demostorage?

Say I have a zope setup involving a zeo server and clients, and I create 
another zope instance with demostorage wrapped around both zeoclient 
mounts (the catalogs are mounted separately from the rest of the content).
The main zope setup remains active while I'm using the demostorage setup, 
so content will be added/edited or deleted in the zeo zodb.

A bit of experimenting seems to indicate if I edit an object in the main 
system, the demostorage version picks up the changes until such time as I 
edit the same object in the demostorage instance. (So in other words, the 
connection from the demostorage front-end to the zeo-client isn't frozen at 
the point when the storage is opened which might have been a plausible 
alternative).

What I'm a little worried about is the catalog. I'd guess that there is no 
guarantee that the demostorage instance gets a catalog which is consistent 
with the rest of the data (so I could easily get site errors in the 
demostorage instance), but there should be no danger that any changes I 
make can affect the live site and restarting the demo instance would get it 
back into a consistent state, at least for a while. Is that a reasonable 
interpretation?

What I'm hoping to achieve is a way of testing upgrades on our live system 
in an environment as close as possible to the real live environment, but 
without actually affecting the live system in any way. Demostorage seems to 
offer that as an option.

___
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] Zope, setlocale(), requests and traversal

2006-12-14 Thread Doyon, Jean-Francois
Hello,

I know there is a locale setting in etc/zope.conf, and I make use of it.

The problem now, is that I have a multilingual site that I would like to have 
support multiple locales, per request:  One request could be for the french 
site and content, using the fr_CA locale in my case, but another could be for 
english, and en_CA ... Localization is done through a traversal hook.

So right now I call setlocale() on a per request basis, and it works fine in 
development.

So I'm wondering:

- I see the docs mention setlocale might not be threadsafe, since Zope is 
threaded, anyone know the implications?
- If I call setlocale() during traversal, could that setting affect other 
threads/requests?
- If the above 2 are indeed problems, is there some nice way to do set 
per-request locales, short of completely implementing a custom way of doing it?

Thanks!

Jean-François Doyon
Internet Service Development and Systems Support / Spécialiste de 
dèveloppements internet et soutien technique
Canada Centre for Remote Sensing/Centre Canadien de télédétection
Natural Resources Canada/Ressources Naturelles Canada
http://atlas.gc.ca
Tel./Tél.: (613) 992-4902
Fax: (613) 947-2410
___
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 )


A Solution to: [Zope] Zope, setlocale(), requests and traversal

2006-12-14 Thread Doyon, Jean-Francois
Hello,

OK, I found out the issues, and came up with a solution, if any one cares :)

Requirements:

- A get_request patch
- A REQUEST object that will have the necessary information to locaize from 
(language code, etc ...)

How I do it:

- Copy Python lib's locale.py to your product
- import Globals
- Force locale emulation, I do it by raising an ImportError when importing 
_locale
- Hardcode the dicts that contain the usual localconv() output for the locales 
you're interested in
- Edit the localeconv() emulation to get the request, and from there get the 
localization information somehow (I base it on HTTP_ACCEPT_LANGUAGE for 
example), and then return the dict information.
- import locale in __init__.py

Works great for me, and was pretty straightforward.

Notes:

- You might be able to do this through monkey patching ... I copy the module 
because I'm using 2.5's locale module with 2.4 ... To get currency() support.
- You might want to put Module security declarations in there somewhere.
- Nice benefit that you can easily change the number/currency parameters to 
your liking, if needed.

Some code (Sorry can't just share/open source it all, due to my employer's 
policies):

...
# Zope imports
import Globals
from Products.CMFCore.utils import getToolByName
...
try:

# from _locale import *
raise ImportError

except ImportError:

# Locale emulation
...
def localeconv():
 localeconv() - dict.
Returns numeric and monetary locale-specific parameters.

request = Globals.get_request()
portal_localizer = getToolByName(request.get('PUBLISHED'), 
'portal_localizer')
locale_suffix = portal_localizer.getProperty('locale_suffix')
return LOCALECONV[request.get('HTTP_ACCEPT_LANGUAGE', 'en') + 
locale_suffix]
...
LOCALECONV = {'en_CA':
  {'mon_decimal_point': '.',
   'int_frac_digits': 2,
   'p_sep_by_space': 0,
   'frac_digits': 2,
   'thousands_sep': ',',
   'n_sign_posn': 1,
   'decimal_point': '.',
   'int_curr_symbol': 'CAD ',
   'n_cs_precedes': 1,
   'p_sign_posn': 1,
   'mon_thousands_sep': ',',
   'negative_sign': '-',
   'currency_symbol': '$',
   'n_sep_by_space': 0,
   'mon_grouping': [3, 3, 0],
   'p_cs_precedes': 1,
   'positive_sign': '',
   'grouping': [3, 3, 0]},
  'fr_CA':
  {'mon_decimal_point': ',',
   'int_frac_digits': 2,
   'p_sep_by_space': 1,
   'frac_digits': 2,
   'thousands_sep': ' ',
   'n_sign_posn': 0,
   'decimal_point': ',',
   'int_curr_symbol': 'CAD ',
   'n_cs_precedes': 0,
   'p_sign_posn': 1,
   'mon_thousands_sep': ' ',
   'negative_sign': '-',
   'currency_symbol': '$',
   'n_sep_by_space': 1,
   'mon_grouping': [3, 3, 0],
   'p_cs_precedes': 0,
   'positive_sign': '',
   'grouping': []}
 }
/...

Hope this comes in handy to someone!

J.F.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doyon, 
Jean-Francois
Sent: December 14, 2006 9:23 AM
To: zope@zope.org
Subject: [Zope] Zope, setlocale(), requests and traversal

Hello,

I know there is a locale setting in etc/zope.conf, and I make use of it.

The problem now, is that I have a multilingual site that I would like to have 
support multiple locales, per request:  One request could be for the french 
site and content, using the fr_CA locale in my case, but another could be for 
english, and en_CA ... Localization is done through a traversal hook.

So right now I call setlocale() on a per request basis, and it works fine in 
development.

So I'm wondering:

- I see the docs mention setlocale might not be threadsafe, since Zope is 
threaded, anyone know the implications?
- If I call setlocale() during traversal, could that setting affect other 
threads/requests?
- If the above 2 are indeed problems, is there some nice way to do set 
per-request locales, short of completely implementing a custom way of doing it?

Thanks!

Jean-François Doyon
Internet Service Development and Systems Support / Spécialiste de 
dèveloppements internet et soutien technique Canada Centre for Remote 
Sensing/Centre Canadien de télédétection Natural Resources Canada/Ressources 
Naturelles Canada http://atlas.gc.ca
Tel./Tél.: (613) 992-4902
Fax: (613) 947-2410
___
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 

[Zope] Zope 2.9.5 - 2.9.6 DateTime Change

2006-12-14 Thread Brian Brinegar
Today I started testing Zope 2.9.6. After the upgrade I noticed that
some calendar data generated from Oracle was wrong. After some
investigation I found that Zope 2.9.6 seems to assign a timezone of
GMT+0 when none is specified rather than using the server's timezone.

For example, the following SQL query to an oracle database:

select TO_DATE('12-13-2006 01:00','MM-DD- HH:MI') from dual

Under 2.9.5 returns:

 2006/12/13 01:00:00 US/Eastern

Under 2.9.6 returns:

 2006/12/13 01:00:00 GMT+0

There was clearly no time zone defined in the query, and it's the same
Oracle server.

Is this an intended change? We have hundreds of developers working
independently within our system so it's not possible to adapt each
application to account for this change.

Any advice on moving to Zope 2.9.6? In the mean time I my try to back
port specific bug fixes into 2.9.5.

Thank you,
-- 
Brian Brinegar
Web Systems Developer
Engineering Computer Network
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Zope 2.9.5 - 2.9.6 DateTime Change

2006-12-14 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Brian Brinegar wrote:
 Today I started testing Zope 2.9.6. After the upgrade I noticed that
 some calendar data generated from Oracle was wrong. After some
 investigation I found that Zope 2.9.6 seems to assign a timezone of
 GMT+0 when none is specified rather than using the server's timezone.
 
 For example, the following SQL query to an oracle database:
 
 select TO_DATE('12-13-2006 01:00','MM-DD- HH:MI') from dual
 
 Under 2.9.5 returns:
 
  2006/12/13 01:00:00 US/Eastern
 
 Under 2.9.6 returns:
 
  2006/12/13 01:00:00 GMT+0
 
 There was clearly no time zone defined in the query, and it's the same
 Oracle server.
 
 Is this an intended change? We have hundreds of developers working
 independently within our system so it's not possible to adapt each
 application to account for this change.
 
 Any advice on moving to Zope 2.9.6? In the mean time I my try to back
 port specific bug fixes into 2.9.5.

That backwards incompatibility has been reverted on the 2.9 branch.  You
might try updating the 'DateTime.py' file from SVN:


http://svn.zope.org/*checkout*/Zope/branches/2.9/lib/python/DateTime/DateTime.py?content-type=text%2Fplainrev=71544

Eventually the feature will be re-added with a configuration option to
enable it.


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

iD8DBQFFgb3P+gerLs4ltQ4RAp2DAKDWmqql37CWa5VDYRIJoTLJ3wWtAACg2Kok
MjwihrnRUhXthDj5LCLFliY=
=CQvY
-END 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 )