49. Sahana Community Tools Email List [email_address] IRC Chat # sahana-eden Wiki / BugTracker eden.sahanafoundation.org LaunchPad launchpad.net/sahana-eden DimDim Twitter @SahanaFOSS
Notes de l'éditeur
2.5 or 2.6 (2.4 supported by Web2Py so shouldn’t be too hard to support)
autocomplete (replace with jquery.ui) cluetip (replace with jquery.ui)
You can install the software from the provided packs on USB flash drives. ‘bzr up’
JS which doesn’t require parsing put into static
Sahana extends these with the concept of Modules – logical groupings of user-facing functionality Not the same as Python modules
Sahana Eden is Resource-centric
URL() is an example of an HTML ‘Helper’ object Remember that after server-side Python finishes, we still have a lot of possibilities client-side with JavaScript.
Minimise the time taken to process core needs no imports Manage dependencies
Take a look at them now
Take a look at them now
Take a look at them now
No need to create a manual routes entry, unlike Django
Extend just a single other file Include many others Browse the variables using about (or include that within your own view)
There is a deliberate error in the code on this page ( “ instead of " ) in order to demonstrate the ticket viewer
Create vehicle Try also .json, .xml, .xls, .pdf
Fields default to type ‘string’. Type ‘date’ & unique=True are SQL-level constraints Validators provide both server-side validation & client-side rendering & validation
All user-visible text should be localised by calling through T() NB If concatenating with strings, need to str() the LazyT 1 st . Comment is rendered as ‘column3’
Try them out…
Can provide your own custom buttons here – shn_action_buttons are just the common ones. See definition in models/00_utils.py
Only want this in interactive views, not JSON/XML Don’t want this in Popups S3’s REST Controller is built on top of Web2Py’s ‘Crud’ controller, so we can control that from here
Web2Py source code very accessible – small enough to be able to grasp the whole thing after not too long If you drop down a level, then need to do things more manually & need to take care of framework issues yourself. e.g. Don’t redirect in an onaccept or you’ll break bulk XML imports!
Module Type 4 means appears in the ‘Aid Management’ section of the default modules menu. NB Most deployments will create a customised menu anyway.
See plain HTML being interspersed with the server-side parsed Python Look at another module’s index.html What’s bad about this index? (Text not Internationalised)
How come we didn’t need any views before?
IS_ONE_OF() is an S3 validator which extends Web2Py’s IS_IN_DB() to support the ‘deleted’ status & also allow the use of lambdas as formatting options. It will provide us a dropdown showing license plates, even though we actually store the ID. location_id is a ‘reusable field’ & is defined in models/03_gis.py – look it up! ( grep –recursive location_id *)
Naïve version
Google: web2py dal Sqlite out of the box. MySQL also well-tested with Eden. PostgreSQL is where we want to go for the Spatial support. Try these out in the Web2Py shell Don’t take effect until you db.commit() Beware locking with Sqlite! (e.g. cron tasks) Wipe DB if developing a lot For Production, split Dev/UAT/Prod instances so that you can plan Data Migrations (Live migrations works in most cases, but some do need manual scripts still – not a complete ‘Get out of jail free’).
table.field.represent provides the representation in Display/List views Optimise the query – we know we only want a single record & a single field from that record
Because we don’t have the whitespace hints for Python, we need to end the if section with a ‘pass’ statement.
XSLT stored in static
Sometimes use Google Docs during periods of rapid collaborative editing
Join now – send a welcome mail, connect to IRC, create a Wiki account, push your Trunk branch to LaunchPad