|
List Info
Thread: Re: Variable Assignment/Scope Question
|
|
| Re: Variable Assignment/Scope Question |

|
2008-01-01 18:01:45 |
|
could you have whatever is invoking the Genshi engine do the calculation and pass it through? (that is, pass both "my_range" and "variable"?
On Jan 1, 2008 5:47 PM, jerryji <
jerryji197 6 gmail.com">jerryji1976 gmail.com> wrote:
Hi Chris,
That's also how I interpreted the documentation -- just couldn';t convince myself that such deceptively naive functionality does not exist in Genshi -- without even a workaround/cheat?
Thanks.
Jerry
On Jan 1, 4:27 pm, "Chri s Curvey" < ccur... gmail.com">ccur... gmail.com> wrote: > I'm not sure there is a solution in Genshi. If I go to
>
> http://genshi.edgewall.org/wiki/Documentation/0.4.x/xml-templates.htm...
>
> the last paragraph in section 1.4.1 seems to say that you can't do what you > want to do. > > (I'd love for someone to show me that my interpretation of that paragraph is > incorrect!)
>
> On Jan 1, 2008 12:12 PM, jerryji < jerryji1.. . gmail.com">jerryji1... gmail.com> wrote: > > > > > > > Hi, >
> > I have been struggling with no avail to archive assignment of a > > variable within a loop to be used later outside the loop, i.e., the > > following use of ${variable} fails with undefined error:
> > > <py:for each="i in range(my_range)"> > > <py:with var="variable=i"></py:with> > > </py:for> > > > <py:if test="my_range <= 1">
> > <py:with var="variable=0"></py:with> > > </py:if> > > > <py:for each="v in range(variable)"> > > <span>do something</span>
> > </py:for> > > > What is the trick there? Any hint would be greatly appreciated! > > > Sincerely, > > Jerry > > --
> I am often wrong, but I am never in doubt.
-- I am often wrong, but I am never in doubt.
- -~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Genshi" group. To post to this group, send email to genshi googlegroups.com To unsubscribe from this group, send email to genshi-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/genshi?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Variable Assignment/Scope Question |

|
2008-01-01 11:12:24 |
Hi,
I have been struggling with no avail to archive assignment
of a
variable within a loop to be used later outside the loop,
i.e., the
following use of $ fails with undefined error:
<py:for each="i in range(my_range)">
<py:with
var="variable=i"></py:with>
</py:for>
<py:if test="my_range <= 1">
<py:with
var="variable=0"></py:with>
</py:if>
<py:for each="v in range(variable)">
<span>do something</span>
</py:for>
What is the trick there? Any hint would be greatly
appreciated!
Sincerely,
Jerry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Variable Assignment/Scope Question |

|
2008-01-01 15:27:03 |
|
I'm not sure there is a solution in Genshi. If I go to
http://genshi.edgewall.org/wiki/Documentation/0.4.x/xml-templates.html#py-with
the last paragraph in section 1.4.1 seems to say that you can't do what you want to do.
(I'd love for someone to show me that my interpretation of that paragraph is incorrect!)
|
| Re: Variable Assignment/Scope Question |

|
2008-01-01 16:47:37 |
Hi Chris,
That's also how I interpreted the documentation -- just
couldn't
convince myself that such deceptively naive functionality
does not
exist in Genshi -- without even a workaround/cheat?
Thanks.
Jerry
On Jan 1, 4:27 pm, "Chris Curvey" <ccur... gmail.com> wrote:
> I'm not sure there is a solution in Genshi. If I go
to
>
> http://genshi.edgewall.org/wiki/Document
ation/0.4.x/xml-templates.htm...
>
> the last paragraph in section 1.4.1 seems to say that
you can't do what you
> want to do.
>
> (I'd love for someone to show me that my interpretation
of that paragraph is
> incorrect!)
>
> On Jan 1, 2008 12:12 PM, jerryji <jerryji1... gmail.com> wrote:
>
>
>
>
>
> > Hi,
>
> > I have been struggling with no avail to archive
assignment of a
> > variable within a loop to be used later outside
the loop, i.e., the
> > following use of $ fails with undefined
error:
>
> > <py:for each="i in
range(my_range)">
> > <py:with
var="variable=i"></py:with>
> > </py:for>
>
> > <py:if test="my_range <=
1">
> > <py:with
var="variable=0"></py:with>
> > </py:if>
>
> > <py:for each="v in
range(variable)">
> > <span>do something</span>
> > </py:for>
>
> > What is the trick there? Any hint would be greatly
appreciated!
>
> > Sincerely,
> > Jerry
>
> --
> I am often wrong, but I am never in doubt.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Variable Assignment/Scope Question |

|
2008-01-01 20:27:37 |
Hi Chris,
Stupid me, that's indeed very true -- maybe I was blinded by
my
reluctance to pass presentation centric variables to the
Genshi
template.
Thanks again.
Jerry
On Jan 1, 7:01 pm, "Chris Curvey" <ccur... gmail.com> wrote:
> could you have whatever is invoking the Genshi engine
do the calculation and
> pass it through? (that is, pass both
"my_range" and "variable"?
>
> On Jan 1, 2008 5:47 PM, jerryji <jerryji1... gmail.com> wrote:
>
>
>
>
>
> > Hi Chris,
>
> > That's also how I interpreted the documentation --
just couldn't
> > convince myself that such deceptively naive
functionality does not
> > exist in Genshi -- without even a
workaround/cheat?
>
> > Thanks.
>
> > Jerry
>
> > On Jan 1, 4:27 pm, "Chris Curvey"
<ccur... gmail.com> wrote:
> > > I'm not sure there is a solution in Genshi.
If I go to
>
> > >http://genshi.edgewall.org/wiki/Document
ation/0.4.x/xml-templates.htm...
>
> > > the last paragraph in section 1.4.1 seems to
say that you can't do what
> > you
> > > want to do.
>
> > > (I'd love for someone to show me that my
interpretation of that
> > paragraph is
> > > incorrect!)
>
> > > On Jan 1, 2008 12:12 PM, jerryji
<jerryji1... gmail.com> wrote:
>
> > > > Hi,
>
> > > > I have been struggling with no avail to
archive assignment of a
> > > > variable within a loop to be used later
outside the loop, i.e., the
> > > > following use of $ fails with
undefined error:
>
> > > > <py:for each="i in
range(my_range)">
> > > > <py:with
var="variable=i"></py:with>
> > > > </py:for>
>
> > > > <py:if test="my_range <=
1">
> > > > <py:with
var="variable=0"></py:with>
> > > > </py:if>
>
> > > > <py:for each="v in
range(variable)">
> > > > <span>do something</span>
> > > > </py:for>
>
> > > > What is the trick there? Any hint would
be greatly appreciated!
>
> > > > Sincerely,
> > > > Jerry
>
> > > --
> > > I am often wrong, but I am never in doubt.
>
> --
> I am often wrong, but I am never in doubt.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-5]
|
|