Show More
@@ -356,6 +356,18 b' def decodecaps(blob):' | |||||
356 | caps[key] = vals |
|
356 | caps[key] = vals | |
357 | return caps |
|
357 | return caps | |
358 |
|
358 | |||
|
359 | def encodecaps(caps): | |||
|
360 | """encode a bundle2 caps dictionary into a bytes blob""" | |||
|
361 | chunks = [] | |||
|
362 | for ca in sorted(caps): | |||
|
363 | vals = caps[ca] | |||
|
364 | ca = urllib.quote(ca) | |||
|
365 | vals = [urllib.quote(v) for v in vals] | |||
|
366 | if vals: | |||
|
367 | ca = "%s=%s" % (ca, ','.join(vals)) | |||
|
368 | chunks.append(ca) | |||
|
369 | return '\n'.join(chunks) | |||
|
370 | ||||
359 | class bundle20(object): |
|
371 | class bundle20(object): | |
360 | """represent an outgoing bundle2 container |
|
372 | """represent an outgoing bundle2 container | |
361 |
|
373 |
General Comments 0
You need to be logged in to leave comments.
Login now