Commits

Anonymous committed 2d58a37 Merge

Releasing 1.1.3

Comments (0)

Files changed (5)

conf/settings.py.example

 LOGFILR = '/var/log/resultsdb/resultsdb.log'
 SYSLOG_LOGGING = False
 STREAM_LOGGING = True
+SHOW_DB_URI = False
 %endif
 
 Name:           resultsdb
-Version:        1.1.0
+Version:        1.1.3
 Release:        1%{?dist}
 Summary:        Results store for automated tasks
 
 %{_datadir}/resultsdb/*
 
 %changelog
+* Mon Jun 23 2014 Tim Flink <tflink@fedoraproject.org> - 1.1.3-1
+- add SHOW_DB_URI configuration value to stop DB URI leaking
+
+* Wed Jun 18 2014 Tim Flink <tflink@fedoraproject.org> - 1.1.2-2
+- fixing botched build and bad changelog dates
+
+* Wed Jun 18 2014 Tim Flink <tflink@fedoraproject.org> - 1.1.2-1
+- Fixing typo in date parsing code
+- Working around limitations in how time data is stored without timezones
+
+* Fri Jun 13 2014 Tim Flink <tflink@fedoraproject.org> - 1.1.1-1
+- adding jsonp suport
+
 * Fri May 16 2014 Tim Flink <tflink@fedoraproject.org> - 1.1.0-1
 - Releasing resultsdb 1.1.0
 

resultsdb/__init__.py

 #   Josef Skladanka <jskladan@redhat.com>
 #   Ralph Bean <rbean@redhat.com>
 
+import flask
 from flask import Flask
 from flask.ext.login import LoginManager
 from flask.ext.sqlalchemy import SQLAlchemy
 
 
 # the version as used in setup.py
-__version__ = "1.1.0"
+__version__ = "1.1.3"
 
 
 # Flask App
 app = Flask(__name__)
 app.secret_key = 'not-really-a-secret'
 
+# Monkey patch Flask's "jsonify" to also handle JSONP
+original_jsonify = flask.jsonify
+
+def jsonify_with_jsonp(*args, **kwargs):
+    response = original_jsonify(*args, **kwargs)
+    callback = flask.request.args.get('callback')
+
+    if callback:
+        response.mimetype = 'application/javascript'
+        response.set_data('%s(%s);' % (callback, response.get_data()))
+
+    return response
+
+flask.jsonify = jsonify_with_jsonp
+
 # Load default config, then override that with a config file
 if os.getenv('PROD') == 'true':
     default_config_obj = 'resultsdb.config.ProductionConfig'
 
 setup_logging()
 
-app.logger.debug('using DBURI: %s' % app.config['SQLALCHEMY_DATABASE_URI'])
+if app.config['SHOW_DB_URI']:
+    app.logger.debug('using DBURI: %s' % app.config['SQLALCHEMY_DATABASE_URI'])
 
 
 # database

resultsdb/config.py

 
     PRODUCTION = False
 
+    SHOW_DB_URI = False
+
 
 class ProductionConfig(Config):
     DEBUG = False

resultsdb/controllers/api_v1.py

     since_start = None
     since_end = None
     if since is not None:
-        # Add time information, as iso8601 can not deal with just date
-        #   if time is provided, this won't change anything
-        s = ['%sT00:00:00' % x.strip() for x in since.split(',')]
+        s = since.split(',')
         try:
             since_start = iso8601.parse_date(s[0])
+            # https://phab.qadevel.cloud.fedoraproject.org/T246
+            since_start = since_start.replace(tzinfo=None) # we need to strip timezone info
         except (TypeError, ValueError, iso8601.iso8601.ParseError): # Yes, this library sucks in Exception handling..
             raise iso8601.iso8601.ParseError()
         try:
             since_end = iso8601.parse_date(s[1])
+            # https://phab.qadevel.cloud.fedoraproject.org/T246
+            since_end = since_end.replace(tzinfo=None) # we need to strip timezone info
         except IndexError: # since contained just one datetime
              pass
         except (TypeError, ValueError, iso8601.iso8601.ParseError): # Yes, this library sucks in Exception handling..
     # TODO: Find a way to do this 'better' without multiple (aka aliased) joins
     # Time constraints (args['since']) and ordering by Job.startt_time
     if since_start or since_end:
-        if asince_source == 'job':
+        if since_source == 'job':
             if since_start and since_end:
                 q = q.join(Job).order_by(db.desc(Job.start_time)).filter(Job.start_time >= since_start, Job.start_time <= since_end)
             else: #means "just since_start"