Added urlquote/urlunquote to webutils and changed Fun to use them.

This commit is contained in:
Jeremy Fincher 2004-09-20 11:48:37 +00:00
parent ad7ae52bd9
commit 164d4bc427
2 changed files with 7 additions and 4 deletions

View File

@ -41,7 +41,6 @@ import sys
import md5
import sha
import random
import urllib
import inspect
import mimetypes
from itertools import imap
@ -52,6 +51,7 @@ import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.privmsgs as privmsgs
import supybot.registry as registry
import supybot.webutils as webutils
import supybot.callbacks as callbacks
@ -212,7 +212,7 @@ class Fun(callbacks.Privmsg):
Returns the URL quoted form of the text.
"""
text = privmsgs.getArgs(args)
irc.reply(urllib.quote(text))
irc.reply(webutils.urlquote(text))
def urlunquote(self, irc, msg, args):
"""<text>
@ -220,7 +220,7 @@ class Fun(callbacks.Privmsg):
Returns the text un-URL quoted.
"""
text = privmsgs.getArgs(args)
s = urllib.unquote(text)
s = webutils.urlunquote(text)
irc.reply(s)
def coin(self, irc, msg, args):

View File

@ -33,6 +33,7 @@ import supybot.fix as fix
import re
import socket
import urllib
import urllib2
import httplib
import urlparse
@ -40,6 +41,9 @@ import urlparse
import supybot.conf as conf
Request = urllib2.Request
urlquote = urllib.quote
urlunquote = urllib.unquote
class WebError(Exception):
pass
@ -117,6 +121,5 @@ def getUrl(url, size=None, headers=None):
def getDomain(url):
return urlparse.urlparse(url)[1]
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: