Skip to content

Commit

Permalink
Merge 1ed4e69 into b970847
Browse files Browse the repository at this point in the history
  • Loading branch information
deargle committed Mar 23, 2021
2 parents b970847 + 1ed4e69 commit 60a97bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- added backwards compatibility for class `InvalidUsage` exception in
experiment_errors.py, for custom.py files generated by old version of psiturk.

## 3.0.5
### Fixed
- Fixed backwards compatibility for translating ON_HEROKU=1 to ON_CLOUD=1
Expand Down Expand Up @@ -44,6 +49,8 @@ thought through.
call `render_template()` on it yourself.
- psiturk.js `preloadPages()` now returns a `Promise`. See the [migration guide](https://psiturk.readthedocs.io/en/latest/migrating.html) for links to
examples of using the new approach.
- psiturk exception `InvalidUsage` changed to `InvalidUsageError`. Breaks
`custom.py` files generated under psiturk v2.

#### Configuration files
- the configuration file created by running `psiturk-setup-example`
Expand Down
9 changes: 7 additions & 2 deletions psiturk/experiment_errors.py
Expand Up @@ -154,7 +154,7 @@ def error_page(self, request, contact_on_error):


class ExperimentApiError(Exception):

def __init__(self, message, status_code=500, payload=None):
super().__init__()
self.message = message
Expand All @@ -168,8 +168,13 @@ def to_dict(self):


class InvalidUsageError(ExperimentApiError):

def __init__(self, *args, **kwargs):
if 'status_code' not in kwargs:
kwargs['status_code'] = 400
super(InvalidUsageError, self).__init__(*args, **kwargs)

class InvalidUsage(InvalidUsageError):
# backwards compatibility with psiturk v2's custom.py files
# generated by psiturk-setup-example
pass

0 comments on commit 60a97bc

Please sign in to comment.