web2py

Post-login redirection in web2py

元气小坏坏 提交于 2020-01-14 13:10:09
问题 I'm having trouble controlling post-login redirection behavior in web2py. According to this, web2py handles post-login redirection differently, depending on whether the login was initiated by the system (e.g. when accessing a auth-protected function) or by a user (when clicking a 'log in' link). In the former case, the behavior is to redirect to the referring page after login, as would be expected. In the latter, however, the user is redirected to an index page after login, or to a page

Post-login redirection in web2py

試著忘記壹切 提交于 2020-01-14 13:09:20
问题 I'm having trouble controlling post-login redirection behavior in web2py. According to this, web2py handles post-login redirection differently, depending on whether the login was initiated by the system (e.g. when accessing a auth-protected function) or by a user (when clicking a 'log in' link). In the former case, the behavior is to redirect to the referring page after login, as would be expected. In the latter, however, the user is redirected to an index page after login, or to a page

Custom CSS classes for SQLFORM widget input in web2py

你。 提交于 2020-01-12 03:53:28
问题 Given this SQLFORM in the controller: form = SQLFORM.factory(db.source_server, db.target_server) with the following table definition: db.define_table('target_server', Field('target_url', 'string'), Field('target_user', 'string'), Field('target_password', 'password')) db.define_table('target_server', Field('target_url', 'string'), Field('target_user', 'string'), Field('target_password', 'password')) how can I apply custom CSS classes for each form widget <input> element? {{=form.custom.begin}}

Web2py: pass parameters to db Connection()

孤者浪人 提交于 2020-01-07 01:51:05
问题 In web2py, in gluon/contrib/pymysql/connections.py there is a function that creates a new mySQL connection: def __init__(self, host="localhost", user=None, passwd="", db=None, port=3306, unix_socket=None, Is there any way to pass parameters to this function from web2py? 回答1: As noted at the very end of this section of the documentation, you can specify a dictionary of driver_args when instantiating DAL : db = DAL(<connection_string>, driver_args=dict(host='localhost', port=3306, ...)) 来源:

web2py custom form doesn't submit

ⅰ亾dé卋堺 提交于 2020-01-06 18:12:32
问题 I cant seem to submit my form with this code: @auth.requires_login() def index(): db.post.answers.writable=False db.post.answers.readable=False form = SQLFORM(Post, formstyle='divs') if form.process().accepted: pass code..... return(form=form) view: {{=form.custom.begin}} <div class="chat-form"> <textarea></textarea> <button>Send</button> </div> {{=form.custom.end}} My db is empty with no data submitted.Please help Regards 回答1: You must specify "name" attributes for your HTML input elements,

How can I put an image from DB table in Web2py?

独自空忆成欢 提交于 2020-01-05 16:44:13
问题 I'm trying to put an image in view section I have defined a table but it seems {{for table in tables:}} doesn't work. My code is: default.py (Controller) def index(): return dict(message=T('Hello World')) def Tables(): return dict(tables=db().select(db.table.ALL)) def download(): return response.download(request, db) db.py (model) db.define_table('table', Field('image', type='upload') This is it and I tried to do {{for table in tables:}} before putting the image, but it says, the tables is

How can I put an image from DB table in Web2py?

北战南征 提交于 2020-01-05 16:42:50
问题 I'm trying to put an image in view section I have defined a table but it seems {{for table in tables:}} doesn't work. My code is: default.py (Controller) def index(): return dict(message=T('Hello World')) def Tables(): return dict(tables=db().select(db.table.ALL)) def download(): return response.download(request, db) db.py (model) db.define_table('table', Field('image', type='upload') This is it and I tried to do {{for table in tables:}} before putting the image, but it says, the tables is

Trying to run nosetests outputing with xunit and using suite

隐身守侯 提交于 2020-01-05 09:35:14
问题 I'm trying to run nosetests in web2py using suite and outputing with xunit, it creates the xml files but even if the console shows that there were errors, but, they are not been written in the xml file The .py script: suite = TestLoader().loadTestsFromTestClass(globals()[strArchivo+strDirectorio]) noseargs = ['fake','--processes=0','v=0','--process-timeout=60', '--with-xunit', '--xunit-file=applications/output.xml','--verbosity=0'] nose.run(argv = noseargs,suite = suite) The console output:

Reading from a text file web2py

≡放荡痞女 提交于 2020-01-05 07:35:13
问题 I'm having an issue with web2py. I have a text file called defVals.txt that's in the modules folder. I try to read from it, using open("defVals.txt") (in a Module in the same director as defVals.txt), but I get the error: Traceback (most recent call last): File "/home/jordan/web2py/gluon/restricted.py", line 212, in restricted exec ccode in environment File "/home/jordan/web2py/applications/randommotif/controllers/default.py", line 67, in <module> File "/home/jordan/web2py/gluon/globals.py",

Reading from a text file web2py

情到浓时终转凉″ 提交于 2020-01-05 07:35:08
问题 I'm having an issue with web2py. I have a text file called defVals.txt that's in the modules folder. I try to read from it, using open("defVals.txt") (in a Module in the same director as defVals.txt), but I get the error: Traceback (most recent call last): File "/home/jordan/web2py/gluon/restricted.py", line 212, in restricted exec ccode in environment File "/home/jordan/web2py/applications/randommotif/controllers/default.py", line 67, in <module> File "/home/jordan/web2py/gluon/globals.py",