mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 15:58:06 -05:00
small bugfixes; empty response no longer raises an exception; mangled thing_ids are ignored by vote; cnamed domains don't break when hitting /r/.
This commit is contained in:
@@ -532,7 +532,7 @@ class RedditController(BaseController):
|
||||
|
||||
def post(self):
|
||||
response = c.response
|
||||
content = response.content
|
||||
content = filter(None, response.content)
|
||||
if isinstance(content, (list, tuple)):
|
||||
content = ''.join(content)
|
||||
for w in c.response_wrappers:
|
||||
|
||||
@@ -265,7 +265,7 @@ def chksrname(x):
|
||||
|
||||
|
||||
class VLinkFullnames(Validator):
|
||||
"A space- or comma-separated list of fullnames for Links"
|
||||
"A space- or comma-separated list of fullnames for Links"
|
||||
valid_re = re.compile(r'^(' + Link._type_prefix + str(Link._type_id) +
|
||||
r'_[0-9a-z]+[ ,]?)+$')
|
||||
splitter = re.compile('[ ,]+')
|
||||
@@ -363,12 +363,15 @@ class VAccountByName(VRequired):
|
||||
return self.error()
|
||||
|
||||
class VByName(VRequired):
|
||||
fullname_re = re.compile(r'^' + Thing._type_prefix +
|
||||
r'[0-9a-z]+_[0-9a-z]+$')
|
||||
|
||||
def __init__(self, param,
|
||||
error = errors.NO_THING_ID, *a, **kw):
|
||||
VRequired.__init__(self, param, error, *a, **kw)
|
||||
|
||||
def run(self, fullname):
|
||||
if fullname:
|
||||
if fullname and self.fullname_re.match(fullname):
|
||||
try:
|
||||
return Thing._by_fullname(fullname, False, data=True)
|
||||
except NotFound:
|
||||
|
||||
@@ -1008,6 +1008,8 @@ def trace(fn):
|
||||
return new_fn
|
||||
|
||||
def common_subdomain(domain1, domain2):
|
||||
if not domain1 or not domain2:
|
||||
return ""
|
||||
domain1 = domain1.split(":")[0]
|
||||
domain2 = domain2.split(":")[0]
|
||||
if len(domain1) > len(domain2):
|
||||
|
||||
Reference in New Issue
Block a user