From 930850faa68c913222318a6d6e09eff616051a2b Mon Sep 17 00:00:00 2001 From: mixedpuppy Date: Fri, 15 Oct 2010 13:55:52 -0700 Subject: [PATCH] require a request to shorten the url --- linkdrop/controllers/send.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linkdrop/controllers/send.py b/linkdrop/controllers/send.py index ded55dc..8383904 100644 --- a/linkdrop/controllers/send.py +++ b/linkdrop/controllers/send.py @@ -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