Re: [Zope-dev] dtml-in: next-batches
Brett Carter writes: I tried accessing keys off the 'data' object, and I just get an 'unathorized' error. Dieter The attributes your are looking for are in fact keys Dieter of the mapping 'data'. Sorry for the misleading answer. "data" is not supposed to be used directly. "next-batches" returns a sequence of "DocumentTemplate.DT_In_SV.sequence_variables". Each "sequence_variables" object behaves like a mapping and exposes the items of its "data" member (and some more items derived from them), among them "batch-start-index", 'batch-end-index', and 'batch-size'. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
I tried accessing keys off the 'data' object, and I just get an 'unathorized' error. -Brett "Dieter" == Dieter Maurer [EMAIL PROTECTED] writes: Dieter Brett Carter writes: I'm running Zope 2.2.2, and I'm trying to use the batching stuff for the dtml-in tag, however, I can't seem to access any attributes off the 'next-batches' or 'previous-batches' mapping object that's supposed to be available, with the attributes 'batch-start-index', 'batch-end-index', and 'batch-size'. I wrote an external method to dir the 'next-batches' object, and it seems the only attributes available are: ['data', 'items', 'query_string', 'start_name_re'] Dieter The attributes your are looking for are in fact keys Dieter of the mapping 'data'. Dieter Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in: next-batches
Does anybody have an example of how to use the supposed next-batches mapping returned by dtml-in? I'm trying to build a google-like pageing feature into my application, so we just show the first 5 results, then have a link to each next page, ie "1,2,3,4..." Thanks, -Brett ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] dtml-in: next-batches
I found this in some Zope documentation. It wont give you "1,2,3,4,5...10" it gives "(1-10)(11-20)(21-30)...". Monkey with it a little and you'll get it. Beware it will call your External Method or ZSQL as many times/10. dtml-in expr="SOME_EXTERNAL_METHOD(REQUEST)" previous orphan=1 size=10 start=qs dtml-in previous-batches mapping dtml-unless sequence-start, /dtml-unless a href="dtml-var document_iddtml-var sequence-query qs=dtml-var batch-start-number" (dtml-var batch-start-number - dtml-var batch-end-number)/a /dtml-in /dtml-in dtml-in expr="SOME_EXTERNAL_METHOD(REQUEST)" next orphan=1 size=10 start=qs dtml-in next-batches mapping dtml-unless sequence-start, /dtml-unless a href="dtml-var document_iddtml-var sequence-query qs=dtml-var batch-start-number" (dtml-var batch-start-number - dtml-var batch-end-number)/a /dtml-in /dtml-in dtml-in expr="SOME_EXTERNAL_METHOD(REQUEST)" orphan=1 size=10 start=qs dtml-var sequence-index)" dtml-var expr="_.getitem('sequence-item')[1]" dtml-var expr="_.getitem('sequence-item')[2]" /dtml-in -Bryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Brett Carter Sent: Wednesday, March 07, 2001 6:34 PM To: [EMAIL PROTECTED] Subject: [Zope-dev] dtml-in: next-batches Does anybody have an example of how to use the supposed next-batches mapping returned by dtml-in? I'm trying to build a google-like pageing feature into my application, so we just show the first 5 results, then have a link to each next page, ie "1,2,3,4..." Thanks, -Brett ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
I've also discovered that setting overlap = 0 actually causes everything to overlap by 1. I didn't see anything in the collector about this either... -Brett "Brett" == Brett Carter [EMAIL PROTECTED] writes: Brett I'm running Zope 2.2.2, and I'm trying to use the batching stuff for Brett the dtml-in tag, however, I can't seem to access any attributes off Brett the 'next-batches' or 'previous-batches' mapping object that's Brett supposed to be available, with the attributes 'batch-start-index', Brett 'batch-end-index', and 'batch-size'. However, my example code (see Brett below) blows up with a key error when trying to access any of these. Brett Is this a bug, or am I just misunderstanding how to use this thing? Brett I wrote an external method to dir the 'next-batches' object, and it Brett seems the only attributes available are: Brett ['data', 'items', 'query_string', 'start_name_re'] Brett -Brett Brett p Brett dtml-in "mystuff.retseq()" size=5 start=start Brett dtml-var sequence-item Brett /dtml-in /p Brett p Brett dtml-in "mystuff.retseq()" size=5 start=start previous Brett a href="dtml-var absolute_url/batch_me?start=dtml-var previous-sequence-start-index"Previous/a Brett /dtml-in Brett dtml-in "mystuff.retseq()" size=5 start=start next overlap=-1 Brett dtml-try Brett dtml-in next-batches Brett dtml-var batch-start-indexbr Brett /dtml-in Brett dtml-except Brettpre Brettdtml-var error_typebr Brettdtml-var error_valuebr Brettdtml-var error_tbbr Brett/pre Brett /dtml-try Brett a href="dtml-var absolute_url/batch_me?start=dtml-var next-sequence-start-index"Next/a Brett /dtml-in Brett /p Brett ___ Brett Zope-Dev maillist - [EMAIL PROTECTED] Brett http://lists.zope.org/mailman/listinfo/zope-dev Brett ** No cross posts or HTML encoding! ** Brett (Related lists - Brett http://lists.zope.org/mailman/listinfo/zope-announce Brett http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
Brett Carter writes: I'm running Zope 2.2.2, and I'm trying to use the batching stuff for the dtml-in tag, however, I can't seem to access any attributes off the 'next-batches' or 'previous-batches' mapping object that's supposed to be available, with the attributes 'batch-start-index', 'batch-end-index', and 'batch-size'. I wrote an external method to dir the 'next-batches' object, and it seems the only attributes available are: ['data', 'items', 'query_string', 'start_name_re'] The attributes your are looking for are in fact keys of the mapping 'data'. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in: next-batches
I'm running Zope 2.2.2, and I'm trying to use the batching stuff for the dtml-in tag, however, I can't seem to access any attributes off the 'next-batches' or 'previous-batches' mapping object that's supposed to be available, with the attributes 'batch-start-index', 'batch-end-index', and 'batch-size'. However, my example code (see below) blows up with a key error when trying to access any of these. Is this a bug, or am I just misunderstanding how to use this thing? I wrote an external method to dir the 'next-batches' object, and it seems the only attributes available are: ['data', 'items', 'query_string', 'start_name_re'] -Brett p dtml-in "mystuff.retseq()" size=5 start=start dtml-var sequence-item /dtml-in /p p dtml-in "mystuff.retseq()" size=5 start=start previous a href="dtml-var absolute_url/batch_me?start=dtml-var previous-sequence-start-index"Previous/a /dtml-in dtml-in "mystuff.retseq()" size=5 start=start next overlap=-1 dtml-try dtml-in next-batches dtml-var batch-start-indexbr /dtml-in dtml-except pre dtml-var error_typebr dtml-var error_valuebr dtml-var error_tbbr /pre /dtml-try a href="dtml-var absolute_url/batch_me?start=dtml-var next-sequence-start-index"Next/a /dtml-in /p ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )