Re: [Zope] Sequence sorting module from a Python script

2005-04-25 Thread Leticia Larrosa

Thanks to David and Andreas.!

-Original Message-
From: Andreas Jung <[EMAIL PROTECTED]>
To: Leticia Larrosa <[EMAIL PROTECTED]>, zope@zope.org
Date: Mon, 25 Apr 2005 05:30:12 +0200
Subject: Re: [Zope] Sequence sorting module from a Python script

> 
> 
> --On Sonntag, 24. April 2005 17:36 Uhr -0400 Leticia Larrosa 
> <[EMAIL PROTECTED]> wrote:
> > sort_on =(('self', test, 'desc'))
> 
> As documented the 'sort_on_ parameter must be a *sequence* of sorting 
> definitions and a *single* sorting
> definition. This should work:
> 
>   sort_on =(('self', test, 'desc'),)
> 
> -aj

___
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] Sequence sorting module from a Python script

2005-04-24 Thread Andreas Jung

--On Sonntag, 24. April 2005 17:36 Uhr -0400 Leticia Larrosa 
<[EMAIL PROTECTED]> wrote:
sort_on =(('self', test, 'desc'))
As documented the 'sort_on_ parameter must be a *sequence* of sorting 
definitions and a *single* sorting
definition. This should work:

 sort_on =(('self', test, 'desc'),)
-aj

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


Re: [Zope] Sequence sorting module from a Python script

2005-04-24 Thread David H




Leticia Larrosa wrote:

  Hi
all: 
  
 
  I
want to order a sequence using the Sequence sorting module from a
Python script. 
  I
have the following code: 
"
seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']]
def test(oneElem, twoElem):
    if oneElem[0] == twoElem[0]:
    return 0
    elif oneElem[0] > twoElem[0]:
    return 1
    else:
    return -1
  
sort_on =(('self', test, 'desc'))
return sequence.sort(seq, sort_on)
"
  
and i get the error:
"
Error Type: SyntaxError
Error 

Value:
sort option must contains no more than 2 fields

Leticia,
I tested this using a python script in Zope - and it seems to work. 
Nice to see someone doing something with Chess and Zope!


def test(x,y):
    if x[0] == y[0]:
    return 0
    elif x[0] > y[0]:
    return 1
    else:
    return -1

request = container.REQUEST

seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']]

seq.sort(test)
print seq

David


___
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] Sequence sorting module from a Python script

2005-04-24 Thread Leticia Larrosa


Hi all: 

 
I 
want to order a sequence using the Sequence sorting module from a Python 
script. 
I 
have the following code: "seq = [['Bruzon', 'CUB'], ['Anand', 
'IND'], ['Kasparov', 'RUS']]def test(oneElem, twoElem):
    if oneElem[0] == twoElem[0]:
    return 0    
elif oneElem[0] > twoElem[0]:
    return 1    
else:    return -1

sort_on =(('self', test, 'desc'))return sequence.sort(seq, sort_on)
"

and i get the error:"Error Type: SyntaxErrorError Value: sort 
option must contains no more than 2 fields"and Traceback:"
Traceback (innermost last):Module ZPublisher.Publish, line 101, in 
publishModule ZPublisher.mapply, line 88, in mapplyModule 
ZPublisher.Publish, line 39, in call_objectModule 
Shared.DC.Scripts.Bindings, line 306, in __call__Module 
Shared.DC.Scripts.Bindings, line 343, in _bindAndExecModule 
Products.PythonScripts.PythonScript, line 323, in _execModule None, line 
21, in orderBy- - Line 21Module 
DocumentTemplate.sequence.SortEx, line 66, in sortModule 
DocumentTemplate.sequence.SortEx, line 161, in make_sortfunctions
SyntaxError: sort option must contains no more than 2 fields"

 

what i'm doing wrong? 

any suggestion?

 

Thanks in advance.

___
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] Sequence sorting module from a Python script

