web2py

representation format in web2py database

牧云@^-^@ 提交于 2019-12-18 15:55:03
问题 db.define_table('person', Field('name'), format='%(name)s') What does this format do here? 回答1: The format argument is used to determine how fields in other tables that reference the 'person' table will be displayed. For example, if you define: db.define_table('dog', Field('name'), Field('owner', db.person) The 'owner' field is a reference field that references the 'person' table (i.e., it stores record id's of records from the 'person' table). In most cases, when you display data from the

selenium and web2py from killer-web-development.com doesn't work

余生长醉 提交于 2019-12-13 19:06:54
问题 I am trying to follow the tutorial on http://killer-web-development.com/section/4/3 and I am running into the error message: ====================================================================== ERROR: setUpClass (test_static_pages.TestHomePage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Applications/web2py.app/Contents/Resources/applications/tukker/functional_tests.py", line 18, in setUpClass self.browser = webdriver

Running Web2Py on G-WAN (generally Python's framework on G-WAN)

跟風遠走 提交于 2019-12-13 17:28:58
问题 Yesterday I have found information about G-WAN server. I have searched many websites but I couldn't discover how to run frameworks like Web2Py which is more complex then simple hello.py file. Is there an easy way to do this? Maybe uWSGI support? 回答1: G-WAN supports the CGI interface , so the CGI environment variables are already there. Usually, Web frameworks are built over this layer. If uWSGI provides more environment variables that are needed for your project then please drop us a line at

mail.send() feature in web2py for bounced email/ email address that doesnt exist

孤街醉人 提交于 2019-12-13 04:47:52
问题 So I made a small app that sends emails from web2py, connected to the gmail smtp server. The problem here is that it always gives me a success message! Even when the email-id is invalid. I have tested the bounce back feature of gmail by sending mails from gmail to invalid email ids to which gmail says 'Your message has been sent', but on going to the sent folder gives the mailer daemon with a time lag(this differs for different mailing services). I think the mail.send() feature of web2py is

web2py - Dropdown menu

一个人想着一个人 提交于 2019-12-13 02:55:47
问题 I'm trying to have a dropdown menu for the user to select the database table. I have defined few tables in db.py and I want the user the to select a particular table from a dropdown menu and insert entries. Right now I use SQLFORM: def index(): form=SQLFORM(db.selectedtable) #want to change the table name# if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill out the form' return dict(form=form) I

Web2py: Customizing Auth Forms

被刻印的时光 ゝ 提交于 2019-12-12 20:25:11
问题 I'm trying to customize the look-and-feel of our login, register, forgot username, and reset password forms. My preferred solution would be to use HTML forms directly, which may require creating new functions and views. At this point, I don't need custom fields. Not exactly sure how to get this done (particularly what to do with the data submitted from the forms). Does anyone have experience getting this done, that can share their approach? UPDATE - Solved this using Anthony's Suggestion.

Web2Py won't connect to MSSQL

本小妞迷上赌 提交于 2019-12-12 14:45:33
问题 I'm unable to get web2py to connect to mssql. <type 'exceptions.RuntimeError'>(Failure to connect, tried 5 times: 'NoneType' object has no attribute 'connect') My connection string is: db = DAL('mssql://testUser:password1@localhost/testDB') Environment Windows Server 2008 R2, 64-bit operating system SQL Server 2008 R2, local. Web2py: source code install version 1.99.2 (2011-09-26 06:55:33) stable. pyodbc Python 2.7.2 I've tested that I can connect using the pyodbc. The following code works:

Using Nose & NoseXUnit on a Python package

只愿长相守 提交于 2019-12-12 11:25:29
问题 This is a previous post detailing a CI setup for Python. The asker and answerer detail the use of Nose and NoseXUnit with Hudson for their builds. However, NoseXUnit throws an error when run on any source folder where init .py is present: File "build/bdist.linux-x86_64/egg/nosexunit/tools.py", line 59, in packages nosexunit.excepts.ToolError: following folder can not contain __init__.py file: /home/dev/source/web2py/applications I can't think of a source folder of mine that is not a package

Can I include partial view in Web2Py, passing specific variables into it?

柔情痞子 提交于 2019-12-12 09:47:36
问题 I sometimes need to use partial views in Web2Py , but I need to pass some specific variables to them . In Django it would look like this: {% include "image.html" with caption="Me" source="http://example.com/img.png" %} In case of Web2Py I can do something like: {{ include "image.html" }} but there is not even a single mention about passing variables to partial views within the documentation (or I am missing something pretty obvious). The use case for this is decreasing complexity of the views

How to change the background image using img file from database in Web2py

為{幸葍}努か 提交于 2019-12-12 06:13:44
问题 What I am trying to do is to keep changing the background image using image files that are uploaded in the database instead in the 'static', 'images' folder. I obviously can't do this in the css , actually, I am not sure if this is even possible. Can I make this work in the layout.html or in the View somehow? This is how I would display an image in the View if it wasn't intended to be a background-image: <img src="{{=URL('download', args=pic_row.pics)}}"/> Of course, this approach to display