Re: [Zope-dev] zope.app.form: Make no value always available?

2008-08-19 Thread Thomas Lotze
Roger Ineichen wrote:

 Since this is a miss behavior and I agree that this should get fixed. We
 probably should think about a solution which supports the old behavior by
 default.
 
 Note, this whould probably also break other packages like
 z3c.csvvocabulary.

We've thought about this some more. Our current suggestion is to implement
both behaviours using a class attribute for switching, with the base class
implementing the new, better one and a subclass setting the attribute
differently for BBB.

We'd like to register the base class with changed behaviour as the
default, though, in order to facilitate adoption of the new and better
implementation and provide an override registration for the BBB widget.
Applications would then have an easy migration path, having to add only
one line of ZCML after the zope.app.form update.

Also, we'd like to implement the new behaviour in such a way that the no
value value isn't shown for required fields that already have a valid
value set. What do others think about this?

Viele Grüße,
Thomas Lotze

-- 
Thomas Lotze · [EMAIL PROTECTED]
gocept gmbh  co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1
Zope and Plone consulting and development


___
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] python 2.4 + _zope_proxy_proxy.c

2008-08-19 Thread Adam GROSZER
Hello,

Seems that zope\app\container\_zope_proxy_proxy.c cannot be compiled
with MS compilers. With python 2.4.5, 2.4.4 and 2.4.3 on winXP.

eek, fails on linux too (debian etch+python 2.4.4)...

I'm not a C guru, with a help from a friend we figured that the
problem is the Py_ssize_t, which is available in python 2.5.

A workaround could be adding

#if PY_VERSION_HEX  0x0205  !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#endif

as proposed by

http://www.python.org/dev/peps/pep-0353/

Strange, that there is a zope.app.container-3.5.6-py2.4-win32.egg on
pypi.

-- 
Best regards,
 Adam GROSZER  mailto:[EMAIL PROTECTED]
--
Quote of the day:
A handful of friends is worth more than a wagon of gold.

___
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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Chris Withers
Hi All,

Why does the egg in the subject line exist and why does buildout pick it 
over a stable release?

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] [zopeproject] ZODB3 specified, but ZODB3 3.9.0-dev-r77011 egg still attempted?!

2008-08-19 Thread Chris Withers
Okay,

So I bumped into the ZODB3 3.9.0-dev-r77011 problem while trying to get 
going with zopeproject.

zopeproject created a buildout.cfg in my test project, so I thought I'd 
lock ZODB to 3.8.0 to prevent problems:

[buildout]
develop = .
parts = app test
find-links = http://download.zope.org/distribution/
newest = false
eggs-directory = C:\Zope\buildout-eggs

[app]
recipe = zc.recipe.egg
eggs = HelloWorld
zope.app.apidoc
zope.app.securitypolicy
z3c.evalexception=2.0
Paste
PasteScript
PasteDeploy
interpreter = python

[versions]
ZODB3 = 3.8.0

[test]
recipe = zc.recipe.testrunner
eggs = HelloWorld
defaults = ['--tests-pattern', '^f?tests$', '-v']

This didn't work, buildout still tries to install 3.9.0-dev-r77011. Why?!

I also noticed that buildout from this .cfg doesn't seem to use the 
latest versions of things. It's only using version 1.0.7 of zc.buildout, 
not the 1.1.0 I'd expect. Now, my understanding is that find-links adds 
to the index rather than replaces it, so what's going on here?

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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Philipp von Weitershausen
Chris Withers wrote:
 Why does the egg in the subject line exist

Because somebody made it and uploaded it to download.zope.org. It 
probably happened during the initial eggification period when we didn't 
have a solid release process [1].

 and why does buildout pick it over a stable release?

Because buildout, like easy_install, will pick the newest available 
version for a distribution. Fortunately, buildout has a prefer-stable 
option so that you can tell it to prefer stable over alpha/beta/dev 
releases. Also, in any serious situtation you'd want to pin your 
versions, e.g. using the KGS [2] or a manual list.


[1] 
http://svn.zope.org/*checkout*/Sandbox/philikon/foundation/releasing-software.txt
[2] http://download.zope.org/zope3.4/versions.cfg
___
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] [zopeproject] ZODB3 specified, but ZODB3 3.9.0-dev-r77011 egg still attempted?!

2008-08-19 Thread Wichert Akkerman
Previously Chris Withers wrote:
 Okay,
 
 So I bumped into the ZODB3 3.9.0-dev-r77011 problem while trying to get 
 going with zopeproject.
 
 zopeproject created a buildout.cfg in my test project, so I thought I'd 
 lock ZODB to 3.8.0 to prevent problems:
 
 [buildout]
 develop = .
 parts = app test
 find-links = http://download.zope.org/distribution/
 newest = false
 eggs-directory = C:\Zope\buildout-eggs

You are missing a line here:

  versions = versions

Wichert.

-- 
Wichert Akkerman [EMAIL PROTECTED]It is simple to make things.
http://www.wiggy.net/   It is hard to make things simple.
___
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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Chris Withers
Philipp von Weitershausen wrote:
 and why does buildout pick it over a stable release?
 
 Because buildout, like easy_install, will pick the newest available 
 version for a distribution. Fortunately, buildout has a prefer-stable 
 option so that you can tell it to prefer stable over alpha/beta/dev 
 releases. Also, in any serious situtation you'd want to pin your 
 versions, e.g. using the KGS [2] or a manual list.

Okay, so how come zopeproject doesn't do any of these?

I don't even know how to use the KGS - where would I find docs on that?

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] [zopeproject] ZODB3 specified, but ZODB3 3.9.0-dev-r77011 egg still attempted?!

2008-08-19 Thread Philipp von Weitershausen
Chris Withers wrote:
 Okay,
 
 So I bumped into the ZODB3 3.9.0-dev-r77011 problem while trying to get 
 going with zopeproject.
 
 zopeproject created a buildout.cfg in my test project, so I thought I'd 
 lock ZODB to 3.8.0 to prevent problems:
 
 [buildout]
 develop = .
 parts = app test
 find-links = http://download.zope.org/distribution/
 newest = false
 eggs-directory = C:\Zope\buildout-eggs
 
 [app]
 recipe = zc.recipe.egg
 eggs = HelloWorld
 zope.app.apidoc
 zope.app.securitypolicy
 z3c.evalexception=2.0
 Paste
 PasteScript
 PasteDeploy
 interpreter = python
 
 [versions]
 ZODB3 = 3.8.0
 
 [test]
 recipe = zc.recipe.testrunner
 eggs = HelloWorld
 defaults = ['--tests-pattern', '^f?tests$', '-v']
 
 This didn't work, buildout still tries to install 3.9.0-dev-r77011. Why?!

Because you're not doing it right. You invented a [versions] section but 
you still need to tell buildout to actually use that section as a 
versions declarations:

[buildout]
...
versions = versions

http://pypi.python.org/pypi/zc.buildout#repeatable-buildouts-controlling-eggs-used

 I also noticed that buildout from this .cfg doesn't seem to use the 
 latest versions of things. It's only using version 1.0.7 of zc.buildout, 
 not the 1.1.0 I'd expect.

Because it's running in non-newest mode (newest = false in [buildout]). 
bin/buildout -n will override that setting from the command line and run 
it in newest mode.

http://pypi.python.org/pypi/zc.buildout#newest-and-offline-modes

 Now, my understanding is that find-links adds 
 to the index rather than replaces it, so what's going on here?

This has nothing to do with it.
___
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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Philipp von Weitershausen
El 19 Aug 2008, a las 12:05 , Chris Withers escribió:
 Philipp von Weitershausen wrote:
 and why does buildout pick it over a stable release?
 Because buildout, like easy_install, will pick the newest available  
 version for a distribution. Fortunately, buildout has a prefer- 
 stable option so that you can tell it to prefer stable over alpha/ 
 beta/dev releases. Also, in any serious situtation you'd want to  
 pin your versions, e.g. using the KGS [2] or a manual list.

 Okay, so how come zopeproject doesn't do any of these?

Because I haven't bothered to update it yet.

 I don't even know how to use the KGS - where would I find docs on  
 that?

It's just the standard buildout-extension feature that you can use to  
pull in a versions list from the web, e.g. the one I just pasted you  
in my previous email:

[buildout]
...
extends = http://download.zope.org/zope3.4/versions.cfg
versions = versions


See http://pypi.python.org/pypi/zc.buildout#multiple-configuration- 
files. Of course you could also just download the file and add it to  
your buildout.cfg verbatimly.

___
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] [zopeproject] ZODB3 specified, but ZODB3 3.9.0-dev-r77011 egg still attempted?!

2008-08-19 Thread Chris Withers
Wichert Akkerman wrote:
 You are missing a line here:
 
   versions = versions

Good catch! Seems to be working now...

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] Zope Tests: 4 OK, 1 Unknown

2008-08-19 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Mon Aug 18 11:00:00 2008 UTC to Tue Aug 19 11:00:00 2008 UTC.
There were 5 messages: 5 from Zope Tests.


Unknown
---

Subject: UNKNOWN : Zope-2.8 Python-2.3.6 : Linux
From: Zope Tests
Date: Mon Aug 18 20:42:37 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-August/010030.html


Tests passed OK
---

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Tests
Date: Mon Aug 18 20:44:07 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-August/010031.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Tests
Date: Mon Aug 18 20:45:37 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-August/010032.html

Subject: OK : Zope-2.11 Python-2.4.4 : Linux
From: Zope Tests
Date: Mon Aug 18 20:47:08 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-August/010033.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Tests
Date: Mon Aug 18 20:48:40 EDT 2008
URL: http://mail.zope.org/pipermail/zope-tests/2008-August/010034.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: [Zope-dev] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Jim Fulton

On Aug 19, 2008, at 5:30 AM, Chris Withers wrote:

 Hi All,

 Why does the egg in the subject line exist

Because someone saw fit to release it.  It's on download.zope.org/ 
distribution. It''s not in PyPI.

 and why does buildout pick it
 over a stable release?


Because, like setuptools, it wants the newest release by default.

You can use the prefer-final buildout option:

   [buildout]
   prefer-final = true
   ...

to have buildout prefer final releases.

Jim

--
Jim Fulton
Zope Corporation


___
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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Philipp von Weitershausen wrote:
 Chris Withers wrote:
 Why does the egg in the subject line exist
 
 Because somebody made it and uploaded it to download.zope.org. It 
 probably happened during the initial eggification period when we didn't 
 have a solid release process [1].

$ ls -latr /distribution/ZODB3-3.9*
- -rw-r--r--  1 gary gary 785678 Jun 24  2007 \
/distribution/ZODB3-3.9.0-dev-r77011.tar.gz

 and why does buildout pick it over a stable release?
 
 Because buildout, like easy_install, will pick the newest available 
 version for a distribution. Fortunately, buildout has a prefer-stable 
 option so that you can tell it to prefer stable over alpha/beta/dev 
 releases. Also, in any serious situtation you'd want to pin your 
 versions, e.g. using the KGS [2] or a manual list.

Uploading non-releases like this to public index locations has *got* to
stop.  Frankly, they should all be removed:  anybody who is depending on
them needs to run their own index.


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

iD8DBQFIqvtL+gerLs4ltQ4RAsPuAJ4i+n/6Shupj0YTiZxlr36iUda1sACeP3g4
cuoyPGjrL2LmJ4CzdxqbQ/k=
=a+SJ
-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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Andreas Jung



--On 19. August 2008 12:56:43 -0400 Tres Seaver [EMAIL PROTECTED] 
wrote:






and why does buildout pick it over a stable release?


