Permalink
Browse files

Merge pull request #194 from ppurka/issue-184

Fix Issue 184 and update version to 0.10.8
  • Loading branch information...
2 parents def48d2 + 7f86198 commit a03f669e7464492e0019812681f23ca70ba2f7c0 @ppurka ppurka committed Dec 29, 2013
Showing with 67 additions and 24 deletions.
  1. +8 −3 Changes
  2. +18 −6 dist.sh
  3. +11 −8 flask_version/base.py
  4. +5 −1 setup.py
  5. +25 −6 util/fetch_deps.py
View
11 Changes
@@ -1,3 +1,8 @@
+0.10.8 Dec 29 2013
+
+ - Add Flask-OldSessions to dependency list and fix #184
+ - Restrict pytz version to at most 2013b
+
0.10.7.3 Dec 22 2013
- Minor fix for trac ticket #15510
@@ -13,21 +18,21 @@
- revert published worksheet sanitization as it is not optional
-0.10.7 Jun 24 2013
+0.10.7 Jun 24 2013
- Update license to GPLv3+ from GPLv2+
- Update MathJax to 2.2
- Allow new doctest continuation format in livedocs
- Sanitization for published worksheets
- Various bug fixes
-0.10.6 Apr 27 2013
+0.10.6 Apr 27 2013
- Allow more actions in live documentation.
- Add tools for converting sws files to rst files.
- Add parameter "doc_timeout" for controlling timeouts of live worksheets.
-0.10.5 Apr 01 2013
+0.10.5 Apr 01 2013
- Add support for LDAP authentication.
- Remove the old notebook.
View
24 dist.sh
@@ -4,18 +4,20 @@
# with Sage. For more complete instructions on how to generate a new
# SPKG, read the SPKG.txt file in the current SPKG.
#
-# Usage: dist.sh [-g]
+# Usage: dist.sh [-g] [-s]
#
# -g Also package the git repository
+# -s Only package the sagenb repository
die () {
echo >&2 "$@"
exit 1
}
-while getopts ":g" opt; do
+while getopts ":gs" opt; do
case $opt in
g) INSTALL_REPO=1 ;;
+ s) SAGENB_ONLY=1 ;;
*) die "Invalid option!"
esac
done
@@ -27,11 +29,21 @@ if [ -n "$INSTALL_REPO" ]; then
die "Uncommitted changes in sagenb - please commit, stash, or discard"
fi
-rm -rf dist
-mkdir -p dist
+if [ -n "$SAGENB_ONLY" ]; then
+ if [ -d dist ]; then
+ rm -f dist/sagenb-*.tar.gz
+ else
+ mkdir -p dist
+ fi
+else
+ rm -rf dist
+ mkdir -p dist
+fi
-echo "Fetching source tarballs of (sub)dependencies of sagenb to dist/"
-python util/fetch_deps.py dist || die "Couldn't fetch all (sub)dependencies"
+if [ -z "$SAGENB_ONLY" ]; then
+ echo "Fetching source tarballs of (sub)dependencies of sagenb to dist/"
+ python util/fetch_deps.py dist || die "Couldn't fetch all (sub)dependencies"
+fi
echo "Creating source tarball of sagenb itself in dist/"
python setup.py sdist > sdist.log || die "Couldn't make sagenb source tarball"
View
@@ -4,6 +4,8 @@
from flask import Flask, Module, url_for, render_template, request, session, redirect, g, make_response, current_app
from decorators import login_required, guest_or_login_required, with_lock
from decorators import global_lock
+# Make flask use the old session foo from <=flask-0.9
+from flask_oldsessions import OldSecureCookieSessionInterface
from flask.ext.autoindex import AutoIndex
try:
@@ -23,6 +25,7 @@ class SageNBFlask(Flask):
def __init__(self, *args, **kwds):
self.startup_token = kwds.pop('startup_token', None)
Flask.__init__(self, *args, **kwds)
+ self.session_interface = OldSecureCookieSessionInterface()
self.config['SESSION_COOKIE_HTTPONLY'] = False
@@ -238,7 +241,7 @@ def create_or_login(resp):
username = g.notebook.user_manager().get_username_from_openid(resp.identity_url)
session['username'] = g.username = username
session.modified = True
- except KeyError:
+ except (KeyError, LookupError):
session['openid_response'] = resp
session.modified = True
return redirect(url_for('set_profiles'))
@@ -298,26 +301,26 @@ def set_profiles():
parse_dict['challenge_html'] = chal.html(error_code = err_code)
else:
parse_dict['challenge_invalid'] = True
- raise ValueError
+ raise ValueError("Invalid challenge")
else:
parse_dict['challenge_missing'] = True
- raise ValueError
+ raise ValueError("Missing challenge")
if not is_valid_username(username):
parse_dict['username_invalid'] = True
- raise ValueError
+ raise ValueError("Invalid username")
if g.notebook.user_manager().user_exists(username):
parse_dict['username_taken'] = True
- raise ValueError
+ raise ValueError("Pre-existing username")
if not is_valid_email(request.form.get('email')):
parse_dict['email_invalid'] = True
- raise ValueError
+ raise ValueError("Invalid email")
try:
new_user = User(username, '', email = resp.email, account_type='user')
g.notebook.user_manager().add_user_object(new_user)
- except ValueError:
+ except ValueError as msg:
parse_dict['creation_error'] = True
- raise ValueError
+ raise ValueError("Error in creating user\n%s"%msg)
g.notebook.user_manager().create_new_openid(resp.identity_url, username)
session['username'] = g.username = username
session.modified = True
View
@@ -31,6 +31,7 @@ def all_files(dir, prefix):
install_requires = [ 'twisted>=11.0.0'
, 'flask>=0.10.1'
+ , 'flask-oldsessions>=0.10'
, 'flask-openid'
, 'flask-autoindex'
, 'babel'
@@ -43,13 +44,16 @@ def all_files(dir, prefix):
distutils.log.set_threshold(distutils.log.DEBUG)
code = setup(name = 'sagenb',
- version = '0.10.7.3',
+ version = '0.10.8',
description = 'The Sage Notebook',
license = 'GNU General Public License (GPL) v3+',
author = 'William Stein et al.',
author_email= 'sage-notebook@googlegroups.com',
url = 'http://github.com/sagemath/sagenb',
install_requires = install_requires,
+ dependency_links = [
+ 'http://github.com/mitsuhiko/flask-oldsessions/tarball/master#egg=flask-oldsessions-0.10'
+ ],
test_suite = 'sagenb.testing.run_tests.all_tests',
packages = [ 'sagenb'
, 'sagenb.flask_version'
View
@@ -10,7 +10,7 @@
# TODO: Automatically generate this (using distribute internals ?)
required_packages = [ 'zope.interface'
, 'twisted>=11.0.0'
- , 'pytz>=2011n'
+ , 'pytz >=2011n, <=2013b'
, 'Babel>=0.9.6'
, 'Werkzeug>=0.8.2'
, 'speaklater>=1.2'
@@ -21,10 +21,18 @@
, 'Flask-AutoIndex>=0.4.0'
, 'Flask-Babel>=0.8'
, 'Flask-OpenID>=1.0.1'
+ , 'Flask-OldSessions'
, 'webassets>=0.7.1'
]
-import os, shutil, sys
+# Format for online_packages:
+# "same pkg name as in required_packages" : (url, local filename)
+online_packages = { 'Flask-OldSessions':
+ ('http://github.com/mitsuhiko/flask-oldsessions/tarball/master',
+ 'Flask-OldSessions-0.10.tar.gz')
+ }
+
+import os, shutil, sys, urllib
from pkg_resources import Requirement
from setuptools.package_index import PackageIndex
@@ -46,7 +54,18 @@ def die(message):
dist = pkg_index.fetch_distribution(Requirement.parse(pkg),
dest_dir, True, True)
if dist is None:
- die("Couldn't find package satisfying '{0}'!".format(pkg))
- print " ---) Fetched {0} {1}".format(dist.project_name,
- dist.version)
- fd.write(os.path.basename(dist.location) + '\n')
+ if pkg in online_packages:
+ try:
+ filename = dest_dir + os.sep + online_packages[pkg][1]
+ urllib.urlretrieve(online_packages[pkg][0],
+ filename=filename)
+ print " ---) Fetched {}".format(online_packages[pkg][1])
+ fd.write(os.path.basename(filename) + '\n')
+ except URLError as msg:
+ die("Couldn't download '{}'!\n{}".format(pkg, msg))
+ else:
+ die("Couldn't find package satisfying '{0}'!".format(pkg))
+ else:
+ print " ---) Fetched {0} {1}".format(dist.project_name,
+ dist.version)
+ fd.write(os.path.basename(dist.location) + '\n')

0 comments on commit a03f669

Please sign in to comment.