Exemplo n.º 1
0
Arquivo: app.py Projeto: Elenw/zwiki
def move(url):
    page = wiki.get_or_404(url)
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        wiki.move(url, newurl)
        return redirect(url_for('.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 2
0
def move(url):
    page = wiki.get_or_404(url)
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        wiki.move(url, newurl)
        return redirect(url_for('.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 3
0
def home(request):
   args = {}
   args.update(csrf(request))
   if request.POST:
      form = URLForm(request.POST)
      if form.is_valid():
         validate = URLValidator()
         address = form.cleaned_data['direccion']
         try:
            validate(address)
         except ValidationError, e:
            address = "http://" + address
         try:
            validate(address)
            code = urllib.urlopen(address).getcode()
            args['result'] = "Wohoo! The website works! \nOh, but... Maybe your computer has something wrong...?"
         except IOError, e:
            args['result'] = "Aww... the website is down );"
         except ValidationError, e:
            args['result'] = "Hmmm... I think this is not a valid URL..."
Exemplo n.º 4
0
Arquivo: app.py Projeto: Elenw/zwiki
def create():
    form = URLForm()
    if form.validate_on_submit():
        return redirect(url_for('edit', url=form.clean_url(form.url.data)))
    return render_template('create.html', form=form)
Exemplo n.º 5
0
def create():
    form = URLForm()
    if form.validate_on_submit():
        return redirect(url_for('edit', url=form.clean_url(form.url.data)))
    return render_template('create.html', form=form)