2005-04-24 Thread Leticia Larrosa

Hi all:

I want to order a sequence using the Sequence sorting module from a Python 
script.
I have the following code:
"
seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']]
def test(oneElem, twoElem):
if oneElem[0] == twoElem[0]:
return 0
if oneElem[0] > twoElem[0]:
return 1
else:
return -1
sort_on =(('self', test, 'desc'))
return sequence.sort(seq, sort_on)
"

and i get the error:
"
Error Type: SyntaxError
Error Value: sort option must contains no more than 2 fields
"

the Traceback:
"
Traceback (innermost last): 
Module ZPublisher.Publish, line 101, in publish 
Module ZPublisher.mapply, line 88, in mapply 
Module ZPublisher.Publish, line 39, in call_object 
Module Shared.DC.Scripts.Bindings, line 306, in __call__ 
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec 
Module Products.PythonScripts.PythonScript, line 323, in _exec 
Module None, line 22, in orderBy

Line 22 
Module DocumentTemplate.sequence.SortEx, line 66, in sort 
Module DocumentTemplate.sequence.SortEx, line 161, in make_sortfunctions 
SyntaxError: sort option must contains no more than 2 fields 
"

what i'm doing wrong?

Thanks in advance.

___
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] sequence-item is a String? (was: Calling objects with arguments in asequence)sequence)

2000-09-29 Thread Dieter Maurer

seb writes:
 > If you do:
 > 
 > 
 >  
 >  
 >  
 > 
"sequence-item" is not a string.

However, 
calls "name" (if callable) like any name argument to a
"dtml" tag.

Use ".


Dieter

___
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] sequence-item is called in dtml-let assignment?

2000-09-28 Thread Tres Seaver

seb <[EMAIL PROTECTED]> asked:

> Ahh, now I understand...
> 
> > If you do , it'll get called (real bitch
> > of mine, that one :-( )
> > And, apparently, if you do , it'll get
> > called
> 
> Are the above two points bugs, then?  Or is there a legitimate reason
> for this behaviour?

Chris Withers <[EMAIL PROTECTED]> replied:

> Organization: New Information Paradigms
> To: seb <[EMAIL PROTECTED]>
> CC: [EMAIL PROTECTED]
> Subject: Re: [Zope] sequence-item is called in dtml-let assignment?
> 
> seb wrote:
> >
> > Ahh, now I understand...
> >
> > > If you do , it'll get called (real bitch
> > > of mine, that one :-( )
> > > And, apparently, if you do , it'll get
> > > called
> >
> > Are the above two points bugs, then?
> 
> Probably not...
> 
> > Or is there a legitimate reason
> > for this behaviour?
> 
> illegitimate in that it makes some things easier, like showing an object
> when you don't know whether it's a function or a string (as with id, as
> ChrisM pointed out ;-) but bastardising python syntax to your own ends
> is probably a bad thing :-S

First, let me apologize for sending seb off on a wild goose chase;
Chris has correctly explained the "eagerness" with which DTML attempts
to render objects, particularly those acquired by name.  This behavior
is targeted directly at DTML's original purpose, which was to generate
HTML reports against the objects published by Bobo/Zope;  the
interoduction
of more powerful programming constructs (the let tag, expression syntax)
have not always jived well with the more ancient core of DTML.

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Digital Creations "Zope Dealers"   http://www.zope.org

___
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] sequence-item is called in dtml-let assignment?

2000-09-28 Thread Chris Withers

seb wrote:
> 
> Ahh, now I understand...
> 
> > If you do , it'll get called (real bitch
> > of mine, that one :-( )
> > And, apparently, if you do , it'll get
> > called
> 
> Are the above two points bugs, then?  

Probably not...

> Or is there a legitimate reason
> for this behaviour?

illegitimate in that it makes some things easier, like showing an object
when you don't know whether it's a function or a string (as with id, as
ChrisM pointed out ;-) but bastardising python syntax to your own ends
is probably a bad thing :-S

