Commit 1e7645a320f7e5a3162fd7ea8ac49e7341e7ccd3

Update code after removing submodule

  Updated the code to work w/o user management submodule.
This removes cloning the sub-module separately and configuring it.
  • Diff rendering mode:
  • inline
  • side by side

swtstore/classes/models/__init__.py

1from user import User
2#from group import Group
3#from membership import Membership
1from context import Context4from context import Context
2from sweet import Sweet5from sweet import Sweet
3from client import Client, AuthorizedClients6from client import Client, AuthorizedClients

swtstore/classes/models/client.py

6from flask import current_app6from flask import current_app
77
8from swtstore.classes.database import db8from swtstore.classes.database import db
9from swtstore.classes.models.um import User
9from swtstore.classes.models import User
10from swtstore.classes import oauth10from swtstore.classes import oauth
11
1112
12class Client(db.Model):13class Client(db.Model):
13 """14 """

swtstore/classes/models/group.py

66
7from datetime import datetime7from datetime import datetime
88
9from .config import db
9from swtstore.classes.database import db
10
1011
11class Group(db.Model):12class Group(db.Model):
12 """13 """

swtstore/classes/models/membership.py

33
4from datetime import datetime4from datetime import datetime
55
6from .config import db
6from swtstore.classes.database import db
7
78
8class Membership(db.Model):9class Membership(db.Model):
9 """ docstring """10 """ docstring """

swtstore/classes/models/sweet.py

9# custom SQLAlchemy type JSONType9# custom SQLAlchemy type JSONType
10from swtstore.classes.models.types import JSONType10from swtstore.classes.models.types import JSONType
11from swtstore.classes.utils import urlnorm # normalize URLs11from swtstore.classes.utils import urlnorm # normalize URLs
12from swtstore.classes.models import Context
13from swtstore.classes.models.um import User
12from swtstore.classes.models import Context, User
1413
15class Sweet(db.Model):14class Sweet(db.Model):
16 """ customary docstring """15 """ customary docstring """

swtstore/classes/models/user.py

33
4from datetime import datetime4from datetime import datetime
5from flask import session5from flask import session
6
7#from .config import db
8from flask import current_app6from flask import current_app
9# TODO: remove dependency from config file
10db = current_app.db
117
8from swtstore.classes.database import db
129
10
13class User(db.Model):11class User(db.Model):
14 """ docstring """12 """ docstring """
1513
28 self.username = kwargs.get('username')28 self.username = kwargs.get('username')
29 if kwargs.get('last_active'):29 if kwargs.get('last_active'):
30 current_app.logger.debug('Updated last_active timestamp %s for %s',30 current_app.logger.debug('Updated last_active timestamp %s for %s',
31 self, kwargs.get('last_active'))
31 kwargs.get('last_active'), self)
32 self.last_active = kwargs.get('last_active')32 self.last_active = kwargs.get('last_active')
3333
34 self.persist()34 self.persist()

swtstore/classes/views/app.py

7from hashlib import md57from hashlib import md5
8from werkzeug.security import gen_salt8from werkzeug.security import gen_salt
99
10from swtstore.classes.models import Client
11from swtstore.classes.models.um import User
10from swtstore.classes.models import Client, User
12from swtstore.classes.utils import urlnorm11from swtstore.classes.utils import urlnorm
1312
1413

swtstore/classes/views/context.py

4from flask import Module, jsonify, request, render_template, redirect,\4from flask import Module, jsonify, request, render_template, redirect,\
5 url_for, json, current_app5 url_for, json, current_app
66
7from swtstore.classes.models import Context
8from swtstore.classes.models.um import User
7from swtstore.classes.models import Context, User
98
109
11context = Module(__name__)10context = Module(__name__)

swtstore/classes/views/frontend.py

77
8from sqlalchemy import desc8from sqlalchemy import desc
99
10from swtstore.classes.models import Sweet
11from swtstore.classes.models.um import User
10from swtstore.classes.models import Sweet, User
1211
1312
14frontend = Module(__name__)13frontend = Module(__name__)

swtstore/classes/views/oauth.py

6import requests6import requests
77
8from swtstore.classes import oauth8from swtstore.classes import oauth
9from swtstore.classes.models.um import User
10from swtstore.classes.models import Client, AuthorizedClients
9from swtstore.classes.models import Client, AuthorizedClients, User
1110
1211
13Oauth = Module(__name__)12Oauth = Module(__name__)

swtstore/classes/views/sweet.py

5from flask import Module, jsonify, request, render_template, redirect,\5from flask import Module, jsonify, request, render_template, redirect,\
6 url_for, abort, json6 url_for, abort, json
77
8from swtstore.classes.models import Context
9from swtstore.classes.models import Sweet
10from swtstore.classes.models.um import User
8from swtstore.classes.models import Context, Sweet, User
119
1210
13sweet = Module(__name__)11sweet = Module(__name__)

swtstore/classes/views/user.py

8 make_response, url_for, redirect, json, current_app8 make_response, url_for, redirect, json, current_app
99
10# swtstore imports10# swtstore imports
11from swtstore.classes.models.um import User
12from swtstore.classes.models import Sweet, Context, Client, AuthorizedClients
11from swtstore.classes.models import User, Sweet, Context, Client,\
12 AuthorizedClients
1313
14from swtstore.classes.utils.httputils import makeCORSHeaders14from swtstore.classes.utils.httputils import makeCORSHeaders
15from swtstore.config import DefaultConfig15from swtstore.config import DefaultConfig