Re: [Zope] Lines data type possible in boolean OR's?

2000-07-26 Thread Alexander Limi


- Original Message -
From: "Martijn Pieters" <[EMAIL PROTECTED]>

> On Mon, Jul 24, 2000 at 11:56:01PM +0200, Alexander Limi wrote:
> > I have a small problem. When I use the lines data type in OR statements,
I
> > get an
> >
> > Error Type: TypeError
> > Error Value: bad operand type(s) for |
> >
> > I've used them earlier on integers, like this:
> >
> > 
> >
> > and it works fine. When I try the same with other data types, like this:
> >
> > 
> >
> > where "toy" is a "multiple select" type and "additionalToys" is a
"lines"
> > type. Can anyone provide me with some hints on what to do to get it
working
> > the way I want? Is typecasting necessary?
>
> A pipe symbol in python ('|') is a bitwise 'or', so it works on integers
yes.
> I assume you want to to a boolean 'or', wich in python is the keyword
'or':

I figured that out after a while, but the original problem remained: The
Lines type does not evaluate to FALSE in boolean expressions, even when
empty.

Empty lines are contain [''], so I have to use a string.join() to get it to
be '', which evaluates to false.

I know lines is a set of some sort, but shouldn't it evaluate to FALSE in
boolean expressions anyway? Is there a reason why it doesn't?

--
Alexander Limi
[EMAIL PROTECTED]




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




Re: [Zope] Lines data type possible in boolean OR's?

2000-07-26 Thread Martijn Pieters

On Mon, Jul 24, 2000 at 11:56:01PM +0200, Alexander Limi wrote:
> I have a small problem. When I use the lines data type in OR statements, I
> get an
> 
> Error Type: TypeError
> Error Value: bad operand type(s) for |
> 
> I've used them earlier on integers, like this:
> 
> 
> 
> and it works fine. When I try the same with other data types, like this:
> 
> 
> 
> where "toy" is a "multiple select" type and "additionalToys" is a "lines"
> type. Can anyone provide me with some hints on what to do to get it working
> the way I want? Is typecasting necessary?

A pipe symbol in python ('|') is a bitwise 'or', so it works on integers yes.
I assume you want to to a boolean 'or', wich in python is the keyword 'or':

  

-- 
Martijn Pieters
| Software Engineermailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
-

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




[Zope] Lines data type possible in boolean OR's?

2000-07-24 Thread Alexander Limi

Hi,

I have a small problem. When I use the lines data type in OR statements, I
get an

Error Type: TypeError
Error Value: bad operand type(s) for |

I've used them earlier on integers, like this:



and it works fine. When I try the same with other data types, like this:



where "toy" is a "multiple select" type and "additionalToys" is a "lines"
type. Can anyone provide me with some hints on what to do to get it working
the way I want? Is typecasting necessary?

Thanks in advance.


Alexander.
PS: please CC me if you answer :)



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