mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Added urlquote/urlunquote to webutils and changed Fun to use them.
This commit is contained in:
parent
ad7ae52bd9
commit
164d4bc427
@ -41,7 +41,6 @@ import sys
|
|||||||
import md5
|
import md5
|
||||||
import sha
|
import sha
|
||||||
import random
|
import random
|
||||||
import urllib
|
|
||||||
import inspect
|
import inspect
|
||||||
import mimetypes
|
import mimetypes
|
||||||
from itertools import imap
|
from itertools import imap
|
||||||
@ -52,6 +51,7 @@ import supybot.ircmsgs as ircmsgs
|
|||||||
import supybot.ircutils as ircutils
|
import supybot.ircutils as ircutils
|
||||||
import supybot.privmsgs as privmsgs
|
import supybot.privmsgs as privmsgs
|
||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
|
import supybot.webutils as webutils
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ class Fun(callbacks.Privmsg):
|
|||||||
Returns the URL quoted form of the text.
|
Returns the URL quoted form of the text.
|
||||||
"""
|
"""
|
||||||
text = privmsgs.getArgs(args)
|
text = privmsgs.getArgs(args)
|
||||||
irc.reply(urllib.quote(text))
|
irc.reply(webutils.urlquote(text))
|
||||||
|
|
||||||
def urlunquote(self, irc, msg, args):
|
def urlunquote(self, irc, msg, args):
|
||||||
"""<text>
|
"""<text>
|
||||||
@ -220,7 +220,7 @@ class Fun(callbacks.Privmsg):
|
|||||||
Returns the text un-URL quoted.
|
Returns the text un-URL quoted.
|
||||||
"""
|
"""
|
||||||
text = privmsgs.getArgs(args)
|
text = privmsgs.getArgs(args)
|
||||||
s = urllib.unquote(text)
|
s = webutils.urlunquote(text)
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
|
|
||||||
def coin(self, irc, msg, args):
|
def coin(self, irc, msg, args):
|
||||||
|
@ -33,6 +33,7 @@ import supybot.fix as fix
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
import httplib
|
import httplib
|
||||||
import urlparse
|
import urlparse
|
||||||
@ -40,6 +41,9 @@ import urlparse
|
|||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
|
|
||||||
Request = urllib2.Request
|
Request = urllib2.Request
|
||||||
|
urlquote = urllib.quote
|
||||||
|
urlunquote = urllib.unquote
|
||||||
|
|
||||||
class WebError(Exception):
|
class WebError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -117,6 +121,5 @@ def getUrl(url, size=None, headers=None):
|
|||||||
def getDomain(url):
|
def getDomain(url):
|
||||||
return urlparse.urlparse(url)[1]
|
return urlparse.urlparse(url)[1]
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user