diff options
author | lwhsu <lwhsu@FreeBSD.org> | 2010-08-22 09:12:18 +0800 |
---|---|---|
committer | lwhsu <lwhsu@FreeBSD.org> | 2010-08-22 09:12:18 +0800 |
commit | 01aa1116fdadab7aeecb067d19d79c8848948010 (patch) | |
tree | 8b9839d8b7e44e87d8d8857fdc5f1c03748d3b51 /www/py-rssdler | |
parent | 2e701d2f379089acbd18a1f506d64f61fcb0649f (diff) | |
download | freebsd-ports-gnome-01aa1116fdadab7aeecb067d19d79c8848948010.tar.gz freebsd-ports-gnome-01aa1116fdadab7aeecb067d19d79c8848948010.tar.zst freebsd-ports-gnome-01aa1116fdadab7aeecb067d19d79c8848948010.zip |
- Make xmlUnEscape and percentUnQuote case-insensitive
PR: ports/147706
Submitted by: Anonymous <swell.k AT gmail.com> (maintainer)
Diffstat (limited to 'www/py-rssdler')
-rw-r--r-- | www/py-rssdler/Makefile | 2 | ||||
-rw-r--r-- | www/py-rssdler/files/patch-percentUnQuote | 16 | ||||
-rw-r--r-- | www/py-rssdler/files/patch-xmlUnEscape | 32 |
3 files changed, 49 insertions, 1 deletions
diff --git a/www/py-rssdler/Makefile b/www/py-rssdler/Makefile index d15b60d89838..6fb0f39195e8 100644 --- a/www/py-rssdler/Makefile +++ b/www/py-rssdler/Makefile @@ -7,7 +7,7 @@ PORTNAME= rssdler PORTVERSION= 0.4.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www python MASTER_SITES= GOOGLE_CODE PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} diff --git a/www/py-rssdler/files/patch-percentUnQuote b/www/py-rssdler/files/patch-percentUnQuote new file mode 100644 index 000000000000..b9c7e108acb9 --- /dev/null +++ b/www/py-rssdler/files/patch-percentUnQuote @@ -0,0 +1,16 @@ +Index: rssdler.py +=================================================================== +--- rssdler.py (revision 169) ++++ rssdler.py (working copy) +@@ -363,9 +363,9 @@ def percentUnQuote( sStr, p=percentunQuoteDict, re + replaced in order of the sequence""" + for search in p: + if search in reserved: continue +- sStr = sStr.replace( search, p[search] ) ++ sStr = re.sub('(?i)' + re.escape(search), p[search], sStr) + for search in reserved: +- sStr = sStr.replace( search, p[search]) ++ sStr = re.sub('(?i)' + re.escape(search), p[search], sStr) + return sStr + + def percentQuote(sStr, urlPart=(2,), pd=percentQuoteDict): diff --git a/www/py-rssdler/files/patch-xmlUnEscape b/www/py-rssdler/files/patch-xmlUnEscape new file mode 100644 index 000000000000..75e0e7823ba5 --- /dev/null +++ b/www/py-rssdler/files/patch-xmlUnEscape @@ -0,0 +1,32 @@ +Index: rssdler.py +=================================================================== +--- rssdler.py (revision 169) ++++ rssdler.py (working copy) +@@ -79,6 +79,7 @@ percentQuoteDict = {u'!': u'%21', u' ': u'%20', u' + u';': u'%3B', u':': u'%3A', u']': u'%5D', u'[': u'%5B', u'?': u'%3F', + u'!':u'%7E'} + percentunQuoteDict = dict(((j,i) for (i,j) in percentQuoteDict.items())) ++xmlUnEscapeDict = { u'<' : u'<', u'>' : u'>', u'&' : u'&' } + netscapeHeader= """# HTTP Cookie File + # http://www.netscape.com/newsref/std/cookie_spec.html + # This is a generated file! Do not edit.\n\n""" +@@ -327,16 +328,15 @@ def unicodeC( s ): + raise UnicodeEncodeError(u'could not encode %s to unicode' % s) + return s + +-def xmlUnEscape( sStr, percent=0, pd=percentunQuoteDict ): ++def xmlUnEscape( sStr, percent=0, pd=percentunQuoteDict, xd=xmlUnEscapeDict ): + u"""xml unescape a string, by default also checking for percent encoded + characters. set percent=0 to ignore percent encoding. + can specify your own percent quote dict + (key, value) pairs are of (search, replace) ordering with percentunQuoteDict + """ +- sStr = sStr.replace("<", "<") +- sStr = sStr.replace(">", ">") + if percent: sStr = percentUnQuote( sStr, pd ) +- sStr = sStr.replace("&", "&") ++ for search in xd: ++ sStr = re.sub('(?i)' + re.escape(search), xd[search], sStr) + return sStr + + def percentIsQuoted(sStr, testCases=percentQuoteDict.values()): |