Die Suche ergab 14 Treffer

von zoxzox3
Samstag 20. März 2010, 22:01
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

POST is empty, bottle 0.8
from bottle import request, response, run, route

@route('/')
def cookie():
return '<html><body> <form action="/" method="POST" > <input type="TEXT" name="name" /> <input type="submit" /> </form> </body></html>'

@route('/', method='POST')
def set_cookie():
if ...
von zoxzox3
Freitag 19. März 2010, 20:57
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

POST is empty, bottle 0.8

from bottle import request, response, run, route

@route('/')
def cookie():
return '<html><body> <form action="/" method=post> <input type=text name=name /> <input type=submit /> </form> </body></html>'

@route('/', method='POST')
def set_cookie():
if 'name' in request ...
von zoxzox3
Freitag 19. März 2010, 17:04
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

in bottle 0.7.0a, it work ok

Really? Your HTML form is flawed, the "action" parameter is required.
See: http://www.w3.org/TR/html401/interact/forms.html#h-17.3

If "action" is not specified then all browsers are perceived as the current url.
is not being, post in the bottle is empty .
von zoxzox3
Freitag 19. März 2010, 09:18
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

POST is empty, bottle 0.8

from bottle import request, response, run, route

@route('/')
def cookie():
return '<html><body> <form method=post> <input type=text name=name /> <input type=submit /> </form> </body></html>'

@route('/', method='POST')
def set_cookie():
if 'name' in request.POST ...
von zoxzox3
Sonntag 7. Februar 2010, 11:54
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

Re: Encoding Error in Jinja-Template

Ein 'Ü' in einem Jinja2-Template brachte mir:
Unhandled Exception: UnicodeDecodeError('ascii',\xc3\x9cbersicht, 1138, 1139, 'ordinal not in range(128)')

Es hilft in bottle.py (Version 0.6.4) in Zeile 847 ein ".decode('utf-8')" anzuhängen. Siehe auch das Beispiel für einen
Jinja2 BaseLoader in der ...
von zoxzox3
Dienstag 2. Februar 2010, 05:34
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

Leonidas hat geschrieben:
zoxzox3 hat geschrieben:wiki by bottle in 23 minuten
http://lega.selfip.com/page/23 (video 33Mb, Host ist nicht verfügbar, in der Nacht)
:)
Ich würds ja mirrorn, aber der Host ist nicht verfügbar ;)
time work for host 3:00 - 19:00 UTC
von zoxzox3
Dienstag 2. Februar 2010, 05:19
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

error redirect

Kunde öffnet die Seite "domen.com", es apache-Proxy, der leitet die Anfragen an "host_local", die web_bottle.
Funktion bottle.redirect('/'), gesetzt location = 'host_local/', und richtig location = 'domen.com/'

diff
Index: bottle.py ...
von zoxzox3
Montag 1. Februar 2010, 21:22
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

wiki by bottle in 23 minuten
http://lega.selfip.com/page/23 (video 33Mb, Host ist nicht verfügbar, in der Nacht)
:)
von zoxzox3
Sonntag 31. Januar 2010, 17:52
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

variant for loaded

Code: Alles auswählen

@route('/upload', method='POST')
def do_upload():
    df = request.POST.get('datafile')
    open('uploads/111.txt','wb').write( df.file.read() )
    redirect('/',302)
:)
von zoxzox3
Sonntag 31. Januar 2010, 17:36
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

Code: Alles auswählen

@route('/upload', method='POST')
def do_upload():
    df = request.POST.get('datafile')
    return df.value
this work, but loaded datafile in memory
von zoxzox3
Sonntag 31. Januar 2010, 17:33
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

File Uploads don't work.
from bottle import run, route, request, debug

@route('/')
def main():
return """<html><body>
<form action="/upload" method="post" enctype="multipart/form-data">
<input name="datafile" type="file" />
<input type=submit value="OK" />
</form>
</body></html>"""

@route ...
von zoxzox3
Mittwoch 27. Januar 2010, 06:32
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

Re: error in bottle.jinja2_template

error in bottle.jinja2_template
error find:

Bottle 0.6.4:
class Jinja2Template(BaseTemplate):
def loader(self, name):
if not name.endswith(".tpl"):
for path in self.lookup:
fpath = os.path.join(path, name+'.tpl')
if os.path.isfile(fpath):
name = fpath
break
f = open(name)
try: return f ...
von zoxzox3
Mittwoch 27. Januar 2010, 05:28
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

Re: error in bottle.jinja2_template

zoxzox3 hat geschrieben:error in bottle.jinja2_template
and mako not work

this work code:

Code: Alles auswählen

from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('views'))
print env.get_template('test1.tpl').render()
von zoxzox3
Dienstag 26. Januar 2010, 18:27
Forum: Showcase
Thema: Bottle: Micro Web Framework
Antworten: 593
Zugriffe: 131741

error in bottle.jinja2_template

error in bottle.jinja2_template
code:
# coding: utf-8
from bottle import jinja2_template as template
print template('test1')
test1.tpl (utf-8 ru chars)

Тест строка

error:

>python test1.py
Traceback (most recent call last):
File "test1.py", line 5, in <module>
print template('test1')
File ...