[Zope-dev] DTML Syntax contd. + rant + summary
Stuart 'Zen' Bishop
zen@cs.rmit.edu.au
Fri, 12 Nov 1999 16:36:37 +1100 (EST)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---559023410-1053718679-942384997=:10674
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Fri, 12 Nov 1999, Stuart 'Zen' Bishop wrote:
> Is this any good as a temporary fix?
Grr... just found an obvious flaw. Lets try take 2 at embarassing myself.
*** DT_InSV.py.org Fri Nov 12 15:26:50 1999
--- DT_InSV.py Fri Nov 12 16:29:56 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,127 ----
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 __init__(self,data):
+ self.data = data
+ for i in data.items():
+ data[_transkey(i[0])] = i[1]
+
+ 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
--- 131,142 ----
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
---559023410-1053718679-942384997=:10674
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="DT_InSV.py"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.SOL.4.10.9911121636370.10674@goanna.cs.rmit.edu.au>
Content-Description:
Content-Disposition: attachment; filename="DT_InSV.py"
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDQojIA0KIyBab3Bl
IFB1YmxpYyBMaWNlbnNlIChaUEwpIFZlcnNpb24gMS4wDQojIC0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiMgDQojIENvcHlyaWdo
dCAoYykgRGlnaXRhbCBDcmVhdGlvbnMuICBBbGwgcmlnaHRzIHJlc2VydmVk
Lg0KIyANCiMgVGhpcyBsaWNlbnNlIGhhcyBiZWVuIGNlcnRpZmllZCBhcyBP
cGVuIFNvdXJjZSh0bSkuDQojIA0KIyBSZWRpc3RyaWJ1dGlvbiBhbmQgdXNl
IGluIHNvdXJjZSBhbmQgYmluYXJ5IGZvcm1zLCB3aXRoIG9yIHdpdGhvdXQN
CiMgbW9kaWZpY2F0aW9uLCBhcmUgcGVybWl0dGVkIHByb3ZpZGVkIHRoYXQg
dGhlIGZvbGxvd2luZyBjb25kaXRpb25zIGFyZQ0KIyBtZXQ6DQojIA0KIyAx
LiBSZWRpc3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zZWxmLG51bSk6DQogICAgICAgICMgRm9yY2UgbnVtYmVyIHRv
IGJlIGFuIGludGVnZXIgdmFsdWUNCiAgICAgICAgbnVtID0gaW50KG51bSkr
MQ0KDQogICAgICAgICMgSW5pdGlhbGl6ZSByb21hbiBhcyBhbiBlbXB0eSBz
dHJpbmcNCiAgICAgICAgcm9tYW4gPSAnJw0KDQogICAgICAgIHdoaWxlIG51
bSA+PSAxMDAwOg0KICAgICAgICAgICAgICAgIG51bSA9IG51bSAtIDEwMDAN
CiAgICAgICAgICAgICAgICByb21hbiA9ICclc00nICUgcm9tYW4NCg0KICAg
ICAgICB3aGlsZSBudW0gPj0gNTAwOg0KICAgICAgICAgICAgICAgIG51bSA9
IG51bSAtIDUwMA0KICAgICAgICAgICAgICAgIHJvbWFuID0gJyVzRCcgJSBy
b21hbg0KDQogICAgICAgIHdoaWxlIG51bSA+PSAxMDA6DQogICAgICAgICAg
ICAgICAgbnVtID0gbnVtIC0gMTAwDQogICAgICAgICAgICAgICAgcm9tYW4g
PSAnJXNDJyAlIHJvbWFuDQoNCiAgICAgICAgd2hpbGUgbnVtID49IDUwOg0K
ICAgICAgICAgICAgICAgIG51bSA9IG51bSAtIDUwDQogICAgICAgICAgICAg
ICAgcm9tYW4gPSAnJXNMJyAlIHJvbWFuDQoNCiAgICAgICAgd2hpbGUgbnVt
ID49IDEwOg0KICAgICAgICAgICAgICAgIG51bSA9IG51bSAtIDEwDQogICAg
ICAgICAgICAgICAgcm9tYW4gPSAnJXNYJyAlIHJvbWFuICAgICAgICAgICAg
ICAgICANCg0KICAgICAgICB3aGlsZSBudW0gPj0gNToNCiAgICAgICAgICAg
ICAgICBudW0gPSBudW0gLSA1DQogICAgICAgICAgICAgICAgcm9tYW4gPSAn
JXNWJyAlIHJvbWFuDQoNCiAgICAgICAgd2hpbGUgbnVtIDwgNSBhbmQgbnVt
ID49IDE6DQogICAgICAgICAgICAgICAgbnVtID0gbnVtIC0gMQ0KICAgICAg
ICAgICAgICAgIH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AgICAgICAgICB0cnk6DQogICAgICAg
ICAgICAgICAgaWYgbWFwcGluZzogaXRlbT1pdGVtW25hbWVdDQogICAgICAg
ICAgICAgICAgZWxzZTogaXRlbT1nZXRhdHRyKGl0ZW0sbmFtZSkNCiAgICAg
ICAgICAgICAgICB0cnk6DQogICAgICAgICAgICAgICAgICAgIGlmIGl0ZW0g
aXMgbXY6DQogICAgICAgICAgICAgICAgICAgICAgICBpdGVtID0gTm9uZQ0K
ICAgICAgICAgICAgICAgICAgICBzPWl0ZW0qaXRlbQ0KICAgICAgICAgICAg
ICAgICAgICBzdW09c3VtK2l0ZW0NCiAgICAgICAgICAgICAgICAgICAgc3Vt
c3E9c3Vtc3Ercw0KICAgICAgICAgICAgICAgICAgICB2YWx1ZXMuYXBwZW5k
KGl0ZW0pDQogICAgICAgICAgICAgICAgICAgIGlmIG1pbiBpcyBOb25lOg0K
ICAgICAgICAgICAgICAgICAgICAgICAgbWluPW1heD1pdGVtDQogICAgICAg
ICAgICAgICAgICAgIGVsc2U6DQogICAgICAgICAgICAgICAgICAgICAgICBp
ZiBpdGVtIDwgbWluOiBtaW49aXRlbQ0KICAgICAgICAgICAgICAgICAgICAg
ICAgaWYgaXRlbSA+IG1heDogbWF4PWl0ZW0NCiAgICAgICAgICAgICAgICBl
eGNlcHQ6DQogICAgICAgICAgICAgICAgICAgIGlmIGl0ZW0gaXMgbm90IE5v
bmUgYW5kIGl0ZW0gaXMgbm90IG12Og0KICAgICAgICAgICAgICAgICAgICAg
ICAgaWYgc21pbiBpcyBOb25lOiBzbWluPXNtYXg9aXRlbQ0KICAgICAgICAg
ICAgICAgICAgICAgICAgZWxzZToNCiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICBpZiBpdGVtIDwgc21pbjogc21pbj1pdGVtDQogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgaWYgaXRlbSA+IHNtYXg6IHNtYXg9aXRlbQ0KICAg
ICAgICAgICAgICAgICAgICAgICAgc3ZhbHVlcy5hcHBlbmQoaXRlbSkNCiAg
ICAgICAgICAgIGV4Y2VwdDogcGFzcw0KDQogICAgICAgICMgSW5pdGlhbGl6
ZSBhbGwgc3RhdHMgdG8gZW1wdHkgc3RyaW5nczoNCiAgICAgICAgZm9yIHN0
YXQgaW4gc2VsZi5zdGF0aXN0aWNfbmFtZXM6IGRhdGFbJyVzLSVzJyAlIChz
dGF0LG5hbWUpXT0nJw0KDQogICAgICAgIGNvdW50PWxlbih2YWx1ZXMpDQog
ICAgICAgIHRyeTogIyBOdW1lcmljIHN0YXRpc3RpY3MNCiAgICAgICAgICAg
IG49ZmxvYXQoY291bnQpDQogICAgICAgICAgICBtZWFuPXN1bS9uDQogICAg
ICAgICAgICBzdW1zcT1zdW1zcS9uIC0gbWVhbiptZWFuDQogICAgICAgICAg
ICBkYXRhWydtZWFuLSVzJyAlIG5hbWVdPW1lYW4NCiAgICAgICAgICAgIGRh
dGFbJ3RvdGFsLSVzJyAlIG5hbWVdPXN1bQ0KICAgICAgICAgICAgZGF0YVsn
dmFyaWFuY2Utbi0lcycgJSBuYW1lXT1zdW1zcQ0KICAgICAgICAgICAgZGF0
YVsnc3RhbmRhcmQtZGV2aWF0aW9uLW4tJXMnICUgbmFtZV09c3FydChzdW1z
cSkNCiAgICAgICAgICAgIGlmIGNvdW50ID4gMToNCiAgICAgICAgICAgICAg
ICBzdW1zcT1zdW1zcSpuLyhuLTEpDQogICAgICAgICAgICAgICAgZGF0YVsn
dmFyaWFuY2UtJXMnICUgbmFtZV09c3Vtc3ENCiAgICAgICAgICAgICAgICBk
YXRhWydzdGFuZGFyZC1kZXZpYXRpb24tJXMnICUgbmFtZV09c3FydChzdW1z
cSkgICAgICAgICAgICANCiAgICAgICAgICAgIGVsc2U6DQogICAgICAgICAg
ICAgICAgZGF0YVsndmFyaWFuY2UtJXMnICUgbmFtZV09JycNCiAgICAgICAg
ICAgICAgICBkYXRhWydzdGFuZGFyZC1kZXZpYXRpb24tJXMnICUgbmFtZV09
JycNCiAgICAgICAgZXhjZXB0Og0KICAgICAgICAgICAgaWYgbWluIGlzIE5v
bmU6IG1pbixtYXgsdmFsdWVzPXNtaW4sc21heCxzdmFsdWVzDQogICAgICAg
ICAgICBlbHNlOg0KICAgICAgICAgICAgICAgIGlmIHNtaW4gPCBtaW46IG1p
bj1zbWluDQogICAgICAgICAgICAgICAgaWYgc21heCA+IG1heDogbWF4PXNt
YXgNCiAgICAgICAgICAgICAgICB2YWx1ZXM9dmFsdWVzK3N2YWx1ZXMNCiAg
ICAgICAgICAgIGNvdW50PWxlbih2YWx1ZXMpDQoNCiAgICAgICAgZGF0YVsn
Y291bnQtJXMnICUgbmFtZV09Y291bnQNCiAgICAgICAgIyBkYXRhWydfdmFs
dWVzJ109dmFsdWVzDQogICAgICAgIGlmIG1pbiBpcyBub3QgTm9uZToNCiAg
ICAgICAgICAgIGRhdGFbJ21pbi0lcycgJSBuYW1lXT1taW4NCiAgICAgICAg
ICAgIGRhdGFbJ21heC0lcycgJSBuYW1lXT1tYXgNCiAgICAgICAgICAgIHZh
bHVlcy5zb3J0KCkNCiAgICAgICAgICAgIGlmIGNvdW50PT0xOg0KICAgICAg
ICAgICAgICAgIGRhdGFbJ21lZGlhbi0lcycgJSBuYW1lXT1taW4NCiAgICAg
ICAgICAgIGVsc2U6DQogICAgICAgICAgICAgICAgbj1jb3VudCsxDQogICAg
ICAgICAgICAgICAgaWYgbi8yKjI9PW46IGRhdGFbJ21lZGlhbi0lcycgJSBu
YW1lXT12YWx1ZXNbbi8yLTFdDQogICAgICAgICAgICAgICAgZWxzZToNCiAg
ICAgICAgICAgICAgICAgICAgbj1uLzINCiAgICAgICAgICAgICAgICAgICAg
dHJ5OiBkYXRhWydtZWRpYW4tJXMnICUgbmFtZV09KHZhbHVlc1tuXSt2YWx1
ZXNbbi0xXSkvMg0KICAgICAgICAgICAgICAgICAgICBleGNlcHQ6DQogICAg
ICAgICAgICAgICAgICAgICAgICB0cnk6IGRhdGFbJ21lZGlhbi0lcycgJSBu
Y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