[Zope-dev] Re: brain.getObject and traversal

2005-04-07 Thread Chris Withers
Andreas Jung wrote:
Chris wants to backport it to 2.7 x;  I'm opposed.  Your call.
If it does not change the default behaviour we have in 2.7.5... why not...
Cool, thanks, I'll look at merging for 2.7.6 :-)
cheers,
Chris
--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-04-06 Thread Andreas Jung

--On Mittwoch, 6. April 2005 10:16 Uhr +0100 Chris Withers 
[EMAIL PROTECTED] wrote:


 It is really up to
Andreas whether or not to accept such a change on the 2.7 line.
Andreas, whatcha think?
Sorry, I have to catch up with this thread. I thought the problem was 
solved by
Tres new configuration option.

-aj

pgpQeSFBv0tNI.pgp
Description: PGP signature
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-04-06 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andreas Jung wrote:
 
 
 --On Mittwoch, 6. April 2005 10:16 Uhr +0100 Chris Withers
 [EMAIL PROTECTED] wrote:
 

  It is really up to
 Andreas whether or not to accept such a change on the 2.7 line.


 Andreas, whatcha think?
 
 
 Sorry, I have to catch up with this thread. I thought the problem was
 solved by
 Tres new configuration option.

Chris wants to backport it to 2.7 x;  I'm opposed.  Your call.


Tres.
- --
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCU+T4GqWXf00rNCgRAmunAJ9KhHjABM6gcjsdFpfjz3OfQISUVACdFLQy
J9CiMRtEQu0CV4CRJxVEX+c=
=vinQ
-END PGP SIGNATURE-
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-04-06 Thread Andreas Jung

--On Mittwoch, 6. April 2005 9:32 Uhr -0400 Tres Seaver [EMAIL PROTECTED] 
wrote:

Chris wants to backport it to 2.7 x;  I'm opposed.  Your call.
If it does not change the default behaviour we have in 2.7.5... why not...
Andreas


pgp7uZ3q8EeTC.pgp
Description: PGP signature
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-04-04 Thread Chris Withers
Hi Tres,
We really need to follow a deprecation-style model here:  the risk of
breaking major third party components is pretty high.
Agreed. I see you started working on this, thanks!
Since this is a bug, and it looks like it's going to be fixed with a 
config option, would anyone mind if I ported this code to the 2.7 branch 
with the option set to do whatever 2.7.5 does?

The CHANGELOG should highlight the change, and include the zope.conf
snippet required to restore the old behavior.  We could add a
deprecation warning (if that entry is activated), that the old-style
option would be removed in 2.10.
Sounds good to me.
cheers,
Chris
--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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: [Zope-dev] Re: brain.getObject and traversal

2005-04-04 Thread Florent Guillaume
Chris Withers wrote:
Florent Guillaume wrote:
Ok, thanks a lot to Tres for having gone ahead and done that. I just
merged his branch. All 5645 tests pass (man, with Zope 3 included that's
way more than before!)
Did you check with Tres that his branc hwas ready to merge? ;-)
Yes.
Florent
--
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-04-04 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris Withers wrote:

 We really need to follow a deprecation-style model here:  the risk of
 breaking major third party components is pretty high.
 
 
 Agreed. I see you started working on this, thanks!
 
 Since this is a bug, and it looks like it's going to be fixed with a
 config option, would anyone mind if I ported this code to the 2.7 branch
 with the option set to do whatever 2.7.5 does?

- -0.  This change is not a bugfix -- this is a new feature, which changes
the documented behavior of the catalog brains.  It is really up to
Andreas whether or not to accept such a change on the 2.7 line.

 The CHANGELOG should highlight the change, and include the zope.conf
 snippet required to restore the old behavior.  We could add a
 deprecation warning (if that entry is activated), that the old-style
 option would be removed in 2.10.

Tres.
- --
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCUU1UGqWXf00rNCgRAlG7AJ4w88icN4H4pw7/ZtDSV22RlR41OACgoU9R
Ia2qEpT7DHGRKY7VbwYwxrk=
=NqFr
-END PGP SIGNATURE-
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-04-01 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Florent Guillaume wrote:
 Florent Guillaume  [EMAIL PROTECTED] wrote:
 
