Skip to content

Commit

Permalink
Merge branch 'master' of nursix:nursix/eden-asp
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Oct 27, 2021
2 parents 82d973e + 54b2e98 commit f312ff0
Show file tree
Hide file tree
Showing 296 changed files with 14,733 additions and 13,198 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/cache/*
/compiled/*
/databases/*
/docs/build/*
/errors/*
/indices/*
/models/000_config.py
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ Platform.
# Who is Eden ASP for?

Eden ASP is for application developers and service providers.

# What about documentation?

The developer handbook is included in the repository, or you can
read it on [ReadTheDocs](https://eden-asp.readthedocs.io).
72 changes: 28 additions & 44 deletions controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,11 @@ def role():
def prep(r):
if r.representation not in ("html", "aadata", "csv", "json"):
return False

# Configure REST methods
methods = ("read",
"list",
"create",
"update",
"delete",
"users",
"copy",
"datatable",
"datalist",
"import",
)
r.set_handler(methods, s3base.S3RoleManager)
r.custom_action = s3base.S3RoleManager
return True
s3.prep = prep

return s3_rest_controller("auth", "group")
return crud_controller("auth", "group")

# -----------------------------------------------------------------------------
def user():
Expand Down Expand Up @@ -186,19 +173,19 @@ def link_user(r, **args):

# Custom Methods
set_method = s3db.set_method
set_method("auth", "user",
set_method("auth_user",
method = "roles",
action = s3base.S3RoleManager)

set_method("auth", "user",
set_method("auth_user",
method = "disable",
action = disable_user)

set_method("auth", "user",
set_method("auth_user",
method = "approve",
action = approve_user)

set_method("auth", "user",
set_method("auth_user",
method = "link",
action = link_user)

Expand Down Expand Up @@ -460,12 +447,11 @@ def postp(r, output):

s3.import_prep = auth.s3_import_prep

output = s3_rest_controller("auth", "user",
csv_stylesheet = ("auth", "user.xsl"),
csv_template = ("auth", "user"),
rheader = rheader,
)
return output
return crud_controller("auth", "user",
csv_stylesheet = ("auth", "user.xsl"),
csv_template = ("auth", "user"),
rheader = rheader,
)

# =============================================================================
def group():
Expand Down Expand Up @@ -498,7 +484,7 @@ def group():
)

s3db.configure(tablename, main="role")
return s3_rest_controller("auth", "group")
return crud_controller("auth", "group")

# -----------------------------------------------------------------------------
@auth.s3_requires_membership(1)
Expand All @@ -525,7 +511,7 @@ def organisation():
msg_list_empty = T("No Organization Domains currently registered")
)

return s3_rest_controller("auth", "organisation")
return crud_controller("auth", "organisation")

# -----------------------------------------------------------------------------
def user_create_onvalidation (form):
Expand All @@ -550,7 +536,7 @@ def audit():
# Represent the user_id column
db.s3_audit.user_id.represent = s3db.auth_UserRepresent()

return s3_rest_controller("s3", "audit")
return crud_controller("s3", "audit")

# =============================================================================
# Consent Tracking
Expand All @@ -559,10 +545,10 @@ def audit():
def processing_type():
""" Types of Data Processing: RESTful CRUD Controller """

return s3_rest_controller("auth", "processing_type",
csv_template = ("auth", "processing_type"),
csv_stylesheet = ("auth", "processing_type.xsl"),
)
return crud_controller("auth", "processing_type",
csv_template = ("auth", "processing_type"),
csv_stylesheet = ("auth", "processing_type.xsl"),
)

# -----------------------------------------------------------------------------
@auth.s3_requires_membership(1)
Expand Down Expand Up @@ -630,10 +616,10 @@ def postp(r, output):
return output
s3.postp = postp

return s3_rest_controller("auth", "consent_option",
csv_template = ("auth", "consent_option"),
csv_stylesheet = ("auth", "consent_option.xsl"),
)
return crud_controller("auth", "consent_option",
csv_template = ("auth", "consent_option"),
csv_stylesheet = ("auth", "consent_option.xsl"),
)

# -----------------------------------------------------------------------------
@auth.s3_requires_membership(1)
Expand Down Expand Up @@ -734,8 +720,7 @@ def acl():
next = request.vars._next
s3db.configure(tablename, delete_next=next)

output = s3_rest_controller("s3", "permission")
return output
return crud_controller("s3", "permission")

# -----------------------------------------------------------------------------
def acl_represent(acl, options):
Expand Down Expand Up @@ -1319,8 +1304,7 @@ def postp(r, output):
return output
s3.postp = postp

output = s3_rest_controller("translate", "language")
return output
return crud_controller("translate", "language")

# =============================================================================
@auth.s3_requires_membership(1)
Expand Down Expand Up @@ -1352,9 +1336,9 @@ def prep(r):
return True
s3.prep = prep

return s3_rest_controller("scheduler", "task",
rheader = s3db.s3_scheduler_rheader,
)
return crud_controller("scheduler", "task",
rheader = s3db.s3_scheduler_rheader,
)

# =============================================================================
def result():
Expand Down Expand Up @@ -1424,6 +1408,6 @@ def dashboard():
Dashboard Configurations
"""

return s3_rest_controller("s3", "dashboard")
return crud_controller("s3", "dashboard")

# END =========================================================================
10 changes: 5 additions & 5 deletions controllers/assess.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def ifrc24h():
# Keep UX simple
settings.pr.lookup_duplicates = False

return s3_rest_controller("assess", "24h")
return crud_controller("assess", "24h")

# -----------------------------------------------------------------------------
def building_marker_fn(record):
Expand Down Expand Up @@ -105,19 +105,19 @@ def prep(r):
return True
s3.prep = prep

return s3_rest_controller(rheader = s3db.assess_building_rheader)
return crud_controller(rheader=s3db.assess_building_rheader)

# -----------------------------------------------------------------------------
def canvass():
""" RESTful CRUD controller """

return s3_rest_controller()
return crud_controller()

# -----------------------------------------------------------------------------
def need():
""" RESTful CRUD controller """

return s3_rest_controller()
return crud_controller()

# -----------------------------------------------------------------------------
def needs():
Expand Down Expand Up @@ -190,6 +190,6 @@ def needs():
crud_form = crud_form,
)

return s3_rest_controller()
return crud_controller()

# END =========================================================================
23 changes: 11 additions & 12 deletions controllers/assess2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,7 @@ def assess_rat_summary(r, **attr):
raise HTTP(405, ERROR.BAD_METHOD)


s3db.set_method("assess", "rat",
s3db.set_method("assess_rat",
method="summary",
action=assess_rat_summary)

Expand Down Expand Up @@ -1943,8 +1943,7 @@ def population():

""" RESTful controller """

output = s3_rest_controller()
return output
return crud_controller()

# =============================================================================
# Rapid Assessments
Expand Down Expand Up @@ -2074,8 +2073,8 @@ def postp(r, output):
rheader = lambda r: rat_rheader(r,
tabs)

output = s3_rest_controller(rheader=rheader,
s3ocr_config={"tabs": tabs})
output = curd_controller(rheader=rheader,
s3ocr_config={"tabs": tabs})

response.s3.stylesheets.append( "S3/rat.css" )
return output
Expand Down Expand Up @@ -2192,7 +2191,7 @@ def prep(r):

rheader = lambda r: assess_rheader(r, tabs)

return s3_rest_controller(rheader=rheader)
return crud_controller(rheader=rheader)

# -----------------------------------------------------------------------------
def impact_type():
Expand All @@ -2204,7 +2203,7 @@ def impact_type():
module = "impact"
resourcename = "type"

return s3_rest_controller(module, resourcename)
return crud_controller(module, resourcename)

# -----------------------------------------------------------------------------
def baseline_type():
Expand All @@ -2213,7 +2212,7 @@ def baseline_type():
# Load Models
assess_tables()

return s3_rest_controller()
return crud_controller()

# -----------------------------------------------------------------------------
def baseline():
Expand All @@ -2222,7 +2221,7 @@ def baseline():
# Load Models
assess_tables()

return s3_rest_controller()
return crud_controller()

# -----------------------------------------------------------------------------
def summary():
Expand All @@ -2231,7 +2230,7 @@ def summary():
# Load Models
assess_tables()

return s3_rest_controller()
return crud_controller()

# =============================================================================
def basic_assess():
Expand Down Expand Up @@ -2534,12 +2533,12 @@ def custom_assess(custom_assess_fields, location_id=None):
def type():
""" RESTful CRUD controller """

return s3_rest_controller("impact", "type")
return crud_controller("impact", "type")

# =============================================================================
def impact():
""" RESTful CRUD controller """

return s3_rest_controller("impact", "impact")
return crud_controller("impact", "impact")

# END =========================================================================
18 changes: 9 additions & 9 deletions controllers/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def asset():
def brand():
""" RESTful CRUD controller """

return s3_rest_controller("supply", "brand")
return crud_controller("supply", "brand")

# -----------------------------------------------------------------------------
def catalog():
""" RESTful CRUD controller """

return s3_rest_controller("supply", "catalog",
rheader = s3db.supply_catalog_rheader,
)
return crud_controller("supply", "catalog",
rheader = s3db.supply_catalog_rheader,
)

# -----------------------------------------------------------------------------
def item():
Expand Down Expand Up @@ -97,10 +97,10 @@ def catalog_item():
- used for Imports
"""

return s3_rest_controller("supply", "catalog_item",
csv_template = ("supply", "catalog_item"),
csv_stylesheet = ("supply", "catalog_item.xsl"),
)
return crud_controller("supply", "catalog_item",
csv_template = ("supply", "catalog_item"),
csv_stylesheet = ("supply", "catalog_item.xsl"),
)

# -----------------------------------------------------------------------------
def item_category():
Expand All @@ -116,7 +116,7 @@ def item_category():
field.readable = field.writable = False
field.default = True

return s3_rest_controller("supply", "item_category")
return crud_controller("supply", "item_category")

# -----------------------------------------------------------------------------
def supplier():
Expand Down
Loading

0 comments on commit f312ff0

Please sign in to comment.