[Zope] = replaced with == in sendmail!!!!!
Jay, Dylan
djay@lucent.com
Fri, 16 Apr 1999 10:42:16 +1000
> -----Original Message-----
> From: Michel Pelletier [mailto:michel@digicool.com]
> Sent: Friday, 16 April 1999 00:31
> To: Jay, Dylan; 'zope@zope.org'
> Subject: RE: [Zope] = replaced with == in sendmail!!!!!
>
> > I have the following inside a sendmail tag
> >
> > <!--#var URL1-->/completeReg?MagicNumber=<!--#var MagicNumber-->
> >
> > However in the mail that is sent this comes out as
> >
> > http://blah.com/completeReg?MagicNumber==23423434
> >
> > This is incredibly fustrating and I can find no way around
> this. Even
> >
> > <!--#var URL1-->/completeReg?MagicNumber<!--#var "'='"--><!--#var
> > MagicNumber-->
> >
> > produces the same result. Whats going on?
> >
>
> I have no idea, but try:
>
> <!--#var "_.string.join((URL1, '/completeReg?MagicNumber=',
> MagicNumber))" url_quote-->
>
> just for the heck of it and tell us what happens.
I couldn't get it to work but I'm pretty sure it wouldn't anyway.
I had a look at the MailHost code and found some quoting stuff that if I
knew more about python I might be able to do work out the problem with.
Down the bottom of MailHost.py in the MailHost product is the following
ESCAPE = '='
MAXLINESIZE = 76
HEX = '0123456789ABCDEF'
def needsquoting(c, quotetabs):
if c == '\t':
return not quotetabs
return c == ESCAPE or not(' ' <= c <= '~')
def quote(c):
if c == ESCAPE:
return ESCAPE * 2
else:
i = ord(c)
return ESCAPE + HEX[i/16] + HEX[i%16]
def encode(input, quotetabs):
"""Encode a string to Quoted-Printable"""
output = ''
for line in string.split(input, '\n'):
new = ''
prev = ''
for c in line:
if needsquoting(c, quotetabs):
c = quote(c)
if len(new) + len(c) >= MAXLINESIZE:
output = output + new + ESCAPE + '\n'
new = ''
new = new + c
prev = c
if prev in (' ', '\t'):
output = output + new + ESCAPE + '\n\n'
else:
output = output + new + '\n'
return output
I presume some quoting needs to go on in order for the message to be sent to
the smtp server. This seems to be buggy. Can anyone tell me how to fix this
as it is quite urgent.