• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(112)  |  Call(90)  |  Derive(0)  |  Import(22)
Aborts execution and causes a 303 redirect 

        def redirect(url, code=303):
    """ Aborts execution and causes a 303 redirect """
    scriptname = request.environ.get('SCRIPT_NAME', '').rstrip('/') + '/'
    location = urljoin(request.url, urljoin(scriptname, url))
    raise HTTPResponse("", status=code, header=dict(Location=location))
        


src/b/i/BigBlueButton-PythonExample-HEAD/main.py   BigBlueButton-PythonExample(Download)
#! coding: utf-8
# pylint: disable-msg=W0311
from bottle import route, redirect, request, run, jinja2_template, \
                    debug, static_file, response
import api
 
      if username not in info.get("moderator_users") and username not in settings.admins:
        redirect("/start")
 
      users = api.suggest("")
      attendee_users = [x.strip() for x in attendee_users if x != ""]
      api.update(username, meeting_id, name, attendee_users)
      redirect('/start')
 
 
      if username in info.get("moderator_users"):
        api.remove(meeting_id)
  redirect("/start")
 
 
  ok = api.check(username, password)
  if not ok:
    redirect("/login")
  meeting_list = api.meeting_list()
 

src/h/e/healthgraph-api-0.3.0/samples/bottle/runkeeper_demo.py   healthgraph-api(Download)
def index():
    sess = bottle.request.environ['beaker.session']
    if sess.has_key('rk_access_token'):
        bottle.redirect('/welcome')
    else:
        sess['rk_access_token'] = access_token
        sess.save()
        bottle.redirect('/welcome')
 
@bottle.route('/welcome')
                               records=records.get_totals())
    else:
        bottle.redirect('/')
 
@bottle.route('/logout')
def logout():
    sess = bottle.request.environ['beaker.session']
    sess.delete()
    bottle.redirect('/')
                                             else None))
    else:
        bottle.redirect('/')
 
 

src/c/o/cony-0.2.0/examples/search.py   cony(Download)
from bottle import redirect
 
 
def cmd_fl(term):
    """Search among Flickr photos under Creative Commons license."""
    redirect('http://www.flickr.com/search/?q=%s&l=cc&ss=0&ct=0&mt=all&w=all&adv=1' % term)
 
 
def cmd_pep(term):
    redirect('http://www.python.org/dev/peps/pep-%0.4d/' % int(term))
def cmd_dj(term):
    """Django documentation search."""
    redirect(
        'http://docs.djangoproject.com/en/dev/search/?cx=009763561546736975936:e88ek0eurf4&'
        'cof=FORID:11&q=%s&siteurl=docs.djangoproject.com/en/dev/topics/db/models/' % term

src/c/o/cony-0.2.0/examples/lang.py   cony(Download)
import urllib
 
from bottle import redirect
 
def cmd_tr(term):
    else:
        direction = 'en|ru'
    redirect('http://translate.google.com/#%s|%s' % (direction, term))
 
def cmd_save_word(term):

src/t/h/thermos-0.1.5/examples/thermos-example-bottle-repozewhat.py   thermos(Download)
 
from bottle import route, run, app, get, post, abort, request, debug
from bottle import template, redirect
 
from repoze.what.plugins.quickstart import setup_sql_auth

src/b/o/bottle-sqlalchemy-0.3.1/examples/basic.py   bottle-sqlalchemy(Download)
#!/usr/bin/python
import bottle
from bottle import route, redirect, put, delete
from bottle.ext.sqlalchemy import SQLAlchemyPlugin
 

src/b/o/Bottle-SSLify-0.0.1/bottle_sslify.py   Bottle-SSLify(Download)
 
 
from bottle import hook, redirect, request
 
class SSLify(object):
        code = 301 if self.permanent else 302
 
      redirect(url, code=code)
 

src/p/y/pyroxy-0.1/src/pyroxy/controllers/static.py   pyroxy(Download)
import time
 
from bottle import template, static_file, redirect
from mimetypes import guess_type
 
        moved_location = relative_path + "/"
        log.info("Redirecting with trailing slash to %s", moved_location)
        redirect(moved_location, 301)
 
    # If we have an index file available in the current directory, serve it.

src/t/u/tunesweb-1.0b1/src/tunesweb/__init__.py   tunesweb(Download)
import socket
import win32com.client as wc
from bottle import route, run, view, redirect
 
 
def control_next():
    get_itunes().NextTrack()
    redirect('/')
 
 
@route('/control/prev')
def control_prev():
    get_itunes().PreviousTrack()
    redirect('/')
def control_play():
    get_itunes().Play()
    redirect('/')
 
 
@route('/control/pause')
def control_pause():
    get_itunes().Pause()
    redirect('/')

src/r/e/retwis-py-HEAD/app.py   retwis-py(Download)
      if user:
        return handler(user,*args,**kwargs)
    bottle.redirect('/login')
  return _check_auth
 
def index():
  if user_is_logged():
    bottle.redirect('/home')
  return bottle.template('home_not_logged',logged=False)
 
def post(user):
  content = bottle.request.POST['content']
  Post.create(user, content)
  bottle.redirect('/home')
 
def post(user,name):
  user_to_follow = User.find_by_username(name)
  if user_to_follow:
    user.follow(user_to_follow)
  bottle.redirect('/%s' % name)
def post(user,name):
  user_to_unfollow = User.find_by_username(name)
  if user_to_unfollow:
    user.stop_following(user_to_unfollow)
  bottle.redirect('/%s' % name)

  1 | 2 | 3 | 4  Next