[Zope] variable propagation
Hi, I would like to ask how to propagate variables from initial index_html call to deeper levels. Say I have index_html python script, I invoke it then I would like to feed some data to generic template, that will in turn will invoke template in the same directory that will do nice layout of my results. Generic template lies below all other objects, in directory tree, in the root. When I execute the command chain, variables are not passed and options is lost on one layer of zpt calls. Is there way to rectify that. Thanks Pavel ___ 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] variable propagation
Pavel Zaitsev wrote: Hi, I would like to ask how to propagate variables from initial index_html call to deeper levels. Say I have index_html python script, I invoke it then I would like to feed some data to generic template, that will in turn will invoke template in the same directory that will do nice layout of my results. Generic template lies below all other objects, in directory tree, in the root. When I execute the command chain, variables are not passed and options is lost on one layer of zpt calls. Is there way to rectify that. Thanks Pavel Pavel, You question is a bit vague but ... Make your index_html a python script. And then stuff your REQUEST with info you want Then just call the Page Template ... request.set('formvar1', somevalue) return context.myPageTemplate(context.request) Of course of you have forms submit with an action=. and method=post. Then you can intercept all calls using index_html, do what you need to do and *then* render the next form. 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 )
Re: [Zope] variable propagation
В Пнд, 24/07/2006 в 15:00 -0700, David H пишет Pavel, You question is a bit vague but ... Make your index_html a python script. And then stuff your REQUEST with info you want Then just call the Page Template ... request.set('formvar1', somevalue) return context.myPageTemplate(context.request) Of course of you have forms submit with an action=. and method=post. Then you can intercept all calls using index_html, do what you need to do and *then* render the next form. here is description: root/ index_html index_tmpl -- invokes here.content_html root/some/web/page index_html -- overriding root one, calls -- context.index_tmpl(some parameters=some parameters). content_html -- gets called from index_tmpl So i want parameters that are presented to index_html be presented to context_html just like they would be presented to index_html. So i would be able to call context_html from outside as well from the inside. Ie span tal:replace=username/ should work in both cases. I thought thats the way zope's code reuse works. Thanks Pavel ___ 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] variable propagation
Pavel Zaitsev wrote: В Пнд, 24/07/2006 в 15:00 -0700, David H пишет Pavel, You question is a bit vague but ... Make your index_html a python script. And then stuff your REQUEST with info you want Then just call the Page Template ... request.set('formvar1', somevalue) return context.myPageTemplate(context.request) Of course of you have forms submit with an action="" and method="post". Then you can intercept all calls using index_html, do what you need to do and *then* render the next form. here is description: root/ index_html index_tmpl -- invokes here.content_html root/some/web/page index_html -- overriding root one, calls -- context.index_tmpl(some parameters=some parameters). content_html -- gets called from index_tmpl So i want parameters that are presented to index_html be presented to context_html just like they would be presented to index_html. So i would be able to call context_html from outside as well from the inside. Ie span tal:replace="username"/ should work in both cases. I thought thats the way zope's code reuse works. Thanks Pavel Pavel, How are you invoking templates? Give code snippets. Have you read the "Advanced Scripting" section in the Zope book? Plope.com has a the latest version (i think). 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 )
Re: [Zope] Variable sort and multiple sort in dtml-in
Hi Loren, There is also Zieve: http://www.zope.org/Members/sspickle/Zieve Not quite as easy as a 'fixed' dtml-in ... but it does work (today). -steve "Loren" == Loren Stafford [EMAIL PROTECTED] writes: Loren On 02 July 2000, Adam Karpierz, posted a patch that would Loren allow an expression for the sort specification for the Loren dtml-in tag. Did that patch, or something like it, ever Loren find its way into the Zope core? Loren I also seem to remember some discussion of sorting on Loren multiple items (but can't find any trace of it in the Loren archives). For example, in an employee directory, sort on Loren employee name within department. Anyone know how? Loren I'm trying to provide user-specified sorting on the records Loren I pull from a SQL database. When the user specifies sorting Loren on Department, I assume he wants the records order by Name Loren within each department, but I can't see how to do that with Loren ZSQL or dtml-in. Loren -- Loren Loren ___ Zope Loren maillist - [EMAIL PROTECTED] Loren http://lists.zope.org/mailman/listinfo/zope ** No cross Loren posts or HTML encoding! ** (Related lists - Loren http://lists.zope.org/mailman/listinfo/zope-announce Loren 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] Variable sort and multiple sort in dtml-in
On 02 July 2000, Adam Karpierz, posted a patch that would allow an expression for the sort specification for the dtml-in tag. Did that patch, or something like it, ever find its way into the Zope core? I also seem to remember some discussion of sorting on multiple items (but can't find any trace of it in the archives). For example, in an employee directory, sort on employee name within department. Anyone know how? I'm trying to provide user-specified sorting on the records I pull from a SQL database. When the user specifies sorting on Department, I assume he wants the records order by Name within each department, but I can't see how to do that with ZSQL or dtml-in. -- Loren ___ 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] variable length forms...
Hi. I have tried to implement a variable length form. Yes, I have read http://www.zope.org/Members/jpenny/variable_length_forms/index_html.! I a form, I'm using following form fields: dtml-in "_.range(1, _.string.atoi(form_numpages)+1, 1)" tr align="center" valign="middle" tddtml-var sequence-number/td tdinput type="text" name="form_time_out" size="6" maxlength="4"/td tdinput type="radio" name="radiobdtml-var sequence-number"/td tdinput type="radio" name="radiobdtml-var sequence-number"/td /tr /dtml-in where form_numpages is a variable that i got from a previous form. This form works fine and generates me form_numpages lines with always one textfield and a group of 2 radiobuttons named per line. form_time_out radiob1 radiob1 form_time_out radiob2 radiob2 form_time_out radiob3 radiob3 ... The contents of this form is submitted and I want to interpret the data with following method: 1: dtml-in "_.range(1, _.string.atoi(form_numpages)+1, 1)" 2: dtml-var sequence-number: 3: dtml-var "_['radiob'+_['sequence-number']]" 4: /dtml-in This returns the following Zope error: Error Type: TypeError Error Value: illegal argument type for built-in operation If I'm replacing the third line with dtml-var "_['sequence-number']", the sequence-number is printed out. So I'm sure that it exits. How can I get the contents of radiob1, radiob2, radiob3, ... Thanks a lot for your help! Marc Ludwig ___ 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] Variable name use in with statement
I'm working on a simple auction site as a newbe challenge. I am taking bids on three static items, none will be added or removed. I have a folder named bid_records in which there is a folder for each item. These item folders have current bid information in properties and bid history in ZClass items stored in them. When I'm working with a specific auction item I have the name of the folder in a REQUEST variable. I am finding myself doing the following and am sure there is a simpler way to do this. Any help would be greatly appreciated! Thanks. dtml-with bid_records dtml-if "_.str(REQUEST.form['selection']) == 'walkon'" dtml-with walkon dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with dtml-elif "_.str(REQUEST.form['selection']) == 'fullhouse'" dtml-with fullhouse dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with dtml-else dtml-with snoopy dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with /dtml-if /dtml-with -- Scott B. Burchill, MIS Manager Ordway Center for the Performing Arts 345 Washington Street St. Paul, MN 55102-1495 voice +1 (651) 282-3082 cell +1 (651) 248-2713 pager +1 (612) 818-7600 fax +1 (651) 224-1820 efax +1 (508) 519-6133 http://www.ordway.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 )
[Zope] Variable name use in with statement
Scott Butchill wonders if: "there is a simpler way to do this." Not much simpler, but how about: dtml-call "REQUEST.set('user_select', ['walkon', 'fullhouse'])" dtml-with bid_records dtml-in user_select dtml-if "_.str(REQUEST.form['selection']) == _['sequence-item']" dtml-with "_['sequence-item']" dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with dtml-elif "_['sequence-index'] == -1 dtml-with snoopy dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with /dtml-if /dtml-in /dtml-with ___ 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] Variable name use in with statement
Burchill, Scott B. writes: I am finding myself doing the following and am sure there is a simpler way to do this. Any help would be greatly appreciated! Thanks. dtml-with bid_records dtml-if "_.str(REQUEST.form['selection']) == 'walkon'" dtml-with walkon dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with dtml-elif "_.str(REQUEST.form['selection']) == 'fullhouse'" dtml-with fullhouse dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with dtml-else dtml-with snoopy dtml-call "REQUEST.set('cur_bidder', bidder)" /dtml-with /dtml-if /dtml-with If you are sure, that only these values can occur in "selection" (as I expect, as otherwise, it would not be a selection), then you can use: dtml-call "REQUEST.set('cur_bidder',_.getitem(REQUEST.form['selection']).bidder)" 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 )
[Zope] variable
It will be that somebody knows with I obtains to capture the last register registered in cadastre in some 0 variable. ___ 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] Variable sort in dtml-in
In my search form, I have a selection box "in_sort_by" whose value can be "Category", "Field", or "Title". I am trying to make dtml-in sort by this value. I am using: dtml-in SQL_search sort="_['in_sort_by']" size=list_size start=query_start Hi Aaron again I have attached appropriate patch for dtml-in tag for Zope 2.2.0b3/b4 (Of course this patch was checked and works ok). Just for you, the syntax of my patch for dtml-in should be: dtml-in SQL_search sort="expr:_['in_sort_by']" size=list_size start=query_start or best and simply (and strict equivalent above): dtml-in SQL_search sort="expr:in_sort_by" size=list_size start=query_start I want extend my proposal to others attributes like eg. size: dtml-in SQL_search sort="expr:in_sort_by" size="expr:REQUEST.user_list_size" start=query_start It is possible easy extend other DTML tags through the same way too, but I dont know what other zopistas (especcially from DC) thinks about this. My syntax proposal is one which not caused serious comtatibility problems. Eg. natural syntax attr="something" is treated (unfortunately) as attr=something and therefore would not be adapt and apply for indirect lookup of attribute without breaking of compatibility. Very please all for comments. -- Adam Karpierz [EMAIL PROTECTED] begin 666 DT_In.py M(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C M(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C#0HC( T*(R!:;W!E M(%!U8FQI8R!,:6-E;G-E("A:4$PI(%9EG-I;VX@,2XP#0HC("TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2T-"B,@#0HC($-O'ER:6=H M=" H8RD@1EG:71A;"!#F5A=EO;G,N("!!;P@FEG:'1S(')EV5R=F5D M+@T*(R -"B,@5AIR!L:6-E;G-E(AAR!B965N(-EG1I9FEE9"!AR!/ M5N(%-O=7)C92AT;2DN#0HC( T*(R!2961IW1R:6)U=EO;B!A;F0@=7-E M(EN('-O=7)C92!A;F0@8FEN87)Y(9OFUS+"!W:71H(]R('=I=AO=70- M"B,@;6]D:69I8V%T:6]N+"!AF4@5R;6ET=5D('!R;W9I95D('1H870@ M=AE(9O;QO=VEN9R!C;VYD:71I;VYS(%R90T*(R!M970Z#0HC( T*(R Q M+B!2961IW1R:6)U=EO;G,@:6X@V]UF-E(-O94@;75S="!R971A:6X@ M=AE(%B;W9E(-O'ER:6=H= T*(R @("!N;W1I8V4L('1H:7,@;ES="!O M9B!C;VYD:71I;VYS+"!A;F0@=AE(9O;QO=VEN9R!D:7-C;%I;65R+@T* M(R -"B,@,BX@4F5D:7-TFEB=71I;VYS(EN()I;F%R2!F;W)M(UUW0@ MF5PF]D=6-E('1H92!A8F]V92!C;W!YFEG:'0-"B,@(" @;F]T:6-E+"!T M:ES(QIW0@;V8@8V]N9ET:6]NRP@86YD('1H92!F;VQL;W=I;F@9ES M8VQA:6UEB!I;@T*(R @("!T:4@9]C=6UE;G1A=EO;B!A;F0O;W(@;W1H M97(@;6%T97)I86QS('!R;W9I95D('=I=@@=AE#0HC(" @(1IW1R:6)U M=EO;BX-"B,@#0HC(#,N($1I9VET86P@0W)E871I;VYS(')E75EW1S('1H M870@871TFEB=71I;VX@8F4@9VEV96X@=\@6F]P90T*(R @("!I;B!A;GD@ M;6%N;F5R('!OW-I8FQE+B!:;W!E(EN8VQU95S($@(E!O=V5R960@8GD@ M6F]P92(-"B,@(" @8G5T=]N('1H870@:7,@:6YS=%L;5D()Y(1E9F%U M;'0N(%=H:6QE(ET(ES(YO="!A(QI8V5NV4-"B,@(" @=FEO;%T:6]N M('1O(')E;6]V92!T:ES()U='1O;BP@:70@:7,@F5Q=65S=5D('1H870@ M=AE#0HC(" @(%T=')I8G5T:6]N(')E;6%I;BX@02!S:6=N:69I8V%N="!I M;G9EW1M96YT(AAR!B965N('!U= T*(R @("!I;G1O(%IO4L(%N9"!T M:ES(5F9F]R="!W:6QL(-O;G1I;G5E(EF('1H92!:;W!E(-O;6UU;FET M0T*(R @("!C;VYT:6YU97,@=\@9W)O=RX@5AIR!IR!O;F4@=V%Y('1O M(%SW5R92!T:%T(=R;W=T:"X-"B,@#0HC(#0N($%L;"!A9'9EG1IVEN M9R!M871EFEA;',@86YD(1O8W5M96YT871I;VX@;65N=EO;FEN9PT*(R @ M("!F96%T=7)ER!D97)I=F5D(9R;VT@;W(@=7-E(]F('1H:7,@V]F='=A MF4@;75S="!D:7-P;%Y#0HC(" @('1H92!F;VQL;W=I;F@86-K;F]W;5D M9V5M96YT.@T*(R -"B,@(" @(" B5AIR!PF]D=6-T(EN8VQU95S('-O M9G1W87)E(1E=F5L;W!E9"!B2!$:6=I=%L($-R96%T:6]NPT*(R @(" @ M(9OB!UV4@:6X@=AE(%H@3V)J96-T(%!U8FQIVAI;F@16YV:7)O;FUE M;G0-"B,@(" @(" H:'1T#HO+W=W=RYZ;W!E+F]R9R\I+B(-"B,@#0HC(" @ M($EN('1H92!E=F5N="!T:%T('1H92!PF]D=6-T()E:6YG(%D=F5R=ES M960@:6YC;'5D97,@86X-"B,@(" @:6YT86-T(%IO4@9ES=')I8G5T:6]N M("AW:71H(-O'ER:6=H="!A;F0@;EC96YS92!I;F-L=61E9"D-"B,@(" @ M=AE;B!T:ES(-L875S92!IR!W86EV960N#0HC( T*(R U+B!.86UER!A MW-O8VEA=5D('=I=@@6F]P92!OB!$:6=I=%L($-R96%T:6]NR!M=7-T M(YO="!B92!UV5D('1O#0HC(" @(5N9]RV4@;W(@')O;6]T92!PF]D M=6-TR!D97)I=F5D(9R;VT@=AIR!S;V9T=V%R92!W:71H;W5T#0HC(" @ M('!R:6]R('=R:71T96X@5R;6ESVEO;B!FF]M($1I9VET86P@0W)E871I M;VYS+@T*(R -"B,@-BX@36]D:69I960@F5D:7-TFEB=71I;VYS(]F(%N M2!F;W)M('=H871S;V5V97(@;75S="!R971A:6X-"B,@(" @=AE(9O;QO M=VEN9R!A8VMN;W=L961G;65N=#H-"B,@#0HC(" @(" @(E1H:7,@')O9'5C M="!I;F-L=61ER!S;V9T=V%R92!D979E;]P960@8GD@1EG:71A;"!#F5A M=EO;G,-"B,@(" @("!F;W(@=7-E(EN('1H92!:($]B:F5C="!0=6)L:7-H M:6YG($5N=FER;VYM96YT#0HC(" @(" @*AT=' Z+R]W=WNF]P92YOFO M*2XB#0HC( T*(R @("!);G1A8W0@*')E+2ED:7-TFEB=71I;VYS(]F(%N M2!O9F9I8VEA;"!:;W!E(')E;5AV4@9\@;F]T#0HC(" @(')E75IF4@ M86X@97AT97)N86P@86-K;F]W;5D9V5M96YT+@T*(R -"B,@-RX@36]D:69I M8V%T:6]NR!AF4@96YC;W5R86=E9"!B=70@;75S="!B92!P86-K86=E9"!S M97!AF%T96QY(%S#0HC(" @('!A=-H97,@=\@;V9F:6-I86P@6F]P92!R M96QE87-ERX@($1IW1R:6)U=EO;G,@=AA="!D;R!N;W0-"B,@(" @8VQE M87)L2!S97!AF%T92!T:4@%T8VAER!FF]M('1H92!OFEG:6YA;"!W M;W)K(UUW0@8F4@8VQE87)L0T*(R @("!L86)E;5D(%S('5N;V9F:6-I M86P@9ES=')I8G5T:6]NRX@($UO9EF:6-A=EO;G,@=VAI8V@@9\@;F]T M#0HC(" @(-AG)Y('1H92!N86UE(%IO4@;6%Y()E('!A8VMA9V5D(EN M(%N2!F;W)M+"!AR!L;VYG(%S('1H97D-"B,@(" @8V]N9F]R;2!T;R!A M;P@;V8@=AE(-L875S97,@86)O=F4N#0HC( T*(R -"B,@1ES8VQA:6UE M@T*(R
Re: [Zope] Variable sort in dtml-in
I have attached appropriate patch for dtml-in tag for Zope 2.2.0b3/b4 (Of course this patch was checked and works ok). Thanks again for the patch. It is a much needed option (and rather a glaring omission from the original code). So far it is working flawlessly for me. I want extend my proposal to others attributes like eg. size: dtml-in SQL_search sort="expr:in_sort_by" size="expr:REQUEST.user_list_size" start=query_start Is this necessary? I actually use a variable for size (size=list_size) in the same dtml-in, and that part seems to work just fine. Maybe mine is a special case, but I don't think so. It is possible easy extend other DTML tags through the same way too, but I dont know what other zopistas (especcially from DC) thinks about this. I for one am for it. The lack of multiple and variable sort keys in version 2.14 were a major hindrance to me. I am sure that many tags could benefit from similar improvements. Thanks again, Aaron ___ 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] Variable sort in dtml-in
In my search form, I have a selection box "in_sort_by" whose value can be "Category", "Field", or "Title". I am trying to make dtml-in sort by this value. I am using: dtml-in SQL_search sort="_['in_sort_by']" size=list_size start=query_start And I've tried other variations, but I always get an attribute error. The strange thing to me is that list_size is also a variable and it works fine, but I've tried just using in_sort_by and that doesn't work. What am I missing here? Many thanks, Aaron ___ 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] Variable sort in dtml-in
Aaron Williamson wrote: In my search form, I have a selection box "in_sort_by" whose value can be "Category", "Field", or "Title". I am trying to make dtml-in sort by this value. I am using: dtml-in SQL_search sort="_['in_sort_by']" size=list_size start=query_start And I've tried other variations, but I always get an attribute error. The strange thing to me is that list_size is also a variable and it works fine, but I've tried just using in_sort_by and that doesn't work. What am I missing here? http://www.zope.org/Documentation/How-To/index_html/view_source should give you some ideas... -- Do not meddle in the affairs of sysadmins, for they are easy to annoy, and have the root password. ___ 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] Variable which delivers the author of an document
I would like to know,if there is a Variable, which delivers as value the author of a document, similiar to "AUTHENTICATED_USER", which delivers the user name. I couldn't find anything about it in the Zope DTML Reference. Thanks a lot in advance, Stefan ___ 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 )