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.
| |   |
from user import User |
#from group import Group |
#from membership import Membership |
1 | 4 | from context import Context |
2 | 5 | from sweet import Sweet |
3 | 6 | from client import Client, AuthorizedClients |
| |   |
6 | 6 | from flask import current_app |
7 | 7 | |
8 | 8 | from swtstore.classes.database import db |
from swtstore.classes.models.um import User |
from swtstore.classes.models import User |
10 | 10 | from swtstore.classes import oauth |
|
11 | 12 | |
12 | 13 | class Client(db.Model): |
13 | 14 | """ |
| |   |
6 | 6 | |
7 | 7 | from datetime import datetime |
8 | 8 | |
from .config import db |
from swtstore.classes.database import db |
|
10 | 11 | |
11 | 12 | class Group(db.Model): |
12 | 13 | """ |
| |   |
3 | 3 | |
4 | 4 | from datetime import datetime |
5 | 5 | |
from .config import db |
from swtstore.classes.database import db |
|
7 | 8 | |
8 | 9 | class Membership(db.Model): |
9 | 10 | """ docstring """ |
| |   |
9 | 9 | # custom SQLAlchemy type JSONType |
10 | 10 | from swtstore.classes.models.types import JSONType |
11 | 11 | from swtstore.classes.utils import urlnorm # normalize URLs |
from swtstore.classes.models import Context |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Context, User |
14 | 13 | |
15 | 14 | class Sweet(db.Model): |
16 | 15 | """ customary docstring """ |
| |   |
3 | 3 | |
4 | 4 | from datetime import datetime |
5 | 5 | from flask import session |
|
#from .config import db |
8 | 6 | from flask import current_app |
# TODO: remove dependency from config file |
db = current_app.db |
11 | 7 | |
from swtstore.classes.database import db |
12 | 9 | |
|
13 | 11 | class User(db.Model): |
14 | 12 | """ docstring """ |
15 | 13 | |
… | … | |
28 | 28 | self.username = kwargs.get('username') |
29 | 29 | if kwargs.get('last_active'): |
30 | 30 | current_app.logger.debug('Updated last_active timestamp %s for %s', |
self, kwargs.get('last_active')) |
kwargs.get('last_active'), self) |
32 | 32 | self.last_active = kwargs.get('last_active') |
33 | 33 | |
34 | 34 | self.persist() |
| |   |
7 | 7 | from hashlib import md5 |
8 | 8 | from werkzeug.security import gen_salt |
9 | 9 | |
from swtstore.classes.models import Client |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Client, User |
12 | 11 | from swtstore.classes.utils import urlnorm |
13 | 12 | |
14 | 13 | |
| |   |
4 | 4 | from flask import Module, jsonify, request, render_template, redirect,\ |
5 | 5 | url_for, json, current_app |
6 | 6 | |
from swtstore.classes.models import Context |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Context, User |
9 | 8 | |
10 | 9 | |
11 | 10 | context = Module(__name__) |
| |   |
7 | 7 | |
8 | 8 | from sqlalchemy import desc |
9 | 9 | |
from swtstore.classes.models import Sweet |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Sweet, User |
12 | 11 | |
13 | 12 | |
14 | 13 | frontend = Module(__name__) |
| |   |
6 | 6 | import requests |
7 | 7 | |
8 | 8 | from swtstore.classes import oauth |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Client, AuthorizedClients |
from swtstore.classes.models import Client, AuthorizedClients, User |
11 | 10 | |
12 | 11 | |
13 | 12 | Oauth = Module(__name__) |
| |   |
5 | 5 | from flask import Module, jsonify, request, render_template, redirect,\ |
6 | 6 | url_for, abort, json |
7 | 7 | |
from swtstore.classes.models import Context |
from swtstore.classes.models import Sweet |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Context, Sweet, User |
11 | 9 | |
12 | 10 | |
13 | 11 | sweet = Module(__name__) |
| |   |
8 | 8 | make_response, url_for, redirect, json, current_app |
9 | 9 | |
10 | 10 | # swtstore imports |
from swtstore.classes.models.um import User |
from swtstore.classes.models import Sweet, Context, Client, AuthorizedClients |
from swtstore.classes.models import User, Sweet, Context, Client,\ |
AuthorizedClients |
13 | 13 | |
14 | 14 | from swtstore.classes.utils.httputils import makeCORSHeaders |
15 | 15 | from swtstore.config import DefaultConfig |