| Zope Error Zop\r\n
Content-Length: 2006\r\n
Bobo-Exception-Line: 61\r\n
\r\n
Unfortunately, swalowsupp closed the connection afterwards, so I did
not get to see the 2006 bytes content.
Using another approach, I tried to run Lynx, and Netscape, on the file
Upload file
Even though I've entered a distribution and a signature, both browsers
would not include them in their HTTP request. Any idea what could be
wrong with that form?
Regards,
Martin
P.S. In case anybody wants to experiment with it, I include my
modified swalowsupp.py as well. To initiate an upload, do something like
swalowsupp.sendDist("PyXML-0.7.0.tar.gz",
signature=open("PyXML-0.7.0.tar.gz.asc").read())
#!/usr/bin/env python
'''Routines for submission of distributions to repository server.'''
# created 2001/03/26 by Sean Reifschneider
uploadHost = 'community.tummy.com'
import httplib, urllib
import time, os, sys
import md5
#####################################
# emulate 'md5sum' command on a file
def md5sum(file):
fp = open(file, 'rb')
md = md5.new()
while 1:
data = fp.read(10240)
if not data: break
md.update(data)
digest = md.digest()
sum = reduce(lambda x,y: x + ('%02x' % y), map(ord, digest), '')
return(sum)
#######################################################
def sendDist(fileName, pkgFile = None, platform = None,
signature = None, userAgent = 'swalow', uploadHost = None):
if uploadHost == None: uploadHost = '63.230.174.230'
tmp = os.environ.get('PYTHON_MODULE_SERVER', None)
if tmp: uploadHost = tmp
# get file information
fileLen = os.stat(fileName)[6]
fileMD5 = md5sum(fileName)
# create body
boundary = '%s%.8f_%s' % ( '-' * 30, time.time(), os.uname()[1] )
boundary = '---------------------------87109191412184106881070100800'
body = ''
body = body + '--%s\r\nContent-Disposition: form-data; ' \
'name="protocol_version"\r\n\r\n1\r\n' % ( boundary, )
if platform:
body = body + '--%s\r\nContent-Disposition: form-data; ' \
'name="platform"\r\n\r\n%s\r\n' % ( boundary, platform )
if signature:
body = body + '--%s\r\nContent-Disposition: form-data; ' \
'name="signature"\r\n\r\n%s\r\n' % ( boundary, signature )
body = body + '--%s\r\nContent-Disposition: form-data; ' \
'name="distmd5sum"\r\n\r\n%s\r\n' % ( boundary, fileMD5 )
body = body + '--%s\r\nContent-Disposition: form-data; name="distribution"' \
'; filename="%s"\r\n\r\n' % ( boundary, os.path.basename(fileName) )
body2 = ''
body3 = '\r\n--%s--\r\n' % boundary
if pkgFile != None:
fileLen = fileLen + os.stat(pkgFile)[6]
infoMD5 = md5sum(pkgFile)
body2 = body2 + '--%s\r\nContent-Disposition: form-data; ' \
'name="infomd5sum"\r\n\r\n%s\r\n' % ( boundary, infoMD5 )
body2 = body2 + '--%s\r\nContent-Disposition: form-data; ' \
'name="pkginfo"; filename="%s"\r\n\r\n' \
% ( boundary, os.path.basename(fileName) )
# send header
h = httplib.HTTP(uploadHost,8080)
h.putrequest('POST', '/archive/pep243_accept')
h.putheader('Content-length', '%d' % (len(body) + fileLen + len(body2)))
h.putheader('Content-type', 'multipart/form-data; boundary=%s' % boundary)
#h.putheader('User-Agent', userAgent)
h.endheaders()
# send body
h.send(body)
fp = open(fileName, 'rb')
while 1:
data = fp.read(4096)
if not data: break
h.send(data)
h.send(body2)
reply, msg, hdrs = h.getreply()
status = hdrs.get('X-Swalow-Status', 'TRYAGAIN')
reason = hdrs.get('X-Swalow-Reason', '')
return(status, reason)
From amos@digicool.com Wed May 2 20:00:17 2001
From: amos@digicool.com (Amos Latteier)
Date: Wed, 02 May 2001 15:00:17 -0400
Subject: [Catalog-sig] [Announce] Catalog Server Prototype Updated
In-Reply-To: <200105020731.f427VRe02096@mira.informatik.hu-berlin.de>
Message-ID:
On Wed, 2 May 2001 09:31:27 +0200
"Martin v. Loewis"
wrote:
> > * It now supports PEP 243 (HTTP POST to
> /archive/pep243_accept to try
> > it out.)
>
> This is what I'm most interested in, so I tried it first,
> using
> swalowsupp.py (adopted to the right host, port, and
> relative path).
Thanks for the bug report. I'll try to get it working.
In the mean time, I copied the form from PEP 243 up the the
server:
http://63.230.174.230:8080/pep243
It works for me.
-Amos
From amos@digicool.com Wed May 2 23:43:08 2001
From: amos@digicool.com (Amos Latteier)
Date: Wed, 02 May 2001 18:43:08 -0400
Subject: [Catalog-sig] [Announce] Catalog Server Prototype Updated
In-Reply-To: <200105020731.f427VRe02096@mira.informatik.hu-berlin.de>
Message-ID:
On Wed, 2 May 2001 09:31:27 +0200
"Martin v. Loewis"
wrote:
> > * It now supports PEP 243 (HTTP POST to
> /archive/pep243_accept to try
> > it out.)
>
> This is what I'm most interested in, so I tried it first,
> using
> swalowsupp.py (adopted to the right host, port, and
> relative path).
> sendFile returned ('TRYAGAIN', '').
OK, I think that I've fixed this now. I am now able to
upload a test package with your upload script.
Let me know if you have any more problems.
-Amos
From martin@loewis.home.cs.tu-berlin.de Wed May 2 23:47:56 2001
From: martin@loewis.home.cs.tu-berlin.de (Martin v. Loewis)
Date: Thu, 3 May 2001 00:47:56 +0200
Subject: [Catalog-sig] [Announce] Catalog Server Prototype Updated
In-Reply-To: (amos@digicool.com)
References:
Message-ID: <200105022247.f42MluR01737@mira.informatik.hu-berlin.de>
> In the mean time, I copied the form from PEP 243 up the the
> server:
>
> http://63.230.174.230:8080/pep243
>
> It works for me.
So it does for me; not sure what I've been doing wrong.
Is the prototype supposed to do anything with the signature, yet? In
theory, it could reliably determine who the uploader is, provided he
had uploaded his public key before.
Regards,
Martin
From amos@digicool.com Thu May 3 18:34:15 2001
From: amos@digicool.com (Amos Latteier)
Date: Thu, 03 May 2001 10:34:15 -0700
Subject: [Catalog-sig] [Announce] Catalog Server Prototype Updated
References: <200105022247.f42MluR01737@mira.informatik.hu-berlin.de>
Message-ID: <3AF19697.A7A7D0FB@digicool.com>
"Martin v. Loewis" wrote:
> Is the prototype supposed to do anything with the signature, yet?
It stores them and makes them available to downloaders. It doesn't do
any automated checking yet.
> In theory, it could reliably determine who the uploader is, provided he
> had uploaded his public key before.
Well there is a facility to upload your public key if you have an
account.
Can you tell me how to determine the uploader given a signature and a
list of public keys?
Thanks!
-Amos
--
Amos Latteier mailto:amos@digicool.com
Digital Creations http://www.digicool.com
From martin@loewis.home.cs.tu-berlin.de Thu May 3 22:57:00 2001
From: martin@loewis.home.cs.tu-berlin.de (Martin v. Loewis)
Date: Thu, 3 May 2001 23:57:00 +0200
Subject: [Catalog-sig] [Announce] Catalog Server Prototype Updated
In-Reply-To: <3AF19697.A7A7D0FB@digicool.com> (message from Amos Latteier on
Thu, 03 May 2001 10:34:15 -0700)
References: <200105022247.f42MluR01737@mira.informatik.hu-berlin.de> <3AF19697.A7A7D0FB@digicool.com>
Message-ID: <200105032157.f43Lv0j01408@mira.informatik.hu-berlin.de>
> Can you tell me how to determine the uploader given a signature and a
> list of public keys?
I think you first need to install all public keys in a
keyring. Assuming you use gpg, this should be done with gpg --import.
Then, given the signature and the file, you do
gpg --verify AFoo-1.0.tar.gz.asc AFoo-1.0.tar.gz
It then prints a message like
gpg: Signature made Thu May 3 23:04:07 2001 CEST using DSA key ID DC3E5D42
gpg: Good signature from "Martin v. Loewis "
There is also a GPG module at http://www.amk.ca/python/code/gpg.html,
which already processes the GPG output. Using the --status-fd option,
you get output that is much better parsable; in my case
[GNUPG:] SIG_ID VptwaSnFDdwDevjjAwD4bbUeWGI 2001-05-03 988923847
[GNUPG:] GOODSIG 10459BC5DC3E5D42 Martin v. Loewis
[GNUPG:] VALIDSIG E6ACD89306E0F05FA7653FCA10459BC5DC3E5D42 2001-05-03 988923847
[GNUPG:] TRUST_ULTIMATE
All this can be probably made to work with pgp as well, but you'd have
to figure it out yourself.
Regards,
Martin
From graeme@sofcom.com.au Thu May 17 02:27:13 2001
From: graeme@sofcom.com.au (Graeme Matthew)
Date: Thu, 17 May 2001 11:27:13 +1000
Subject: [Catalog-sig] Help with Python Regex's
Message-ID: <000c01c0de70$8065ea00$349207cb@gatewaypc>
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C0DEC4.5202B7C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am very new to python (as im a perl developer, sorry !) and am still =
trying to get my head around the regular expression model.
Python does not seem to have perls variable interpolation (or does it ?)
I have an HTML file, example below:
This is a test of things
This is my template file. I want to open it and replace the value with a new value:
Heres my code:
import re
f =3D open("C:\\www.timemanager.com\\test.html")
fileContent =3D f.read()
f.close
newVal =3D "Heres the replacement code which means it worked"
key =3D "Replace Me"
re.sub('\ |