cheers,

Chris

___
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] sequence-item is called in dtml-let assignment?

2000-09-28 Thread seb

Ahh, now I understand...

> If you do , it'll get called (real bitch
> of mine, that one :-( )
> And, apparently, if you do , it'll get
> called

Are the above two points bugs, then?  Or is there a legitimate reason
for this behaviour?

Seb

___
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] sequence-item is called in dtml-let assignment?

2000-09-28 Thread Chris Withers

Seb wrote:
> I don't actually thing that sequence-item _is_ called when it's
> assigned. 

If my solution worked, then it is :P

> I tried inspecting it with all sorts of python and it's
> definitely a string as soon as you even mention it.

Well, it probably seemed like that...

If you do , it'll get called
if you do , you'll get NameErrors 'cos chances
are sequence and item don't exist.
If you do , it'll get called (real bitch
of mine, that one :-( )
If you do , it'll get called...
And, apparently, if you do , it'll get
called

AFAIK, the way I mentioned is the only way you can ensure it isn't
called...

cheers,

Chris

___
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] sequence-item is called in dtml-let assignment?

2000-09-28 Thread seb

Waheyy!  Thanks Chrises, the Withers solution worked a treat.

I don't actually thing that sequence-item _is_ called when it's
assigned. I tried inspecting it with all sorts of python and it's
definitely a string as soon as you even mention it.  It looks to me like
it's rendered before you can access any of its attributes.  I'm still a
relative stranger to the Zope architecture, and I've got a deadline to
meet, so I can't go look at the code right now.  However, surely this
behaviour _is_ a bug?  I would expect sequence-item consistently to
behave like the object to which it refers.

> Welcome to DTML...

Sounds ominous ;)

I've just starting actually using Zope in production, and I'm constantly
surprised by it.  I can spend about 5 hours on a little problem like
this, and just when I start thinking "stupid system" and reach for
mod_php + mysql, I suddenly find I've done something that would normally
take me a couple of days to implement in about 10 minutes.  Welcome to
Zope, eh?

Seb

> 
> what's happening, I guess, is that when you do
> 
> 
> sequence-item is called (and hence rendered to a string) which screws
> thigns up.
> 
> try:
> > 
> > 
> > 
> > 
> 
> cheers,
> 
> Chris

___
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] sequence-item is called in dtml-let assignment?

2000-09-28 Thread Chris Withers

seb wrote:
> If you do:
> 
> 
> 
> 
> 
> 
> 
> You get TypeError: it claims thing is a string, so you can't perform any
> kind of function call against it.

Welcome to DTML...

what's happening, I guess, is that when you do 


sequence-item is called (and hence rendered to a string) which screws
thigns up.

try:
> 
> 
> 
> 

cheers,

Chris

___
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] sequence-item is a String? (was: Calling objects with arguments in asequence)sequence)

2000-09-28 Thread Chris McDonough

> If you do:
>
> 
> 
> 
> 
> 
>
> You get TypeError: it claims thing is a string, so you can't perform any
> kind of function call against it.

Some id attributes of Zope objects are methods, some are strings.

To account for every case:

  

  

  

  

  

The need to do this will soon go away with the new "getId()" method mixed in
to all Zope objects.



___
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] sequence-item is a String? (was: Calling objects with arguments in asequence)sequence)

2000-09-28 Thread seb

Thanks very much for the reply, Tres.  Unfortunately it didn't work.

I've been puzzling about this for a while, and I'm lost.  I thought I'd
restate the problem in more generic terms in the hope that more people
will have a look at it.

If you do:







You get TypeError: it claims thing is a string, so you can't perform any
kind of function call against it.

My understanding is that when the ZPublisher finds an object reference,
it invokes its __str__ method.  This returns a string.  When Zope finds
an object being called with parameters, it invokes its __call__ method,
which also (usually) returns a string.

