Skip to content

Commit

Permalink
Release RLPPTM-1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Feb 10, 2021
1 parent f753e39 commit 5aa6623
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
RLPPTM-1.2.0 (2021-02-02 20:02:00)
RLPPTM-1.2.1 (2021-02-10 09:02:59)
62 changes: 62 additions & 0 deletions modules/templates/RLPPTM/upgrade/1.2.0-1.2.1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
#
# Database upgrade script
#
# RLPPTM Template Version 1.2.0 => 1.2.1
#
# Execute in web2py folder after code upgrade like:
# python web2py.py -S eden -M -R applications/eden/modules/templates/RLPPTM/upgrade/1.2.0-1.2.1.py
#
#import datetime
import sys
#from s3 import S3DateTime

#from gluon.storage import Storage
#from gluon.tools import callback

# Override auth (disables all permission checks)
auth.override = True

# Failed-flag
failed = False

# Info
def info(msg):
sys.stderr.write("%s" % msg)
def infoln(msg):
sys.stderr.write("%s\n" % msg)

# Load models for tables
#ptable = s3db.project_project

IMPORT_XSLT_FOLDER = os.path.join(request.folder, "static", "formats", "s3csv")
TEMPLATE_FOLDER = os.path.join(request.folder, "modules", "templates", "RLPPTM")

# -----------------------------------------------------------------------------
# Upgrade user roles
#
if not failed:
info("Upgrade user roles")

bi = s3base.S3BulkImporter()
filename = os.path.join(TEMPLATE_FOLDER, "auth_roles.csv")

with open(filename, "r") as File:
try:
bi.import_role(filename)
except Exception as e:
infoln("...failed")
infoln(sys.exc_info()[1])
failed = True
else:
infoln("...done")

# -----------------------------------------------------------------------------
# Finishing up
#
if failed:
db.rollback()
infoln("UPGRADE FAILED - Action rolled back.")
else:
db.commit()
infoln("UPGRADE SUCCESSFUL.")

0 comments on commit 5aa6623

Please sign in to comment.