Frequently Asked Questions (FAQ)
Frequently Encountered Problems
If it happens that you notice the following in the Traceback of the ticket encountered after a fresh pull -
OperationalError: Cannot add a UNIQUE column
Then it is highly likely that there is a data migration issue. In this circumstance, it is recommended that the contents of the folder /eden/database/ be deleted. For more, information in this regard and any other related problem, the following links can be referred from -
http://eden.sahanafoundation.org/wiki/TroubleShooting
http://eden.sahanafoundation.org/wiki/DataMigration
Select Element for Users
By: Robby O'Connor
Date: 2010-05-21
To have a field displayed as a select element which has the names of the users in the database:
<table>.<field>.requires = IS_NULL_OR(IS_IN_DB(db,db.auth_user.id,lambda id : shn_user_represent(db.auth_user.id)))
Interactive vs. Non-Interactive Functions
- Interactive = via web browser (html)
- Non-Interactive = Sync, import, etc (xml, csv)
Never do a redirect or create records (the latter is slightly less 100%) in non-interactive functions.
All resources should assume to be touched non-interactively at some point (even if just to load test/demo data)
onaccept & onvalidation are always called by non-interactive functions
Protect sections within these functions to be only accessed via interactive calls using:
if isinstance(form, FORM): # Interactive request