I think that in the case of a sequence-item, the ZPublisher is invoking
the __str__ method of the object, and _then_ applying arguments to the
result, which is a string object.  So, it fails.

Is this a bug?  Is Zope rendering the object too soon?  I've thought and
thought about this, but can't think of a logical reason for this
behaviour of sequence-item.  Surely sequence-item should be a reference
to a normal object, and therefore behave like one?  But then again, I'm
a Zope / python newbie, so *please* shoot me down ;)

With a furrowed brow,

Seb.



>   
> 
> 
>
>   
> 
> seb <[EMAIL PROTECTED]> wrote:
> >
> > I'm using the Photo product, instances of which I can call, with
> > arguments, like this:
> >
> > 
> >
> > However, I can't work out how to pass arguments to each sequence item
> > when iterating over a sequence.
> >
> > For example, I've tried:
> >
> > 
> > 
> > 
> >
> > (..not that I expect that to work :)
> >
> > And I get
> >
> > Error Type: TypeError
> > Error Value: call of non-function (type string)

___
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] Sequence-key-note

2000-08-25 Thread Sven Hohage

I don't know if this is usefull to someone but I've found that using a
token property you can sort the elements with sequence-key(the first
char is the key).
For example -> token property "citynames": London Liverpool Rome New
York

&dtml-sequence-key;: &dtml-sequence-item;

The output is:
L: London
L: Liverpool
N:New York
R: Rome





___
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] Sequence problem

2000-08-06 Thread peter be

This little DTML code is supposed to be generic for alla folder is the profil folder.

What I want to do is a to have a next folder and previous folder in evey one.

/profil/
/folder_XHJSD
/folder_GIEHG
/folder_OWKD
/and_many_more
/
/folders_here

document_html

Document_html is acquired in all folders in the profil folder.
I started doing something like this:

, 

... and this returns: folder_XHJSD, folder_GIEHG, folder_OWKD

What I want to do is something like this:




previous
next



 but this returns 
Error Type: KeyError
Error Value: sequence-next
so it is obviuosly the wrong way of doing it.

Grateful for help!


___
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] sequence-item and ""

2000-07-19 Thread Chris Withers

Jonothan Farr wrote:
> There's a much cooler and more elegant solution in the pipe for 2.2.
> 
> http://www.zope.org/Members/4am/DTMLWiki/NamedDTMLInLoop

I don't think this landed for 2.2...

Chris

___
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] sequence-item and ""

2000-07-18 Thread Jonothan Farr

I've patched this for 2.1.6. Now you can use sequence_item in addition to
sequence-item.

http://www.zope.org/Members/jfarr/Patches/dtml-in-sv

There's a much cooler and more elegant solution in the pipe for 2.2.

http://www.zope.org/Members/4am/DTMLWiki/NamedDTMLInLoop

--jfarr

"Perl is worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998

- Original Message -
From: Rob Miller <[EMAIL PROTECTED]>
To: Diego Rodrigo Neufert <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, July 18, 2000 1:30 PM
Subject: Re: [Zope] sequence-item and ""


>
> Diego Rodrigo Neufert writes:
>
> > Hi ppl...
> >
> > Why I cant use dtml-var "sequence-item">??
>
> Because, as I understand it, anything within "" gets treated as Python code
> by the DTML interpreter.  Thus "sequence-item" is parsed as an expression:
> sequence _minus_ item.  A dash is not a valid variable name character in
> Python, but it is in DTML; this is unfortunate.
>
> >
> > Every time I try to access sequence-item under "" in a dtml-call dtml-var or
> > anything else I got this error:
> >
> > Error Type: NameError
> > Error Value: sequence
> >
> > Well, I found a solution:
> > 
> > 
> > 
> > Now everything is ok... but I dont want to do this, I want to access the
> > *&@%$#@& sequence-item in "".
>
> I've searched through the list archives and come to the conclusion that
> your solution above is the cleanest way to handle this, for now.  There are
> other ways, but they involve ugly-looking permutations of the "_" namespace
> variable, and they approach the splendor of Perl in their readability.  The
> "right" solution, IMHO, would be to rename the "sequence-..." variables to
> a different set of names that doesn't cause the Python interpreter to
> choke.  I seem to recall someone saying that this (or something similar)
> was being worked on, but, alas, for now  is our best option.
>
> rob
>
> >
> > Can anyone help me?
> >
> > -
> > Diego Rodrigo Neufert
> > -webmaster
> > ---
> > (Magic Web Design)
> > (email) ([EMAIL PROTECTED])
> > (curitiba) (pr)
> >
> > ___
> > 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 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 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] sequence-item and ""