Because buildout, like easy_install, will pick the newest available
version for a distribution. Fortunately, buildout has a prefer-stable
option so that you can tell it to prefer stable over alpha/beta/dev
releases. Also, in any serious situtation you'd want to pin your
versions, e.g. using the KGS [2] or a manual list.


Uploading non-releases like this to public index locations has *got* to
stop.  Frankly, they should all be removed:  anybody who is depending on
them needs to run their own index.


+oo

Package sanity and package hygiene is the most important issue of PyPI
right now. PyPI requires a strong policy in order to keep PypI possible:
no uploading of development releases, no uploading for packages without a 
minimum set of metadata. PyPI has become a data toilet - unfortunately it 
is often hard to convinced people that their package uploads without 
metadata are crap.


Andreas

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


Re: [Zope-dev] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Jim Fulton

On Aug 19, 2008, at 1:05 PM, Andreas Jung wrote:



 --On 19. August 2008 12:56:43 -0400 Tres Seaver  
 [EMAIL PROTECTED] wrote:



 and why does buildout pick it over a stable release?

 Because buildout, like easy_install, will pick the newest available
 version for a distribution. Fortunately, buildout has a prefer- 
 stable
 option so that you can tell it to prefer stable over alpha/beta/dev
 releases. Also, in any serious situtation you'd want to pin your
 versions, e.g. using the KGS [2] or a manual list.

 Uploading non-releases like this to public index locations has  
 *got* to
 stop.  Frankly, they should all be removed:  anybody who is  
 depending on
 them needs to run their own index.

 +oo

 Package sanity and package hygiene is the most important issue of PyPI
 right now. PyPI requires a strong policy in order to keep PypI  
 possible:
 no uploading of development releases, no uploading for packages  
 without a minimum set of metadata. PyPI has become a data toilet -  
 unfortunately it is often hard to convinced people that their  
 package uploads without metadata are crap.


This wasn't PyPI, this was download.zope.org/distribution.

I think it's time to phase that location out.

Jim

--
Jim Fulton
Zope Corporation


___
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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Chris Withers
 From a user's perspective, this makes no sense:

  from zope.interface import implements,Interface
  from zope.component import queryAdapter
  class ISomething(Interface): pass
...
  class MyClass: implements(ISomething)
...
  m = MyClass()

Right, so this does make sense:

  ISomething(m)
__main__.MyClass instance at 0x00BED6E8

This does not:
  repr(queryAdapter(m,ISomething))
'None'

why the difference?

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] ZODB3 3.9.0-dev-r77011 egg?!

2008-08-19 Thread Christophe Combelles
Chris Withers a écrit :
 Philipp von Weitershausen wrote:
 and why does buildout pick it over a stable release?
 Because buildout, like easy_install, will pick the newest available 
 version for a distribution. Fortunately, buildout has a prefer-stable 
 option so that you can tell it to prefer stable over alpha/beta/dev 
 releases. Also, in any serious situtation you'd want to pin your 
 versions, e.g. using the KGS [2] or a manual list.
 
 Okay, so how come zopeproject doesn't do any of these?
 
 I don't even know how to use the KGS - where would I find docs on that?

Here is a page explaining it:
http://download.zope.org/zope3.4/intro.html

 
 cheers,
 
 Chris
 

___
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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Philipp von Weitershausen
Shane Hathaway wrote:
 Chris Withers wrote:
  From a user's perspective, this makes no sense:

   from zope.interface import implements,Interface
   from zope.component import queryAdapter
   class ISomething(Interface): pass
 ...
   class MyClass: implements(ISomething)
 ...
   m = MyClass()

 Right, so this does make sense:

   ISomething(m)
 __main__.MyClass instance at 0x00BED6E8

 This does not:
   repr(queryAdapter(m,ISomething))
 'None'
 
 Looks like a bug to me.  If the object passed as the first argument to 
 queryAdapter() implements the interface passed as the second argument, I 
 believe queryAdapter() should return the object, regardless of any 
 component registrations.

No, it's not a bug. This is in fact a feature (like it or not). 
{query|get}Adapter will always try to look up an adapter, whether or not 
the object provides the interface. So the behaviour Chris observed is 
indeed intended. I agree it could be documented better.
___
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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Shane Hathaway
Philipp von Weitershausen wrote:
 Shane Hathaway wrote:
 Looks like a bug to me.  If the object passed as the first argument to 
 queryAdapter() implements the interface passed as the second argument, I 
 believe queryAdapter() should return the object, regardless of any 
 component registrations.
 
 No, it's not a bug. This is in fact a feature (like it or not).

While I respect that this feature may have been chosen carefully, it 
nevertheless seems more like a misfeature.  Chris' expectation was 
reasonable and ought not to be violated without a good cause.  What code 
depends on it?

Shane

___
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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Martin Aspeli
Shane Hathaway wrote:
 Philipp von Weitershausen wrote:
 Shane Hathaway wrote:
 Looks like a bug to me.  If the object passed as the first argument to 
 queryAdapter() implements the interface passed as the second argument, I 
 believe queryAdapter() should return the object, regardless of any 
 component registrations.
 No, it's not a bug. This is in fact a feature (like it or not).
 
 While I respect that this feature may have been chosen carefully, it 
 nevertheless seems more like a misfeature.  Chris' expectation was 
 reasonable and ought not to be violated without a good cause.  What code 
 depends on it?

I've been bitten by this in the past as well. I can't see a good reason 
why it should be that way. The only thing I can imagine needing this 
would be some code that checked whether an adapter was registered, but 
even then why should anyone care...

It'd be an easy thing to fix, too.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

___
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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Jim Fulton

On Aug 19, 2008, at 4:24 PM, Shane Hathaway wrote:

 Philipp von Weitershausen wrote:
 Shane Hathaway wrote:
 Looks like a bug to me.  If the object passed as the first  
 argument to
 queryAdapter() implements the interface passed as the second  
 argument, I
 believe queryAdapter() should return the object, regardless of any
 component registrations.

 No, it's not a bug. This is in fact a feature (like it or not).

 While I respect that this feature may have been chosen carefully, it
 nevertheless seems more like a misfeature.  Chris' expectation was
 reasonable and ought not to be violated without a good cause.

queryAdapter is used to look up named adapters.  It is also a simpler  
version of queryMultiAdapter, which looks up adapters for multiple  
objects. In neither of these cases does it make sense to consider the  
interfaces already provided by the object being adapted.  It makes no  
sense to me for queryAdapter to have different semantics depending on  
whether the name argument is provided (and is non-blank).

Jim

--
Jim Fulton
Zope Corporation


___
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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Chris Withers
Philipp von Weitershausen wrote:
 No, it's not a bug. This is in fact a feature (like it or not). 

Well, assuming enough people *don't* like it, and I think that's the 
case here, then it should probably change...

 {query|get}Adapter will always try to look up an adapter, whether or not 
 the object provides the interface. So the behaviour Chris observed is 
 indeed intended. I agree it could be documented better.

I'd suggest thoroughly reading this book from a software design perspective:

http://www.amazon.com/gp/product/0465067107

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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Chris Withers
Jim Fulton wrote:
 No, it's not a bug. This is in fact a feature (like it or not).
 While I respect that this feature may have been chosen carefully, it
 nevertheless seems more like a misfeature.  Chris' expectation was
 reasonable and ought not to be violated without a good cause.
 
 queryAdapter is used to look up named adapters. 

It sure would be nice if it had a docstring that at least indicated that 
was its only intended purpose.

However, how should I go about adapting an object to an interface where 
there may or may not be an adapter registered?

The natural way would seem to be:

obj = ISomething(otherobj,default=None)

...but I seem to remember people finding reasons why implementing that 
would never be possible.

 It is also a simpler  
 version of queryMultiAdapter, which looks up adapters for multiple  
 objects. In neither of these cases does it make sense to consider the  
 interfaces already provided by the object being adapted.  

