require a request to shorten the url
This commit is contained in:
Родитель
ae33f14f45
Коммит
930850faa6
|
@ -6,6 +6,7 @@ import sys
|
|||
import httplib2
|
||||
import copy
|
||||
from urlparse import urlparse
|
||||
from paste.deploy.converters import asbool
|
||||
|
||||
from pylons import config, request, response, session
|
||||
from pylons.controllers.util import abort, redirect
|
||||
|
@ -45,6 +46,7 @@ The 'send' namespace is used to send updates to our supported services.
|
|||
message = request.POST.get('message', '')
|
||||
username = request.POST.get('username')
|
||||
longurl = request.POST.get('link')
|
||||
shorten = asbool(request.POST.get('shorten', 0))
|
||||
shorturl = request.POST.get('shorturl')
|
||||
userid = request.POST.get('userid')
|
||||
to = request.POST.get('to')
|
||||
|
@ -79,7 +81,7 @@ The 'send' namespace is used to send updates to our supported services.
|
|||
return {'result': result, 'error': error}
|
||||
|
||||
args = copy.copy(request.POST)
|
||||
if not shorturl and longurl:
|
||||
if shorten and not shorturl and longurl:
|
||||
u = urlparse(longurl)
|
||||
if not u.scheme:
|
||||
longurl = 'http://' + longurl
|
||||
|
|
Загрузка…
Ссылка в новой задаче