2000-07-18 Thread Rob Miller


Diego Rodrigo Neufert writes:

> Hi ppl...
> 
> Why I cant use dtml-var "sequence-item">??

Because, as I understand it, anything within "" gets treated as Python code
by the DTML interpreter.  Thus "sequence-item" is parsed as an expression:
sequence _minus_ item.  A dash is not a valid variable name character in
Python, but it is in DTML; this is unfortunate.

> 
> Every time I try to access sequence-item under "" in a dtml-call dtml-var or
> anything else I got this error:
> 
> Error Type: NameError
> Error Value: sequence
> 
> Well, I found a solution:
> 
> 
> 
> Now everything is ok... but I dont want to do this, I want to access the
> *&@%$#@& sequence-item in "".

I've searched through the list archives and come to the conclusion that
your solution above is the cleanest way to handle this, for now.  There are
other ways, but they involve ugly-looking permutations of the "_" namespace
variable, and they approach the splendor of Perl in their readability.  The
"right" solution, IMHO, would be to rename the "sequence-..." variables to
a different set of names that doesn't cause the Python interpreter to
choke.  I seem to recall someone saying that this (or something similar)
was being worked on, but, alas, for now  is our best option.

rob

> 
> Can anyone help me?
> 
> -
> Diego Rodrigo Neufert
> -webmaster
> ---
> (Magic Web Design)
> (email) ([EMAIL PROTECTED])
> (curitiba) (pr)
> 
> ___
> 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 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] sequence-item and ""

2000-07-18 Thread Chris Withers

"Christopher J. Kucera" wrote:
> Try:
> 
> 

or 



If you don't want the object to be called ebfore being displayed...

cheers,

Chris

___
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] sequence-item and ""

2000-07-18 Thread Christopher J. Kucera

Diego Rodrigo Neufert wrote:
> 
> Why I cant use dtml-var "sequence-item">??

Because anything inside quotes is evaluated as a Python expression.
It's trying to subtract 'item' from 'sequence.'

Try:



-CJ

___
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] sequence-item and ""

2000-07-18 Thread Diego Rodrigo Neufert

Hi ppl...

Why I cant use dtml-var "sequence-item">??

Every time I try to access sequence-item under "" in a dtml-call dtml-var or
anything else I got this error:

Error Type: NameError
Error Value: sequence

Well, I found a solution:



Now everything is ok... but I dont want to do this, I want to access the
*&@%$#@& sequence-item in "".

Can anyone help me?

-
Diego Rodrigo Neufert
-webmaster
---
(Magic Web Design)
(email) ([EMAIL PROTECTED])
(curitiba) (pr)

___
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] sequence-item as a method argument

2000-06-14 Thread Thomas Weiner

Fabio Akita schrieb:
> 
[ sequence-item in a python expression ]
> 
> Error Type: NameError
> Error Value: sequence
> 
> Anyone knows what is going on? I think this must be a simple thing.

Everything in quotes is taken as a python expression, therefore Zope
wants to evaluate "sequence - item"; this won't work because sequence
and item aren't defined.

Try:



_ is the current namespace, where Zope will find the value of
sequence-item.

hth
Thomas

___
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] sequence-item as a method argument

2000-06-14 Thread Rik Hoekstra




