-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make gengine pluggable into other pyramid projects
- Loading branch information
Marcel
committed
Apr 1, 2015
1 parent
895661b
commit a181814
Showing
10 changed files
with
164 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
jQuery().ready(function($) { | ||
var defaultcall = "progress"; | ||
|
||
var fields=["userid","variable","value","key","achievementid","level", | ||
"lat","lon","friends","groups","timezone","country","region","city"]; | ||
|
||
var api_funcs = { | ||
"progress" : { | ||
"fields":["userid"], | ||
"url":"/progress/{userid}", | ||
"method":"GET" | ||
}, | ||
"increase_value" : { | ||
"fields":["variable","userid","value","key"], | ||
"url":"/increase_value/{variable}/{userid}{/key}", | ||
"method":"POST", | ||
"postparams":["value"] | ||
}, | ||
"add_or_update_user" : { | ||
"fields":["userid","lat","lon","friends","groups","timezone","country","region","city"], | ||
"url":"/add_or_update_user/{userid}", | ||
"method":"POST", | ||
"postparams":["lat","lon","friends","groups","timezone","country","region","city"] | ||
}, | ||
"delete_user" : { | ||
"fields":["userid"], | ||
"url":"/delete_user/{userid}", | ||
"method":"DELETE" | ||
}, | ||
"achievement_level" : { | ||
"fields":["achievementid","level"], | ||
"url":"/achievement/{achievementid}/level/{level}", | ||
"method":"GET" | ||
} | ||
}; | ||
|
||
setupAPIForm($,defaultcall,fields,api_funcs); | ||
|
||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from sqlalchemy.orm.session import Session, sessionmaker | ||
import transaction | ||
from sqlalchemy.orm.scoping import scoped_session | ||
from zope.sqlalchemy.datamanager import ZopeTransactionExtension | ||
from sqlalchemy.ext.declarative.api import declarative_base | ||
|
||
class MySession(Session): | ||
"""This allow us to use the flask-admin sqla extension, which uses DBSession.commit() rather than transaction.commit()""" | ||
def commit(self,*args,**kw): | ||
transaction.commit(*args,**kw) | ||
|
||
def rollback(self,*args,**kw): | ||
transaction.abort(*args,**kw) | ||
|
||
DBSession=None | ||
|
||
def init_session(override_session=None): | ||
global DBSession | ||
if override_session: | ||
DBSession = override_session | ||
else: | ||
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension(), class_=MySession)) | ||
|
||
Base=None | ||
|
||
def init_declarative_base(override_base=None): | ||
global Base | ||
if override_base: | ||
Base=override_base | ||
else: | ||
Base = declarative_base() | ||
|
||
def init_db(engine): | ||
DBSession.configure(bind=engine) | ||
Base.metadata.bind = engine | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters