Skip to content

Commit

Permalink
Merge branch 'master' into bs4
Browse files Browse the repository at this point in the history
* master: (40 commits)
  Pre-release version 5.9.5
  Update requirements (#721)
  Version 5.9.4
  New path for stubs.py (#719)
  chore(package): update yargs-parser to version 8.0.0 (#718)
  chore(package): update uglify-js to version 3.1.3 (#717)
  chore(package): update bower to version 1.8.2
  chore(package): update uglify-js to version 3.1.2
  chore(package): update uglify-js to version 3.1.1
  chore(package): update uglify-js to version 3.1.0 (#711)
  Fix and close #709 (#710)
  Fix linter warnings (#708)
  chore(package): update gulp-sourcemaps to version 2.6.1 (#706)
  chore(package): update uglify-js to version 3.0.28 (#707)
  Revert "Add "Alternative Token" handling for flask-login (see #699)" (#705)
  chore(package): update browser-sync to version 2.18.13 (#700)
  chore(package): update uglify-js to version 3.0.25 (#697)
  Add "Alternative Token" handling for flask-login (see #699) (#701)
  chore(package): update coffee-script to version 1.12.7 (#698)
  chore(package): update uglify-js to version 3.0.24 (#696)
  ...
  • Loading branch information
lipis committed Oct 9, 2017
2 parents c7f2586 + f5c7627 commit fdc85d0
Show file tree
Hide file tree
Showing 23 changed files with 122 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "gae-init",
"dependencies": {
"bootstrap": "v4-dev",
"font-awesome": "4.7.0",
"jquery": "3.2.1",
"moment": "2.18.1"
},
"name": "gae-init",
"overrides": {
"bootstrap": {
"main": ["scss/**", "dist/js/**"]
Expand Down
2 changes: 1 addition & 1 deletion main/api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def make_response(data, marshal_table, cursors=None):
'status': 'success',
'count': len(data),
'now': datetime.utcnow().isoformat(),
'result': map(lambda l: flask_restful.marshal(l, marshal_table), data),
'result': [flask_restful.marshal(d, marshal_table) for d in data],
}
if cursors:
if isinstance(cursors, dict):
Expand Down
12 changes: 8 additions & 4 deletions main/appengine_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
import os
import sys

from path_util import sys_path_insert


if os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Engine'):
sys.path.insert(0, 'lib.zip')
sys_path_insert('lib.zip')
else:
if os.name == 'nt':
os.name = None
sys.platform = ''

import re
from google.appengine.tools.devappserver2.python import stubs
from google.appengine.tools.devappserver2.python.runtime import stubs

re_ = stubs.FakeFile._skip_files.pattern.replace('|^lib/.*', '')
re_ = re.compile(re_)
stubs.FakeFile._skip_files = re_
sys.path.insert(0, 'lib')
sys.path.insert(0, 'libx')
sys_path_insert('lib')

sys_path_insert('libx')


def webapp_add_wsgi_middleware(app):
Expand Down
3 changes: 2 additions & 1 deletion main/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def current_user_id():


def current_user_key():
return flask_login.current_user.user_db.key if flask_login.current_user.user_db else None
return flask_login.current_user.user_db.key \
if flask_login.current_user.user_db else None


def current_user_db():
Expand Down
2 changes: 2 additions & 0 deletions main/auth/azure_ad.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask
import jwt

Expand Down
2 changes: 2 additions & 0 deletions main/auth/bitbucket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/dropbox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/facebook.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/github.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/google.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/instagram.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/linkedin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/mailru.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import hashlib

import flask
Expand Down
2 changes: 2 additions & 0 deletions main/auth/microsoft.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/reddit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import base64

from flask_oauthlib import client
Expand Down
2 changes: 2 additions & 0 deletions main/auth/twitter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/vk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
2 changes: 2 additions & 0 deletions main/auth/yahoo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding: utf-8

from __future__ import absolute_import

import flask

import auth
Expand Down
56 changes: 56 additions & 0 deletions main/path_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# coding: utf-8

import os
import pkgutil
import sys


def path_package_path(deps_path, shadow_pkgs):
sys.path.insert(0, deps_path)
for _, pkg, ispkg in pkgutil.iter_modules():
if ispkg and pkg in shadow_pkgs:
global_pkg = __import__(pkg)
global_pkg.__path__.insert(0, '%s/%s' % (deps_path, pkg))


def is_shadowing(package_name):
try:
__import__(os.path.splitext(package_name)[0])
return True
except ImportError:
pass
return False


def get_shadows_zip(filename):
import zipfile

shadow_pkgs = set()
with zipfile.ZipFile(filename) as lib_zip:
already_test = []
for fname in lib_zip.namelist():
pname, fname = os.path.split(fname)
if fname or (pname and fname):
continue
if pname not in already_test and '/' not in pname:
already_test.append(pname)
if is_shadowing(pname):
shadow_pkgs.add(pname)
return shadow_pkgs


def get_shadows_dir(dirname):
shadow_pkgs = set()
if not os.path.exists(dirname):
return shadow_pkgs
for pkg in os.listdir(dirname):
if not os.path.isfile(pkg) and is_shadowing(pkg):
shadow_pkgs.add(pkg)
return shadow_pkgs


def sys_path_insert(dirname):
if dirname.endswith('.zip'):
path_package_path(dirname, get_shadows_zip(dirname))
else:
path_package_path(dirname, get_shadows_dir(dirname))
12 changes: 7 additions & 5 deletions main/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def switch(case):


def is_trusted_url(next_url):
if not next_url:
return ''
next_url_host = urlparse(next_url).hostname
if config.TRUSTED_HOSTS and next_url_host not in config.TRUSTED_HOSTS:
return flask.url_for('welcome')
Expand All @@ -50,10 +52,10 @@ def get_next_url(next_url=''):
'next': wf.Str(missing=None), 'next_url': wf.Str(missing=None)
})
next_url = next_url or args['next'] or args['next_url']
do_not_redirect_urls = [flask.url_for(u) for u in [
'signin', 'signup', 'user_forgot', 'user_reset',
]]
if next_url:
do_not_redirect_urls = [flask.url_for(u) for u in [
'signin', 'signup', 'user_forgot', 'user_reset',
]]
if any(url in next_url for url in do_not_redirect_urls):
return flask.url_for('welcome')
return is_trusted_url(next_url)
Expand Down Expand Up @@ -89,7 +91,7 @@ def get_dbs(
query_prev = query_prev.filter(model_class._properties[prop] == val)

limit = limit or config.DEFAULT_DB_LIMIT
if limit is -1:
if limit == -1:
return list(query.fetch(keys_only=keys_only)), {'next': None, 'prev': None}

cursor = Cursor.from_websafe_string(cursor) if cursor else None
Expand All @@ -103,7 +105,7 @@ def get_dbs(
limit, start_cursor=cursor.reversed() if cursor else None, keys_only=True
)
prev_cursor = prev_cursor.reversed().to_websafe_string() \
if prev_cursor and cursor else None
if prev_cursor and cursor else None
return list(model_dbs), {'next': next_cursor, 'prev': prev_cursor}


Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"author": "Panayiotis Lipiridis <lipiridis@gmail.com>",
"devDependencies": {
"bower": "1.8.0",
"browser-sync": "2.18.8",
"coffee-script": "1.12.5",
"del": "2.2.2",
"bower": "1.8.2",
"browser-sync": "2.18.13",
"coffee-script": "1.12.7",
"del": "3.0.0",
"gulp": "3.9.1",
"gulp-autoprefixer": "4.0.0",
"gulp-bower": "0.0.13",
Expand All @@ -13,23 +13,23 @@
"gulp-cssnano": "2.1.2",
"gulp-help": "1.6.1",
"gulp-if": "2.0.2",
"gulp-less": "3.3.0",
"gulp-less": "3.3.2",
"gulp-load-plugins": "1.5.0",
"gulp-plumber": "1.1.0",
"gulp-sass": "3.1.0",
"gulp-sequence": "0.4.6",
"gulp-size": "2.1.0",
"gulp-sourcemaps": "2.6.0",
"gulp-sourcemaps": "2.6.1",
"gulp-start": "1.0.1",
"gulp-uglify": "2.1.2",
"gulp-uglify": "3.0.0",
"gulp-util": "3.0.8",
"gulp-watch": "4.3.11",
"gulp-zip": "4.0.0",
"less": "2.7.2",
"main-bower-files": "2.13.1",
"require-dir": "0.3.1",
"uglify-js": "3.0.4",
"yargs-parser": "7.0.0"
"require-dir": "0.3.2",
"uglify-js": "3.1.3",
"yargs-parser": "8.0.0"
},
"license": "MIT",
"name": "gae-init",
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
blinker==1.4
flask-login==0.4.0
flask-oauthlib==0.9.3
flask-restful==0.3.5
flask-oauthlib==0.9.4
flask-restful==0.3.6
flask-wtf==0.14.2
flask==0.12.1
pyjwt==1.5.0
unidecode==0.4.20
webargs==1.6.1
flask==0.12.2
pyjwt==1.5.3
unidecode==0.4.21
webargs==1.8.1
7 changes: 3 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import urllib
import urllib2

__version__ = '5.9.1'
__version__ = '5.9.5'


###############################################################################
Expand Down Expand Up @@ -104,8 +104,7 @@ def listdir(directory, split_ext=False):
try:
if split_ext:
return [os.path.splitext(dir_)[0] for dir_ in os.listdir(directory)]
else:
return os.listdir(directory)
return os.listdir(directory)
except OSError:
return []

Expand Down Expand Up @@ -146,7 +145,7 @@ def exec_pip_commands(command):
('set' if IS_WINDOWS else 'export'))
script.append(command)
script = '&'.join(script) if IS_WINDOWS else \
'/bin/bash -c "%s"' % ';'.join(script)
'/bin/bash -c "%s"' % ';'.join(script)
os.system(script)


Expand Down

0 comments on commit fdc85d0

Please sign in to comment.