Hello again

I´m still testing the usability and reliability of Zope. To accomplish this
goal I am developing a very very simple shopping cart. But I got troubled by
something aparently simple. This is the code:


  
   
  


SESSION['cartItems'] is an array created in another DTML document using the
well known SQLSession product. Here I am retrieving the itens of this array
and passing it to a ZSQL method to get the selected items.

The sqlSearchProduct, alone, works well. If I substitute the inner  for a simple  the block works fine,
otherwise it gives me the following error:

Zope has encountered an error while publishing this resource.

Error Type: NameError
Error Value: sequence



change the line
-  
to
 + 

in the line as it is now, sequence-item is interpreted as a Python
expression, meaning sequence minus item. The second incantation gets the
variables 'sequence-item' from the current namespace _

hth

Rik


___
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] sequence-item as a method argument

2000-06-14 Thread Fabio Akita

Hello again

I´m still testing the usability and reliability of Zope. To accomplish this
goal I am developing a very very simple shopping cart. But I got troubled by
something aparently simple. This is the code:

 
  
   
  
 

SESSION['cartItems'] is an array created in another DTML document using the
well known SQLSession product. Here I am retrieving the itens of this array
and passing it to a ZSQL method to get the selected items.

The sqlSearchProduct, alone, works well. If I substitute the inner  for a simple  the block works fine,
otherwise it gives me the following error:

Zope has encountered an error while publishing this resource.

Error Type: NameError
Error Value: sequence


Anyone knows what is going on? I think this must be a simple thing.
Thanks

[]´s

Fabio Akita - Developer
F/Nazca S&S / Adversiting
[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] sequence-*

2000-05-26 Thread Jonothan Farr

> > Many of these variables cause problems for those starting out with Zope.
> > Why not create alternate names such as sequence_* and degrade the
> > former?
> 
> Gotta agree with this :-)


Here's the patch. I'll submit it to the collector too. Enjoy.

http://www.zope.org/Members/jfarr/Patches/dtml-in-sv

--jfarr

"Perl is worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998



___
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] sequence-*

2000-05-26 Thread Chris Withers

Graham Chiu wrote:
> Many of these variables cause problems for those starting out with Zope.
> Why not create alternate names such as sequence_* and degrade the
> former?

Gotta agree with this :-)

Chris

___
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] sequence-*

2000-05-25 Thread Curtis Maloney

On Fri, 26 May 2000, Graham Chiu wrote:
>
> Many of these variables cause problems for those starting out with Zope.
> Why not create alternate names such as sequence_* and degrade the
> former?
>

yeh, i suggested something like this some time ago.  Perhaps we should make a 
bit more noise.

Agreed, I have a fair bit of legacy code using sequence-*, but if the CHANGES 
mentioned this would break, that would be fair.  In fact, wouldn't sequence_* 
be faster than _['sequence-*'] anway?

A deprecation over the next few versions could be fairly easily handled. 
(Assuming, of course, people actually READ the changes file :)

> - --
> Regards,  Graham Chiu
> gchiucompkarori.co.nz
> http://www.compkarori.co.nz/index.php
> Powered by Interbase and Zope
>

-- 
Have a better one,
Curtis.



___
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] sequence-*

2000-05-25 Thread Graham Chiu

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Many of these variables cause problems for those starting out with Zope.
Why not create alternate names such as sequence_* and degrade the
former?

- -- 
Regards,  Graham Chiu
gchiucompkarori.co.nz
http://www.compkarori.co.nz/index.php
Powered by Interbase and Zope

-BEGIN PGP SIGNATURE-
Version: PGPsdk version 1.7.1

iQA/AwUBOS0vJbTRdIWzaLpMEQJ1pwCgtHuwKcKLTI3xRV6PvL3nOU8acV0AnR4H
Lu3wVAMYiBLQIjF2Je3fHmrq
=+Lzv
-END PGP SIGNATURE-

___
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 )