aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyaggr3g470r/emails.py4
-rw-r--r--pyaggr3g470r/export.py2
-rw-r--r--pyaggr3g470r/models.py8
-rw-r--r--pyaggr3g470r/rest.py2
-rw-r--r--pyaggr3g470r/search.py2
-rwxr-xr-xpyaggr3g470r/utils.py5
-rw-r--r--pyaggr3g470r/views.py18
7 files changed, 22 insertions, 19 deletions
diff --git a/pyaggr3g470r/emails.py b/pyaggr3g470r/emails.py
index 7d4d4c55..6ec4e74d 100644
--- a/pyaggr3g470r/emails.py
+++ b/pyaggr3g470r/emails.py
@@ -26,9 +26,9 @@ from email.mime.text import MIMEText
from postmark import PMMail
-import utils
+from pyaggr3g470r import utils
import conf
-from decorators import async
+from pyaggr3g470r.decorators import async
logger = logging.getLogger(__name__)
diff --git a/pyaggr3g470r/export.py b/pyaggr3g470r/export.py
index 1341e58f..4c768483 100644
--- a/pyaggr3g470r/export.py
+++ b/pyaggr3g470r/export.py
@@ -42,7 +42,7 @@ from datetime import datetime
from flask import jsonify
import conf
-import models
+from pyaggr3g470r import models
def HTML_HEADER(title="pyAggr3g470r", css="./style.css"):
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py
index 5139c1d4..3e3f76d4 100644
--- a/pyaggr3g470r/models.py
+++ b/pyaggr3g470r/models.py
@@ -28,7 +28,7 @@ __license__ = "GPLv3"
import re
import json
-import random, base64, hashlib
+import random, hashlib
from datetime import datetime
from sqlalchemy import asc, desc
from werkzeug import generate_password_hash, check_password_hash
@@ -45,8 +45,10 @@ class User(db.Model, UserMixin):
email = db.Column(db.String(254), index = True, unique = True)
pwdhash = db.Column(db.String())
roles = db.relationship('Role', backref = 'user', lazy = 'dynamic')
- activation_key = db.Column(db.String(86), default = base64.b64encode(hashlib.sha512( str(random.getrandbits(256)) ).digest(),
- random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])).rstrip('=='))
+ activation_key = db.Column(db.String(86), default =
+ hashlib.sha512(
+ str(random.getrandbits(256)).encode("utf-8")
+ ).hexdigest())
date_created = db.Column(db.DateTime(), default=datetime.now)
last_seen = db.Column(db.DateTime(), default=datetime.now)
feeds = db.relationship('Feed', backref = 'subscriber', lazy = 'dynamic', cascade='all,delete-orphan')
diff --git a/pyaggr3g470r/rest.py b/pyaggr3g470r/rest.py
index 8dcdf43f..a3c63c1d 100644
--- a/pyaggr3g470r/rest.py
+++ b/pyaggr3g470r/rest.py
@@ -34,7 +34,7 @@ from flask.ext.restful import Resource, reqparse
import conf
if not conf.ON_HEROKU:
- import search as fastsearch
+ import pyaggr3g470r.search as fastsearch
from pyaggr3g470r import api, db
from pyaggr3g470r.models import User, Article, Feed
diff --git a/pyaggr3g470r/search.py b/pyaggr3g470r/search.py
index a7832c00..0dc953b4 100644
--- a/pyaggr3g470r/search.py
+++ b/pyaggr3g470r/search.py
@@ -36,7 +36,7 @@ from whoosh.qparser import QueryParser
from whoosh.writing import AsyncWriter
from collections import defaultdict
-import utils
+from pyaggr3g470r import utils
indexdir = "./pyaggr3g470r/var/indexdir"
diff --git a/pyaggr3g470r/utils.py b/pyaggr3g470r/utils.py
index 0238e9e5..d0419362 100755
--- a/pyaggr3g470r/utils.py
+++ b/pyaggr3g470r/utils.py
@@ -43,7 +43,10 @@ import datetime
import operator
import urllib
import subprocess
-from urlparse import urlparse, parse_qs, urlunparse
+try:
+ from urlparse import urlparse, parse_qs, urlunparse
+except:
+ from urllib.parse import urlparse, parse_qs, urlunparse
from bs4 import BeautifulSoup
from collections import Counter
from contextlib import contextmanager
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 6e8b35d2..cf50dae3 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -42,16 +42,15 @@ from sqlalchemy.exc import IntegrityError
from werkzeug import generate_password_hash
import conf
-import utils
-import export
-import emails
-if not conf.ON_HEROKU:
- import search as fastsearch
-from forms import SignupForm, SigninForm, AddFeedForm, \
- ProfileForm, InformationMessageForm, RecoverPasswordForm
+from pyaggr3g470r import utils, emails, export
from pyaggr3g470r import app, db, allowed_file, babel
from pyaggr3g470r.models import User, Feed, Article, Role
from pyaggr3g470r.decorators import feed_access_required
+from pyaggr3g470r.forms import SignupForm, SigninForm, AddFeedForm, \
+ ProfileForm, InformationMessageForm, RecoverPasswordForm
+if not conf.ON_HEROKU:
+ import pyaggr3g470r.search as fastsearch
+
Principal(app)
# Create a permission with a single Need, in this case a RoleNeed.
@@ -914,9 +913,8 @@ def disable_user(user_id=None):
flash(gettext('Problem while sending activation email') + ': ' + str(e), 'danger')
else:
- import random, base64, hashlib
- user.activation_key = base64.b64encode(hashlib.sha512( str(random.getrandbits(256)) ).digest(),
- random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])).rstrip('==')
+ import random, hashlib
+ user.activation_key = hashlib.sha512(str(random.getrandbits(256)).encode("utf-8")).hexdigest()
flash(gettext('Account of the user') + ' ' + user.nickname + ' ' + gettext('successfully disabled.'), 'success')
db.session.commit()
else:
bgstack15