(request, code)
return render(request, '400.html', status=400)
TODO: Validate code
TODO: Validate code
TODO : Validate code
def get_short_link(request, code):
    """TODO: Validate code"""
    if request.method == 'GET':
        try:
            # TODO: use urljoin
            schema = 'https://' if request.is_secure() else 'http://'
            url_obj = {}
            url_obj['short_url'] = (
                schema + request.META['HTTP_HOST'] + '/' + url_obj.get(
                    'short_code', code)
            )
        except ObjectNotFound as e:
            return render(request, '404.html',
                          context=API_ERROR(e.args[0]), status=404)
        context = dict(short_url=url_obj['short_url'], short_code=code)
        return render(request, 'pygmy/short_url.html', context=context)
    return render(request, '400.html', status=400)
def get_short_link ( request , code ) : if request . method == 'GET' : try : # TODO: use urljoin schema = 'https://' if request . is_secure ( ) else 'http://' url_obj = { } url_obj [ 'short_url' ] = ( schema + request . META [ 'HTTP_HOST' ] + '/' + url_obj . get ( 'short_code' , code ) ) except ObjectNotFound as e : return render ( request , '404.html' , context = API_ERROR ( e . args [ 0 ] ) , status = 404 ) context = dict ( short_url = url_obj [ 'short_url' ] , short_code = code ) return render ( request , 'pygmy/short_url.html' , context = context ) return render ( request , '400.html' , status = 400 )