LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ ## if SSL/HTTPS is properly configured and you want all HTTP requests to ## be redirected to HTTPS, uncomment the line below: # request.requires_https() ## app configuration made easy. Look inside private/appconfig.ini from gluon.contrib.appconfig import AppConfig from gluon.tools import Mail import json as json_for_views ## once in production, remove reload=True to gain full speed myconf = AppConfig(reload=True) if not request.env.web2py_runtime_gae: ## if NOT running on Google App Engine use SQLite or other DB mysql_connection = 'mysql://' + current.mysql_user + \ ':' + current.mysql_password + \ '@' + current.mysql_server db = DAL(mysql_connection + '/' + current.mysql_dbname, table_hash="stopstalkdb") uvadb = DAL(mysql_connection + '/' + current.mysql_uvadbname, table_hash="uvajudge") # db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all']) else: ## connect to Google BigTable (optional 'google:datastore://namespace')
# File is released under public domain and you can use without limitations # ------------------------------------------------------------------------- if request.global_settings.web2py_version < "2.15.5": raise HTTP(500, "Requires web2py 2.15.5 or newer") # ------------------------------------------------------------------------- # if SSL/HTTPS is properly configured and you want all HTTP requests to # be redirected to HTTPS, uncomment the line below: # ------------------------------------------------------------------------- # request.requires_https() # ------------------------------------------------------------------------- # once in production, remove reload=True to gain full speed # ------------------------------------------------------------------------- configuration = AppConfig(reload=True) if not request.env.web2py_runtime_gae: # --------------------------------------------------------------------- # if NOT running on Google App Engine use SQLite or other DB # --------------------------------------------------------------------- db_mode = "development" if db_mode == "development": db = DAL(configuration.get('db.uri'), pool_size=configuration.get('db.pool_size'), migrate_enabled=configuration.get('db.migrate'), check_reserved=['all']) elif db_mode == "production": db = DAL('mysql://*****:*****@remotemysql.com:3306/aHkaDWOaQ1?set_encoding=utf8mb4') else:
# Chris - [email protected] # -*- coding: utf-8 -*- db = DAL( 'sqlite://waf2py.sqlite', folder='/home/www-data/waf2py_community/applications/Waf2Py/databases') db2 = DAL( 'sqlite://waf_logs.sqlite', folder='/home/www-data/waf2py_community/applications/Waf2Py/databases') # ------------------------------------------------------------------------- # app configuration made easy. Look inside private/appconfig.ini # ------------------------------------------------------------------------- from gluon.contrib.appconfig import AppConfig myconf = AppConfig(reload=False) # choose a style for forms # ------------------------------------------------------------------------- response.formstyle = myconf.get( 'forms.formstyle') # or 'bootstrap3_stacked' or 'bootstrap2' or other #response.formstyle = 'bootstrap3_stacked' response.form_label_separator = myconf.get('forms.separator') or '' db.define_table( 'examples', Field('conf_name', 'string', length=30, requires=IS_NOT_EMPTY()), Field('data_conf', 'text', requires=IS_NOT_EMPTY()), Field('description', 'text', requires=IS_NOT_EMPTY()), Field('autor', 'string', length=15, requires=IS_NOT_EMPTY()), )
def loadAppConfig(self): myconf = AppConfig(reload=False) self.credentials['clientid'] = myconf.take('app.clientid') self.credentials['clientsecret'] = myconf.take('app.clientsecret')
# File is released under public domain and you can use without limitations # ------------------------------------------------------------------------- if request.global_settings.web2py_version < "2.15.5": raise HTTP(500, "Requires web2py 2.15.5 or newer") # ------------------------------------------------------------------------- # if SSL/HTTPS is properly configured and you want all HTTP requests to # be redirected to HTTPS, uncomment the line below: # ------------------------------------------------------------------------- # request.requires_https() # ------------------------------------------------------------------------- # once in production, remove reload=True to gain full speed # ------------------------------------------------------------------------- configuration = AppConfig() if not request.env.web2py_runtime_gae: # --------------------------------------------------------------------- # if NOT running on Google App Engine use SQLite or other DB # --------------------------------------------------------------------- db = DAL(configuration.get('db.uri'), pool_size=configuration.get('db.pool_size'), migrate_enabled=configuration.get('db.migrate'), check_reserved=['all']) else: # --------------------------------------------------------------------- # connect to Google BigTable (optional 'google:datastore://namespace') # --------------------------------------------------------------------- db = DAL('google:datastore+ndb') # ---------------------------------------------------------------------
# File is released under public domain and you can use without limitations # ------------------------------------------------------------------------- if request.global_settings.web2py_version < "2.15.5": raise HTTP(500, "Requires web2py 2.15.5 or newer") # ------------------------------------------------------------------------- # if SSL/HTTPS is properly configured and you want all HTTP requests to # be redirected to HTTPS, uncomment the line below: # ------------------------------------------------------------------------- # request.requires_https() # ------------------------------------------------------------------------- # once in production, remove reload=True to gain full speed # ------------------------------------------------------------------------- configuration = AppConfig(reload=False) if not request.env.web2py_runtime_gae: # --------------------------------------------------------------------- # if NOT running on Google App Engine use SQLite or other DB # --------------------------------------------------------------------- db = DAL(configuration.get('db.uri'), pool_size=configuration.get('db.pool_size'), migrate_enabled=configuration.get('db.migrate'), check_reserved=['all']) else: # --------------------------------------------------------------------- # connect to Google BigTable (optional 'google:datastore://namespace') # --------------------------------------------------------------------- db = DAL('google:datastore+ndb') # ---------------------------------------------------------------------
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations # ------------------------------------------------------------------------- # This is a sample controller # - index is the default action of any application # - user is required for authentication and authorization # - download is for downloading files uploaded in the db (does streaming) # ------------------------------------------------------------------------- from gluon.serializers import json from gluon.tools import Service import gluon.contrib.simplejson import os from gluon.contrib.appconfig import AppConfig myconfig = AppConfig('app/private/appconfig.ini', reload=False) service = Service() """ Default method which fetches initial data and renders the index view """ # function to load landing page def index(): return locals() """ Default method which fetches initial data and renders the index view
# -*- coding: utf-8 -*- ######################################################################### ## This scaffolding model makes your app work on Google App Engine too ## File is released under public domain and you can use without limitations ######################################################################### ## if SSL/HTTPS is properly configured and you want all HTTP requests to ## be redirected to HTTPS, uncomment the line below: # request.requires_https() ## CONFIGURATION ************ app configuration made easy. Look inside private/appconfig.ini from gluon.contrib.appconfig import AppConfig myconf = AppConfig( reload=True) ## once in production, remove reload=True to gain full speed if not request.env.web2py_runtime_gae: ## if NOT running on Google App Engine use SQLite or other DB db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all']) else: ## connect to Google BigTable (optional 'google:datastore://namespace') db = DAL('google:datastore+ndb') ## store sessions and tickets there session.connect(request, response, db=db) ## or store session in Memcache, Redis, etc. ## from gluon.contrib.memdb import MEMDB ## from google.appengine.api.memcache import Client ## session.connect(request, response, db = MEMDB(Client()))
# IAPT Spring Assessment - Group 13 from gluon.contrib.appconfig import AppConfig import re import os APP_NAME = 'Shortboxes' myconf = AppConfig(reload=True) # see private/appconfig.ini for settings # Set up the database db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all']) # Set the response style for forms response.formstyle = myconf.take('forms.formstyle') response.form_label_separator = myconf.take('forms.separator') uploadfolder = os.path.join(request.folder, 'uploads') # Define a custom validator for currency values class IS_CURRENCY_VALUE(object): def __call__(self, value): error_str = 'Enter a currency value, e.g. "2.50"' if value is None or type(value) != str: return None, error_str regex = re.compile(r"^([0-9]+)(\.[0-9]{1,2})?$") match = regex.match(value)
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # Author Daniel J. Ramirez <*****@*****.**> from gluon import current from gluon import URL from gluon.contrib.appconfig import AppConfig ## once in production, remove reload=True to gain full speed CONF = AppConfig() # constants definitions FLOW_BASIC = 0 # seller and manager # one person list the items, other checkouts and other delivers FLOW_MULTIROLE = 1 # reduce the common employee permissions to the mimimum FLOW_IRON_FIST = 2 class AccessCard: data = {} def __init__(self, data):
from gluon.contrib.appconfig import AppConfig myconf = AppConfig(reload=True) # private/appconfig.ini def isDeployed(): return myconf.take('env.debug', cast=int) != 1 def isDebug(): if isDeployed(): return False return True def gameStartsAt(): return datetime.utcnow() + timedelta(days=1) def gameEndsAt(): return datetime.utcnow() + timedelta(days=2) def GithubAPI(): # https://developer.github.com/v3/oauth/ return dict(client_id='<github-client-id>', client_secret='<github-client-secret>')
raise HTTP(500, "Requires web2py 2.13.3 or newer") # ------------------------------------------------------------------------- # if SSL/HTTPS is properly configured and you want all HTTP requests to # be redirected to HTTPS, uncomment the line below: # ------------------------------------------------------------------------- # request.requires_https() # ------------------------------------------------------------------------- # app configuration made easy. Look inside private/appconfig.ini # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # once in production, remove reload=True to gain full speed # ------------------------------------------------------------------------- MYCONF = AppConfig(reload=True) if not request.env.web2py_runtime_gae: # --------------------------------------------------------------------- # if NOT running on Google App Engine use SQLite or other DB # --------------------------------------------------------------------- DB = DAL( SETTINGS.db_url_login, pool_size=MYCONF.get('DB.pool_size'), # migrate_enabled=False, migrate=SETTINGS.migrate, lazy_tables=True, fake_migrate_all=SETTINGS.fake_migrate_all, check_reserved=['postgres', 'sqlite']) # DB = DAL(MYCONF.get('DB.uri'),
import random import pytz from openstudio.os_gui import OsGui from general_helpers import represent_validity_units from general_helpers import represent_subscription_units ### Config #### # ------------------------------------------------------------------------- # app configuration made easy. Look inside private/appconfig.ini # ------------------------------------------------------------------------- from gluon.contrib.appconfig import AppConfig # ------------------------------------------------------------------------- # once in production, remove reload=True to gain full speed # ------------------------------------------------------------------------- myconf = AppConfig() ### Caching ### if myconf.get('cache.cache') == 'redis': from gluon.contrib.redis_utils import RConn from gluon.contrib.redis_cache import RedisCache redis_host = str(myconf.get('cache.redis_host')) redis_port = str(myconf.get('cache.redis_port')) rconn = RConn(redis_host, redis_port) cache.redis = RedisCache(redis_conn=rconn, debug=True, with_lock=True) # use redis as cache cache.ram = cache.disk = cache.redis #### Custom validators begin #####
# -*- coding: utf-8 -*- if request.global_settings.web2py_version < "2.15.5": raise HTTP(500, "Requires web2py 2.15.5 or newer") ## Imports from gluon.contrib.appconfig import AppConfig from gluon.tools import Auth # ------------------------------------------------------------------------- # if SSL/HTTPS is properly configured and you want all HTTP requests to # be redirected to HTTPS, uncomment the line below: # ------------------------------------------------------------------------- # request.requires_https() config = AppConfig(reload=False) if not request.env.web2py_runtime_gae: # --------------------------------------------------------------------- # if NOT running on Google App Engine use SQLite or other DB # --------------------------------------------------------------------- db = DAL(config.get('db.uri'), pool_size=config.get('db.pool_size'), migrate_enabled=config.get('db.migrate'), check_reserved=['all']) else: # --------------------------------------------------------------------- # connect to Google BigTable (optional 'google:datastore://namespace') # --------------------------------------------------------------------- db = DAL('google:datastore+ndb') # ---------------------------------------------------------------------
import logging from gluon.contrib.appconfig import AppConfig from gluon.storage import Storage from tbox_interface import TBoxInterface from abox_interface import ABoxInterface # Doesn't work well anyway even for dev/testing # from gluon.custom_import import track_changes # track_changes(True) SETTINGS = Storage() MYCONF = AppConfig(reload=False) # read values from private/config.ini SETTINGS.app_view_name = MYCONF.take('app.view_name', cast=str) SETTINGS.app_name = MYCONF.take('app.app_name', cast=str) SETTINGS.maintainer_eml = MYCONF.take('app.maintainer_eml', cast=str) SETTINGS.base_url = MYCONF.take('app.base_url', cast=str) SETTINGS.document_endpoint = MYCONF.take('app.document_endpoint', cast=str) SETTINGS.id_gen_endpoint = MYCONF.take('app.id_gen_endpoint', cast=str) SETTINGS.inheritance_query_endpoint = MYCONF.take( 'app.inheritance_query_endpoint', cast=str) SETTINGS.create_activity_endpoint = MYCONF.take('app.create_activity_endpoint', cast=str) SETTINGS.db_url_login = MYCONF.take('auth_db.db_url_login', cast=str) SETTINGS.migrate = MYCONF.take('auth_db.migrate', cast=bool) SETTINGS.fake_migrate_all = MYCONF.take('auth_db.fake_migrate_all', cast=bool) SETTINGS.admn_grp = MYCONF.take('auth_db.admn_grp', cast=str)
# -*- coding: utf-8 -*- from gluon.contrib.appconfig import AppConfig from gluon.storage import Storage from gluon.tools import Auth if request.global_settings.web2py_version < "2.15.5": raise HTTP(500, "Requires web2py 2.15.5 or newer") appconfig = AppConfig(reload=True) if request.env.web2py_runtime_gae: # --------------------------------------------------------------------- # connect to Google BigTable (optional 'google:datastore://namespace') # --------------------------------------------------------------------- db = DAL('google:datastore+ndb', lazy_tables=True) # --------------------------------------------------------------------- # store sessions and tickets in Memcache # --------------------------------------------------------------------- from gluon.contrib.gae_memcache import MemcacheClient from gluon.contrib.memdb import MEMDB cache.memcache = MemcacheClient(request) cache.ram = cache.disk = cache.memcache session.connect(request, response, db=MEMDB(cache.memcache.client)) else: # --------------------------------------------------------------------- # if NOT running on Google App Engine use SQLite or other DB # --------------------------------------------------------------------- db = DAL(appconfig.get('db.uri'),