On Thu, 11 Nov 1999, Christopher Petrilli wrote:
On 11/11/99 5:35 PM, Stuart 'Zen' Bishop at zen@cs.rmit.edu.au wrote:
Magic sequence- variables need to have aliases of sequence_ (everyone rabidly agrees on this) Strangely enough no one has owned up to actually implementing the '-' variables, most likely as they are afraid of being lynched.
I looked at this today, it's not going into 2.1 most likely, it's a LOT of work to make sure it works, *and* doesn't have any negative performance impact. Since it will by its nature, I'll need to balance that with a performance enhancement somewhere :-)
Is this any good as a temporary fix? *** DT_InSV.py.org Fri Nov 12 15:26:50 1999 --- DT_InSV.py Fri Nov 12 16:06:51 1999 *************** *** 88,94 **** $Id: DT_InSV.py,v 1.16 1999/11/02 16:51:32 brian Exp $''' __version__='$Revision: 1.16 $'[11:-2] ! from string import lower, rfind, split, join from math import sqrt TupleType=type(()) try: --- 88,95 ---- $Id: DT_InSV.py,v 1.16 1999/11/02 16:51:32 brian Exp $''' __version__='$Revision: 1.16 $'[11:-2] ! from UserDict import UserDict ! from string import lower, rfind, split, join, replace from math import sqrt TupleType=type(()) try: *************** *** 96,101 **** --- 97,122 ---- mv=Missing.Value except: mv=None + def _transkey(key): + if key[:13] == 'sequence-var-': + # Only translate the first 2 '-' characters in a sequence-var- + return replace(key,'-','_',2) + else: + return replace(key,'-','_') + + class sequence_kwdict(UserDict): + '''This class is used to implement the dictionary in sequence_variables + It duplicates keys containing '-' characters to a corresponding entry + with a key mapping all the first two '-' characters to '_' characters. + This will greatly improve DTML readability.''' + + def __setitem__(self,key,value): + self.data[key] = value + self.data[_transkey(key)] = value + + def __delitem__(self,key,value): + del self.data[key] + del self.data[_transkey(key)] class sequence_variables: *************** *** 105,116 **** self.query_string=query_string self.start_name_re=start_name_re ! self.data=data={ 'previous-sequence': 0, 'next-sequence': 0, 'sequence-start': 1, 'sequence-end': 0, ! } def number(self,index): return index+1 --- 126,137 ---- self.query_string=query_string self.start_name_re=start_name_re ! self.data=data=sequence_kwdict({ 'previous-sequence': 0, 'next-sequence': 0, 'sequence-start': 1, 'sequence-end': 0, ! }) def number(self,index): return index+1 ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen