Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes #2

Closed
wants to merge 2 commits into from

2 participants

@willkg
Collaborator

No description provided.

willkg added some commits
@willkg willkg Bunch of fixes
This fixes a bunch of problems I hit when building eugene which is
based on buchner.

It also adds a settings_local.py-dist file.
8c87d0e
@willkg willkg Add contributor; tweak formatting of license 568941a
@rehandalal rehandalal closed this
@rehandalal
Owner

Thanks @willkg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2013
  1. @willkg

    Bunch of fixes

    willkg authored
    This fixes a bunch of problems I hit when building eugene which is
    based on buchner.
    
    It also adds a settings_local.py-dist file.
  2. @willkg
This page is out of date. Refresh to see the latest.
View
1  CONTRIBUTORS
@@ -2,3 +2,4 @@ Contributors
============
* Rehan Dalal (rdalal/rehandalal)
+* Will Kahn-Greene (willkg)
View
10 LICENSE
@@ -5,15 +5,15 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
* Neither the name of standup nor the names of its contributors
-may be used to endorse or promote products derived from this software without
-specific prior written permission.
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
View
4 buchner/errors.py
@@ -11,6 +11,8 @@ def register_error_handlers(app):
def json_error(code, message):
"""Returns a JSON-ified error object"""
+ # Message can be an unserializable object.
+ message = repr(message)
return jsonify(dict(request=request.path, message=message)), code
@@ -31,4 +33,4 @@ def not_found(message=None):
def internal_server_error(message=None):
"""A generic 500 handler"""
message = message or 'Something went wrong.'
- return error(500, message, '500.html')
+ return error(500, message, 'errors/500.html')
View
14 buchner/helpers.py
@@ -21,13 +21,9 @@ def jsonify(obj):
return Response(dump, mimetype='application/json')
-def truthiness(str):
+def truthiness(s):
"""Returns a boolean from a string"""
- if isinstance(str, BooleanType):
- return str
- else:
- try:
- return (str(str).lower() == 'true' or str(str).lower() == 't'
- or str == '1')
- except (TypeError, ValueError):
- return False
+ try:
+ return str(s).lower() in ['true', 't', '1']
+ except (TypeError, ValueError, UnicodeEncodeError):
+ return False
View
6 buchner/main.py
@@ -21,9 +21,11 @@ def create_app(settings):
app.config[name] = value
# Register blueprints
- for blueprint in app.config.get('BLUEPRINTS', ()):
+ for blueprint in app.config.get('BLUEPRINTS', []):
app.register_blueprint(
- getattr(__import__(blueprint, fromlist=['blueprint']), 'blueprint'))
+ getattr(__import__('%s.views' % blueprint,
+ fromlist=['blueprint']),
+ 'blueprint'))
# Register error handlers
register_error_handlers(app)
View
4 buchner/settings.py
@@ -7,9 +7,9 @@ def abspath(path):
DEBUG = truthiness(os.environ.get('DEBUG', False))
-DATABASE_URL = os.environ.get('DATABASE_URL')
+DATABASE_URL = os.environ.get('DATABASE_URL', 'sqlite:///buchner_app.db')
-BLUEPRINTS = ()
+BLUEPRINTS = []
# Flask-Funnel
JAVA_BIN = os.environ.get('JAVA_BIN', 'java')
View
6 buchner/settings_local.py-dist
@@ -0,0 +1,6 @@
+# By default, eugene uses a sqlite database. If you want something
+# different, then uncomment the next line to specify a DATABASE_URL
+# DATABASE_URL = ''
+
+# If you want this in DEBUG mode, uncomment this line
+# DEBUG = True
View
5 buchner/settings_test.py
@@ -1 +1,6 @@
from buchner.settings import *
+
+TESTING = True
+
+# Uses in-memory database.
+DATABASE_URL = 'sqlite://'
Something went wrong with that request. Please try again.