From 1e7645a320f7e5a3162fd7ea8ac49e7341e7ccd3 Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Tue, 3 Jun 2014 13:04:23 +0530 Subject: [PATCH] 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. --- swtstore/classes/models/__init__.py | 3 +++ swtstore/classes/models/client.py | 3 ++- swtstore/classes/models/group.py | 3 ++- swtstore/classes/models/membership.py | 3 ++- swtstore/classes/models/sweet.py | 3 +-- swtstore/classes/models/user.py | 8 +++----- swtstore/classes/views/app.py | 3 +-- swtstore/classes/views/context.py | 3 +-- swtstore/classes/views/frontend.py | 3 +-- swtstore/classes/views/oauth.py | 3 +-- swtstore/classes/views/sweet.py | 4 +--- swtstore/classes/views/user.py | 4 ++-- 12 files changed, 20 insertions(+), 23 deletions(-) diff --git a/swtstore/classes/models/__init__.py b/swtstore/classes/models/__init__.py index 3b2288d..616b5c1 100644 --- a/swtstore/classes/models/__init__.py +++ b/swtstore/classes/models/__init__.py @@ -1,3 +1,6 @@ +from user import User +#from group import Group +#from membership import Membership from context import Context from sweet import Sweet from client import Client, AuthorizedClients diff --git a/swtstore/classes/models/client.py b/swtstore/classes/models/client.py index 9989adc..4753e38 100644 --- a/swtstore/classes/models/client.py +++ b/swtstore/classes/models/client.py @@ -6,9 +6,10 @@ from datetime import datetime, timedelta from flask import current_app from swtstore.classes.database import db -from swtstore.classes.models.um import User +from swtstore.classes.models import User from swtstore.classes import oauth + class Client(db.Model): """ The third-party application registering with the platform diff --git a/swtstore/classes/models/group.py b/swtstore/classes/models/group.py index f78a899..4231154 100644 --- a/swtstore/classes/models/group.py +++ b/swtstore/classes/models/group.py @@ -6,7 +6,8 @@ from datetime import datetime -from .config import db +from swtstore.classes.database import db + class Group(db.Model): """ diff --git a/swtstore/classes/models/membership.py b/swtstore/classes/models/membership.py index e62019a..cb9ed14 100644 --- a/swtstore/classes/models/membership.py +++ b/swtstore/classes/models/membership.py @@ -3,7 +3,8 @@ from datetime import datetime -from .config import db +from swtstore.classes.database import db + class Membership(db.Model): """ docstring """ diff --git a/swtstore/classes/models/sweet.py b/swtstore/classes/models/sweet.py index 58b251b..59538e1 100644 --- a/swtstore/classes/models/sweet.py +++ b/swtstore/classes/models/sweet.py @@ -9,8 +9,7 @@ from swtstore.classes.database import db # custom SQLAlchemy type JSONType from swtstore.classes.models.types import JSONType 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 class Sweet(db.Model): """ customary docstring """ diff --git a/swtstore/classes/models/user.py b/swtstore/classes/models/user.py index 891db7a..f57e450 100644 --- a/swtstore/classes/models/user.py +++ b/swtstore/classes/models/user.py @@ -3,11 +3,9 @@ from datetime import datetime from flask import session - -#from .config import db from flask import current_app -# TODO: remove dependency from config file -db = current_app.db + +from swtstore.classes.database import db class User(db.Model): @@ -30,7 +28,7 @@ class User(db.Model): self.username = kwargs.get('username') if kwargs.get('last_active'): current_app.logger.debug('Updated last_active timestamp %s for %s', - self, kwargs.get('last_active')) + kwargs.get('last_active'), self) self.last_active = kwargs.get('last_active') self.persist() diff --git a/swtstore/classes/views/app.py b/swtstore/classes/views/app.py index 5dc0243..0e149bc 100644 --- a/swtstore/classes/views/app.py +++ b/swtstore/classes/views/app.py @@ -7,8 +7,7 @@ from flask import Module, jsonify, request, render_template, redirect,\ from hashlib import md5 from werkzeug.security import gen_salt -from swtstore.classes.models import Client -from swtstore.classes.models.um import User +from swtstore.classes.models import Client, User from swtstore.classes.utils import urlnorm diff --git a/swtstore/classes/views/context.py b/swtstore/classes/views/context.py index b1fac5e..ea97d67 100644 --- a/swtstore/classes/views/context.py +++ b/swtstore/classes/views/context.py @@ -4,8 +4,7 @@ from flask import Module, jsonify, request, render_template, redirect,\ url_for, json, current_app -from swtstore.classes.models import Context -from swtstore.classes.models.um import User +from swtstore.classes.models import Context, User context = Module(__name__) diff --git a/swtstore/classes/views/frontend.py b/swtstore/classes/views/frontend.py index 6d8a025..9dcaacd 100644 --- a/swtstore/classes/views/frontend.py +++ b/swtstore/classes/views/frontend.py @@ -7,8 +7,7 @@ from flask import Module, jsonify, request, render_template, redirect,\ from sqlalchemy import desc -from swtstore.classes.models import Sweet -from swtstore.classes.models.um import User +from swtstore.classes.models import Sweet, User frontend = Module(__name__) diff --git a/swtstore/classes/views/oauth.py b/swtstore/classes/views/oauth.py index 091cef8..d9450f3 100644 --- a/swtstore/classes/views/oauth.py +++ b/swtstore/classes/views/oauth.py @@ -6,8 +6,7 @@ from flask import Module, jsonify, request, render_template, redirect,\ import requests 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 Oauth = Module(__name__) diff --git a/swtstore/classes/views/sweet.py b/swtstore/classes/views/sweet.py index 99fbc62..9e089a6 100644 --- a/swtstore/classes/views/sweet.py +++ b/swtstore/classes/views/sweet.py @@ -5,9 +5,7 @@ from flask import Module, jsonify, request, render_template, redirect,\ url_for, abort, json -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 sweet = Module(__name__) diff --git a/swtstore/classes/views/user.py b/swtstore/classes/views/user.py index 35f4089..81cb379 100644 --- a/swtstore/classes/views/user.py +++ b/swtstore/classes/views/user.py @@ -8,8 +8,8 @@ from flask import Module, jsonify, request, render_template, session,\ make_response, url_for, redirect, json, current_app # 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 from swtstore.classes.utils.httputils import makeCORSHeaders from swtstore.config import DefaultConfig -- 1.7.10.4