Re: [Zope] R: [Zope] dtml-in and maps...
On Wed, 12 Jul 2000, Marcel Preda wrote: > So, you have to do something like this: > > > "REQUEST.set('superList',[['string1',0,{'name1':'value1'}],['string2',1,{'n >ame2' > > :'value2'}]])"> > > > > > : "temp_sequence_item[2][_['sequence-item']]"> > > > > > > Ok... i've fiddled around a bit, and It's working. Thanks. (o8 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] R: [Zope] dtml-in and maps...
> > > Because, as you seem to keep missing, i want to iterate over all the items in > the map, but i won't know what their keys are! > > By using with, i can bring the map into the name space... SO WHAT? I still > don't know what keys were in the map! > > Get the idea? Ya men... [the `name' is not allways `name'] the idea is to make a temporary `sequence-item' So, you have to do something like this: : As you see, it's not so difficult :) OR you can try with an external method, the code wil not be so UNreadable... PM ___ 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] dtml-in and maps...
- Original Message - From: Curtis Maloney <[EMAIL PROTECTED]> > > I suppose that your var is a dictionary > > > Well.. this is where things start to get fun. (o8 > > I have a dirty great array along the lines of : > > [ [ 'string', 0, { 'name':'value' } ], [ 'string', 0, { 'name':'value' } ] ] > > (I love python.. the same thing in C/C++ would take HEAPS of work :) > > So, I iterate over the array... that's working fine... > Then, for each iteration, I handle the data however... > I wind up with: > > > > > > But that's where the problem begins. Yes in did the "_['sequence-item'][2]" is a dictionary. You can do like (untested :0) but why not without ... PM ___ 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] R: [Zope] dtml-in and maps...
On Tue, 11 Jul 2000, Marcel Preda wrote: > > Greetings, > > > > This seems like it should be a simple thing but I can't seem to find > > how to make dtml-in behave with maps. In particular, empty maps. > > > > I've tried mapping, i've tried testing _.len(map.keys()), and various > > other things. But it always fails, telling me > > Error Type: KeyError > > Error Value: 0 > > > > What am I missing? > > > > Have a better one, > > Curtis. > > looks like the variable that you are using in > is noat a sequence (list || tuple) > > I suppose that your var is a dictionary > Well.. this is where things start to get fun. (o8 I have a dirty great array along the lines of : [ [ 'string', 0, { 'name':'value' } ], [ 'string', 0, { 'name':'value' } ] ] (I love python.. the same thing in C/C++ would take HEAPS of work :) So, I iterate over the array... that's working fine... Then, for each iteration, I handle the data however... I wind up with: But that's where the problem begins. > > Insted of : > > you have to use: > as a list > > as a tuple > So, you're saying that by creating a list with one element which is a dictionary... ? > PM > 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 )
Re: [Zope] R: [Zope] dtml-in and maps...
On Tue, 11 Jul 2000, Marcel Preda wrote: > looks like the variable that you are using in > is noat a sequence (list || tuple) > > I suppose that your var is a dictionary > > > Insted of : > > you have to use: > as a list > || > as a tuple Note that this gives you one iteration of the dtml-in, with (if I understand this right) x pushed on the namespace stack as another dictionary to look things up in. --RDM ___ 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] R: [Zope] dtml-in and maps...
> Greetings, > > This seems like it should be a simple thing but I can't seem to find how > to make dtml-in behave with maps. In particular, empty maps. > > I've tried mapping, i've tried testing _.len(map.keys()), and various other > things. But it always fails, telling me > Error Type: KeyError > Error Value: 0 > > What am I missing? > > Have a better one, > Curtis. looks like the variable that you are using in is noat a sequence (list || tuple) I suppose that your var is a dictionary Insted of : you have to use: as a list || as a tuple PM ___ "Will I be using Python today?" and if the answer is "yes" I know that it's going to be a good day. ___ 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] dtml-in and maps...
Greetings, This seems like it should be a simple thing but I can't seem to find how to make dtml-in behave with maps. In particular, empty maps. I've tried mapping, i've tried testing _.len(map.keys()), and various other things. But it always fails, telling me Error Type: KeyError Error Value: 0 What am I missing? 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 )