Shane Hathaway wrote:
Chris Withers wrote:
Now, you could, for example, then do:
IFieldType([])
...which should return None.
I don't understand your example: what is a field type,
It's a shortened naem for Type of Field Value, as I said, it could
arguably be called IFieldValue, or
Marius Gedminas wrote:
doesn't fail with an exception, I can assume that
ISomeInterface.providedBy(adapter)
...which in this case should return True, as None does indeed implement
the interface in question.
*That's* what I'm looking for help with, not judgement on whether
adapting to
Chris Withers wrote:
Now, you could, for example, then do:
IFieldType([])
...which should return None.
I don't understand your example: what is a field type, and why is None
somehow a valid field type?
Shane
___
Zope-Dev maillist -
Dieter Maurer wrote:
I *DO* want that I can rely on the result of IInterface(...) really
providing IInterface (and not be forced to check against all
potential values others invented to circumvent the adaptation semantics).
Thus, I hope, you will not get your wish :-)
FFS, I'm not asking for
Chris Withers wrote at 2008-12-13 02:17 +:
I have a need to be able to adapting certain objects to None, eg:
def some_adapter(obj):
if something:
return None
return somethingelse
Your use case seems to abuse adaptation:
Adaptation to an interface must always return an object
Chris Withers wrote at 2008-12-13 10:18 +:
Dieter Maurer wrote:
I think that in some cases, it would be useful for an adapter factory
to say 'I cannot handle this case' and then the adapter lookup
is continued. Maybe, this is already supported?
Then, maybe, you can use it?
That's exactly
Dieter Maurer wrote:
Then, use something different from adaptation (as adaptation does
not fit your wishes).
This is what I'm trying to do with subclassing, and my question was why
that subclassing wasn't working...
I expect that your adapter factory can raise ComponentLookupError
when it
On Sat, Dec 13, 2008 at 10:42:09AM +, Chris Withers wrote:
Dieter Maurer wrote:
Then, use something different from adaptation (as adaptation does
not fit your wishes).
This is what I'm trying to do with subclassing, and my question was why
that subclassing wasn't working...
Chris Withers chris at simplistix.co.uk writes:
Hi All,
I have a need to be able to adapting certain objects to None, eg:
def some_adapter(obj):
if something:
return None
return somethingelse
This is tricky, since returning None from an adapter results in a TypeError.
Chris Withers wrote at 2008-12-13 10:42 +:
...
From looking at the python implementation of Interface, __call__ is
indicated to be the method to override, but with the C-based Interface,
this has no effect. Why is that?
*That's* what I'm looking for help with, not judgement on whether
Hi All,
I have a need to be able to adapting certain objects to None, eg:
def some_adapter(obj):
if something:
return None
return somethingelse
This is tricky, since returning None from an adapter results in a TypeError.
I eventually came up with the idea of having a subclass of
11 matches
Mail list logo