Why not? What if the name provided is None?
(and why isn't the name provided None by default, rather thab being ''?)

 It makes no  
 sense to me for queryAdapter to have different semantics depending on  
 whether the name argument is provided (and is non-blank).

Why would the semantics be different?

 From a use point of view, I'd only expect queryAdapter to consider 
looking for a named adapter if I actually provide a name. If I provide 
no name, it would seem logical to look up a non-named adapter. If 
looking up a non-named adapter, it would make sense if the object 
already provides the desired interfaces to just return the object.

I'd love to see where this expectation is faulty...

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] zope.component: calling an Interface and calling queryAdapter give differing results

2008-08-19 Thread Shane Hathaway
Chris Withers wrote:
 Jim Fulton wrote:
 No, it's not a bug. This is in fact a feature (like it or not).
 While I respect that this feature may have been chosen carefully, it
 nevertheless seems more like a misfeature.  Chris' expectation was
 reasonable and ought not to be violated without a good cause.
 queryAdapter is used to look up named adapters. 
 
 It sure would be nice if it had a docstring that at least indicated that 
 was its only intended purpose.

Now would be a good time for you to add that docstring to the trunk. :-)

  From a use point of view, I'd only expect queryAdapter to consider 
 looking for a named adapter if I actually provide a name. If I provide 
 no name, it would seem logical to look up a non-named adapter. If 
 looking up a non-named adapter, it would make sense if the object 
 already provides the desired interfaces to just return the object.
 
 I'd love to see where this expectation is faulty...

I'm switching to Jim's side now. :-)  The semantics you described are 
more magical.  At this point it's probably better to just improve the docs.

Shane
___
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] Need some help to get rid of an InvalidObjectReference exception

2008-08-19 Thread Dieter Maurer
chaouche yacine wrote at 2008-8-18 09:50 -0700:
Need some help to get rid of an InvalidObjectReference exception
In my zope product, when I try to put some specific object in the session, I 
get this :

2008-08-18T14:51:02 ERROR(200) SiteError 
http://www.afdas.com:8091/noyauafdas/tests/testAdresses
Traceback (most recent call last):
  File /opt/Zope-2.7/lib/python/ZPublisher/Publish.py, line 107, in publish
transactions_manager.commit()
  File /opt/Zope-2.7/lib/python/Zope/App/startup.py, line 222, in commit
get_transaction().commit()
  File /opt/Zope-2.7/lib/python/ZODB/Transaction.py, line 241, in commit
ncommitted += self._commit_objects(objects)
  File /opt/Zope-2.7/lib/python/ZODB/Transaction.py, line 356, in 
 _commit_objects
jar.commit(o, self)
  File /opt/Zope-2.7/lib/python/ZODB/Connection.py, line 452, in commit
dump(state)
InvalidObjectReference: Attempt to store an object from a foreign database 
connection

A given persistent object can only be in one (ZODB-) database, not in several
databases at the same time.

You must copy the persistent object, when you want it to be stored
(also) in another (ZODB-) database.

You can use the _getCopy(destination) method to create such
a copy. _getCopy is defined by OFS.CopySupport.CopySource inherited
by most Zope 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 )


[Zope] products in client instances

2008-08-19 Thread David Bear
If I have zeo and 3 clients (client1, client2, client2) its seems that it
would be convenient to have the Products directory be a symlink to a master
products directory.

Is there any reason not to do this?

Or, is there a 'super directory' where all products can be installed for all
zeo clients already?

-- 
David Bear
College of Public Programs at ASU
602-464-0424
___
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] products in client instances

2008-08-19 Thread Andreas Jung



--On 19. August 2008 16:48:32 -0700 David Bear [EMAIL PROTECTED] wrote:


If I have zeo and 3 clients (client1, client2, client2) its seems that it
would be convenient to have the Products directory be a symlink to a
master products directory.


There is no issue with sharing the Products directory in some way (symlink, 
NFS)





Or, is there a 'super directory' where all products can be installed for
all zeo clients already?


There is also a directive in zope.conf where you can configure the product
directory paths (check for 'products-x' - check the spelling).

-aj

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