Unauthorized in getObject is out of the question, that would be new 
behaviour.

Well, in 2.8, new behaviour is expected, right?
I really passionately believe that we should not be returnining None in 
Zope 2.8, and since 2.8 hasn't quite hit beta yet I'm very keen to see 
it fixed asap.

Any objections?

I'm ok for 2.8. I'll look at it.
 
 
 Is everyone ok with returning
  - the object if it can be accessed
  - raise Unauthorized if it can't be accessed
  - raise NotFound if it's not there
 and never return None ?
 
 I'll change that before tomorrow, for 2.8a2.
 
 (I'll change NotFound in Traversal.py to a real exception instead of a
 string too, I thought we'd killed those.)

We really need to follow a deprecation-style model here:  the risk of
breaking major third party components is pretty high.

Could we use a module-scope global, settable from zope.conf, to indicate
which strategy to use?  It should (for 2.8) default to raising, but we
need to be prepared for an onslaught of breakage reports.

The CHANGELOG should highlight the change, and include the zope.conf
snippet required to restore the old behavior.  We could add a
deprecation warning (if that entry is activated), that the old-style
option would be removed in 2.10.


Tres.
- --
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCTWhlGqWXf00rNCgRAsZ8AKChKf3YvASZ1jmJGeeN4Y3PN9/0rACbBRgi
nGNOyVocQywRINr8FnyNTHg=
=cUAs
-END PGP SIGNATURE-
___
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: [Zope-dev] Re: brain.getObject and traversal

2005-04-01 Thread Dieter Maurer
Max M wrote at 2005-3-31 14:48 +0200:
 ...
Most of my queries, where I need to wake up objects, has the form::

 brains = catalog(portal_type='Document')
 objects = []
 for brain in brains:
 try:
 obj = brain.getObject()
 if not obj is None:
 objects.append(obj)
 except:
 pass

So it will not break any of my code, and I guess that most do something
similar.

Hopefully not:

   try: ... except: ... is a powerful receipe to hide
   problems and to get low quality code.

   They should be used *very* rarely...

-- 
Dieter
___
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: [Zope-dev] Re: brain.getObject and traversal

2005-04-01 Thread Florent Guillaume
Tres Seaver  [EMAIL PROTECTED] wrote:
  Is everyone ok with returning
   - the object if it can be accessed
   - raise Unauthorized if it can't be accessed
   - raise NotFound if it's not there
  and never return None ?
  
  I'll change that before tomorrow, for 2.8a2.
  
  (I'll change NotFound in Traversal.py to a real exception instead of a
  string too, I thought we'd killed those.)
 
 We really need to follow a deprecation-style model here:  the risk of
 breaking major third party components is pretty high.
 
 Could we use a module-scope global, settable from zope.conf, to indicate
 which strategy to use?  It should (for 2.8) default to raising, but we
 need to be prepared for an onslaught of breakage reports.
 
 The CHANGELOG should highlight the change, and include the zope.conf
 snippet required to restore the old behavior.  We could add a
 deprecation warning (if that entry is activated), that the old-style
 option would be removed in 2.10.

Ok, thanks a lot to Tres for having gone ahead and done that. I just
merged his branch. All 5645 tests pass (man, with Zope 3 included that's
way more than before!)

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
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 )


[Zope-dev] Re: brain.getObject and traversal

2005-03-31 Thread Max M
Chris Withers wrote:
Well, in 2.8, new behaviour is expected, right?
I really passionately believe that we should not be returnining None in 
Zope 2.8, and since 2.8 hasn't quite hit beta yet I'm very keen to see 
it fixed asap.

Any objections?
Most of my queries, where I need to wake up objects, has the form::
brains = catalog(portal_type='Document')
objects = []
for brain in brains:
try:
obj = brain.getObject()
if not obj is None:
objects.append(obj)
except:
pass
So it will not break any of my code, and I guess that most do something
similar.

Another thing is that I think that this pattern is so common that the
catalog should have a query method where brains are automatically
converted to objects. Like:
objects = catalog.getObjects(portal_type='Document')
That would be a handy time saver.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
___
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 )