From b54e25c46bb3fd122215e6de440cad78a5ad602b Mon Sep 17 00:00:00 2001 From: "Dr. Peter Poeml" Date: Thu, 29 Jun 2006 23:34:06 +0000 Subject: [PATCH] - 'ci'/'rm': properly quote the path component of URLs used in HTTP requests (now also in DELETE requests, where no quoting was done before at all) - 'id': properly quote the query part of the URL - fix up tests.py - add to TODO --- TODO | 27 +++++++++++++++++++++++++++ osc/core.py | 9 +++++---- tests.py | 13 +++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 374ab010..459be851 100644 --- a/TODO +++ b/TODO @@ -66,3 +66,30 @@ Deleting subversion.nb.po.bz2 Sending subversion.viewcvs.conf Transmitting file data .. +01:20 < darix> DuDE: http://rafb.net/paste/results/hUjH7v14.html +01:21 < darix> that happens if the log is not accessible atm + +02:26 Transmitting file data ..Traceback (most recent call last): +02:26 File "/usr/bin/osc", line 10, in ? +02:26 commandline.main() +02:26 File "/usr/lib/python2.4/site-packages/osc/commandline.py", line 667, in main +02:26 cmd_dict[cmd](args) +02:26 File "/usr/lib/python2.4/site-packages/osc/commandline.py", line 340, in checkin +02:26 p.to_be_deleted.remove(filename) +02:26 ValueError: list.remove(x): x not in list + + +osc repos server:search:ui : + + + + x86_64 + i586 + + + + + x86_64 + i586 + + diff --git a/osc/core.py b/osc/core.py index ab60591e..68613c4f 100755 --- a/osc/core.py +++ b/osc/core.py @@ -10,6 +10,7 @@ __version__ = '0.6' import os import sys import urllib2 +from urllib import pathname2url, quote_plus from urlparse import urlunsplit import cElementTree as ET from cStringIO import StringIO @@ -246,7 +247,7 @@ class Package: def delete_source_file(self, n): import othermethods - u = makeurl(['source', self.prjname, self.name, n]) + u = makeurl(['source', self.prjname, self.name, pathname2url(n)]) othermethods.delfile(u, n, username, password) self.delete_localfile(n) @@ -256,7 +257,7 @@ class Package: # escaping '+' in the URL path (note: not in the URL query string) is # only a workaround for ruby on rails, which swallows it otherwise - u = makeurl(['source', self.prjname, self.name, n.replace('+', '%2B')]) + u = makeurl(['source', self.prjname, self.name, pathname2url(n)]) othermethods.putfile(u, os.path.join(self.dir, n), username, password) shutil.copy2(os.path.join(self.dir, n), os.path.join(self.storedir, n)) @@ -838,7 +839,7 @@ def read_meta_from_spec(specfile): def get_user_id(user): - u = makeurl(['person', user.replace(' ', '+')]) + u = makeurl(['person', quote_plus(user)]) try: f = urllib2.urlopen(u) return ''.join(f.readlines()) @@ -848,7 +849,7 @@ def get_user_id(user): def get_source_file(prj, package, filename, targetfilename=None): - u = makeurl(['source', prj, package, filename.replace('+', '%2B')]) + u = makeurl(['source', prj, package, pathname2url(filename)]) f = urllib2.urlopen(u) o = open(targetfilename or filename, 'w') diff --git a/tests.py b/tests.py index 5f9ae7af..00f07afa 100755 --- a/tests.py +++ b/tests.py @@ -38,6 +38,19 @@ class TestOsc(unittest.TestCase): + + + + + + + + + + + + + """