forked from sahana/eden
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwater.py
62 lines (49 loc) · 1.73 KB
/
water.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
"""
Water module
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index():
""" Module's Home Page """
return s3db.cms_index(module)
# -----------------------------------------------------------------------------
def flood_gauge():
""" Flood Gauges, RESTful controller """
# Pre-processor
def prep(r):
if r.interactive:
pass
elif r.representation == "plain" and \
r.method !="search":
# Map Popups
r.table.image_url.readable = False
return True
s3.prep = prep
# Post-processor
def postp(r, output):
if r.interactive:
pass
elif r.representation == "plain" and \
r.method !="search":
# Map Popups
# use the Image URL
# @ToDo: The default photo not the 1st
image_url = r.record.image_url
if image_url:
output["item"].append(IMG(_src=image_url,
# @ToDo: capture the size on upload & have controller resize where-required on-download
_width=400,
_height=310))
return output
s3.postp = postp
output = s3_rest_controller()
return output
# -----------------------------------------------------------------------------
def river():
""" Rivers, RESTful controller """
return s3_rest_controller()
# END =========================================================================