diff --git a/app_context_rqworker.py b/app_context_rqworker.py index 55bea94f6d..034350ee4c 100644 --- a/app_context_rqworker.py +++ b/app_context_rqworker.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . #!/usr/bin/env python import sys diff --git a/cli.py b/cli.py index d48a980145..8a2c743e6a 100755 --- a/cli.py +++ b/cli.py @@ -125,7 +125,7 @@ def delete_hard_bounces(): def bootstrap_avatars(): """Download current links from user avatar and projects to real images hosted in the - PyBossa server.""" + PYBOSSA server.""" import requests import os import time diff --git a/doc/api.rst b/doc/api.rst index 3acb10ec4e..5489693fd5 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -481,6 +481,10 @@ Account index **Endpoint: /account/page/** +*Allowed methods*: **GET** + +**GET** + It returns a JSON object with the following information: * **accounts**: this key holds the list of accounts for the given page. @@ -540,4 +544,75 @@ It returns a JSON object with the following information: "update_feed": [] } +Account registration +~~~~~~~~~~~~~~~~~~~~ +**Endpoint: /account/register** + +*Allowed methods*: **GET/POST** + +**GET** + +It returns a JSON object with the following information: + +* **form**: The form fields that need to be sent for creating an account. It contains the CSRF token for validating the POST, as well as an errors field in case that something is wrong. +* **template**: The Jinja2 template that could be rendered. +* **title**: the title of the page. + +**Example output** +.. code-block:: python + { + "form": { + "confirm": null, + "csrf": "token," + "email_addr": null, + "errors": {}, + "fullname": null, + "name": null, + "password": null + }, + "template": "account/register.html", + "title": "Register" + } + +**POST** + +To send a valid POST request you need to pass the *csrf token* in the headers. Use +the following header: "X-CSRFToken". + +It returns a JSON object with the following information: + +* **next**: URL that you JavaScript can follow as a redirect. It is not mandatory. + +**Example output** + +.. code-block:: python + { + "next":"/about" + } + + +If there's an error in the form fields, you will get them in the **form.errors** key: + +.. code-block:: python + + { + "form": { + "confirm": "daniel", + "csrf": "token", + "email_addr": "daniel", + "errors": { + "email_addr": [ + "Invalid email address." + ], + "name": [ + "The user name is already taken" + ] + }, + "fullname": "daniel", + "name": "daniel", + "password": "daniel" + }, + "template": "account/register.html", + "title": "Register" + } diff --git a/doc/customizing.rst b/doc/customizing.rst index 0577607a84..e51e5aee20 100644 --- a/doc/customizing.rst +++ b/doc/customizing.rst @@ -107,6 +107,15 @@ ITSDANGEROUSKEY_. .. _ITSDANGEROUSKEY: https://github.com/Scifabric/pybossa/blob/master/settings_local.py.tmpl#L35 .. _`It's dangerous`: http://pythonhosted.org/itsdangerous/ +CORS configuration +================== + +By default PYBOSSA has the api endpoints configured with **Access-Control-Allow-Origin: ***. However, you can change it to whatever you want via the config file. Take a look into the +official documentation for `Flask-CORS` for all the available options. + +.. _`Flask-CORS`: https://flask-cors.readthedocs.io/en/latest/ + + Modifying the Brand name ======================== diff --git a/pybossa/__init__.py b/pybossa/__init__.py index d05731aab6..6a0e849aaa 100644 --- a/pybossa/__init__.py +++ b/pybossa/__init__.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa main module. +PYBOSSA main module. This exports: * auth: for authorization methods diff --git a/pybossa/api/__init__.py b/pybossa/api/__init__.py index cdf44eddce..abcbfaf723 100644 --- a/pybossa/api/__init__.py +++ b/pybossa/api/__init__.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing domain objects via an API. +PYBOSSA api module for exposing domain objects via an API. This package adds GET, POST, PUT and DELETE methods for: * projects, @@ -34,7 +34,7 @@ from flask import Blueprint, request, abort, Response, make_response from flask.ext.login import current_user from werkzeug.exceptions import NotFound -from pybossa.util import jsonpify, crossdomain, get_user_id_or_ip +from pybossa.util import jsonpify, get_user_id_or_ip import pybossa.model as model from pybossa.core import csrf, ratelimits, sentinel from pybossa.ratelimit import ratelimit @@ -57,17 +57,14 @@ blueprint = Blueprint('api', __name__) -cors_headers = ['Content-Type', 'Authorization'] - error = ErrorStatus() @blueprint.route('/') -@crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def index(): # pragma: no cover """Return dummy text for welcome page.""" - return 'The PyBossa API' + return 'The PYBOSSA API' def register_api(view, endpoint, url, pk='id', pk_type='int'): @@ -105,7 +102,6 @@ def register_api(view, endpoint, url, pk='id', pk_type='int'): @jsonpify @blueprint.route('/app//newtask') @blueprint.route('/project//newtask') -@crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def new_task(project_id): """Return a new task for a project.""" @@ -167,7 +163,6 @@ def _retrieve_new_task(project_id): @blueprint.route('/project//userprogress') @blueprint.route('/app//userprogress') @blueprint.route('/project//userprogress') -@crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def user_progress(project_id=None, short_name=None): """API endpoint for user progress. @@ -204,7 +199,6 @@ def user_progress(project_id=None, short_name=None): @jsonpify @blueprint.route('/auth/project//token') -@crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def auth_jwt_project(short_name): """Create a JWT for a project via its secret KEY.""" diff --git a/pybossa/api/api_base.py b/pybossa/api/api_base.py index ed9c5ac6b2..3c27560dd6 100644 --- a/pybossa/api/api_base.py +++ b/pybossa/api/api_base.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing domain objects via an API. +PYBOSSA api module for exposing domain objects via an API. This package adds GET, POST, PUT and DELETE methods for any class: * projects, @@ -31,7 +31,7 @@ from flask.ext.login import current_user from flask.views import MethodView from werkzeug.exceptions import NotFound, Unauthorized, Forbidden -from pybossa.util import jsonpify, crossdomain +from pybossa.util import jsonpify from pybossa.core import ratelimits from pybossa.auth import ensure_authorized_to from pybossa.hateoas import Hateoas @@ -58,8 +58,6 @@ } -cors_headers = ['Content-Type', 'Authorization'] - error = ErrorStatus() @@ -75,13 +73,11 @@ def valid_args(self): if k not in ['api_key']: getattr(self.__class__, k) - @crossdomain(origin='*', headers=cors_headers) - def options(self): # pragma: no cover + def options(self, **kwargs): # pragma: no cover """Return '' for Options method.""" return '' @jsonpify - @crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def get(self, oid): """Get an object. @@ -193,7 +189,6 @@ def _set_limit_and_offset(self): return limit, offset @jsonpify - @crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def post(self): """Post an item to the DB with the request.data JSON object. @@ -227,7 +222,6 @@ def _create_instance_from_request(self, data): return inst @jsonpify - @crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def delete(self, oid): """Delete a single item from the DB. @@ -263,7 +257,6 @@ def _delete_instance(self, oid): return inst @jsonpify - @crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def put(self, oid): """Update a single item in the DB. diff --git a/pybossa/api/app.py b/pybossa/api/app.py index 69d88c1e8a..682fe9fe1f 100644 --- a/pybossa/api/app.py +++ b/pybossa/api/app.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for domain object APP via an API. +PYBOSSA api module for domain object APP via an API. This package adds GET, POST, PUT and DELETE methods for: * projects, diff --git a/pybossa/api/category.py b/pybossa/api/category.py index dd2f642d26..96657ead10 100644 --- a/pybossa/api/category.py +++ b/pybossa/api/category.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for domain object Category via an API. +PYBOSSA api module for domain object Category via an API. This package adds GET, POST, PUT and DELETE methods for: * categories diff --git a/pybossa/api/global_stats.py b/pybossa/api/global_stats.py index b3e9d2f2de..b31bfb76e1 100644 --- a/pybossa/api/global_stats.py +++ b/pybossa/api/global_stats.py @@ -1,33 +1,33 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing Global Stats via an API. +PYBOSSA api module for exposing Global Stats via an API. This package adds GET method for Global Stats. """ import json -from api_base import APIBase, cors_headers +from api_base import APIBase from flask import Response import pybossa.cache.site_stats as stats import pybossa.cache.projects as cached_projects import pybossa.cache.categories as cached_categories -from pybossa.util import jsonpify, crossdomain +from pybossa.util import jsonpify from pybossa.ratelimit import ratelimit from werkzeug.exceptions import MethodNotAllowed @@ -35,14 +35,13 @@ class GlobalStatsAPI(APIBase): """ - Class for Global Stats of PyBossa server. + Class for Global Stats of PYBOSSA server. Returns global stats as a JSON object. """ @jsonpify - @crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=300, per=15 * 60) def get(self, oid=None): """Return global stats.""" diff --git a/pybossa/api/project.py b/pybossa/api/project.py index 391b24e294..c538850496 100644 --- a/pybossa/api/project.py +++ b/pybossa/api/project.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for domain object APP via an API. +PYBOSSA api module for domain object APP via an API. This package adds GET, POST, PUT and DELETE methods for: * projects, diff --git a/pybossa/api/result.py b/pybossa/api/result.py index 22a031c5e1..f7fa545704 100644 --- a/pybossa/api/result.py +++ b/pybossa/api/result.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing domain object Result via an API. +PYBOSSA api module for exposing domain object Result via an API. This package adds GET, POST, PUT and DELETE methods for: * tasks diff --git a/pybossa/api/task.py b/pybossa/api/task.py index 2f7dc8966a..4c9dd4dbc0 100644 --- a/pybossa/api/task.py +++ b/pybossa/api/task.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing domain object Task via an API. +PYBOSSA api module for exposing domain object Task via an API. This package adds GET, POST, PUT and DELETE methods for: * tasks diff --git a/pybossa/api/task_run.py b/pybossa/api/task_run.py index 887b971e06..d9837d18d2 100644 --- a/pybossa/api/task_run.py +++ b/pybossa/api/task_run.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing domain object TaskRun via an API. +PYBOSSA api module for exposing domain object TaskRun via an API. This package adds GET, POST, PUT and DELETE methods for: * task_runs diff --git a/pybossa/api/token.py b/pybossa/api/token.py index 21768f77fb..857c46aba4 100644 --- a/pybossa/api/token.py +++ b/pybossa/api/token.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for user oauth tokens via an API. +PYBOSSA api module for user oauth tokens via an API. This package adds GET method for: * user oauth tokens diff --git a/pybossa/api/user.py b/pybossa/api/user.py index 0e0c8ede92..d907017eb5 100644 --- a/pybossa/api/user.py +++ b/pybossa/api/user.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for domain object USER via an API. +PYBOSSA api module for domain object USER via an API. This package adds GET method for: * users diff --git a/pybossa/api/vmcp.py b/pybossa/api/vmcp.py index 0b8edf36c6..4e7a479566 100644 --- a/pybossa/api/vmcp.py +++ b/pybossa/api/vmcp.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa api module for exposing VMCP via an API. +PYBOSSA api module for exposing VMCP via an API. This package signs via API a request from CernVM plugin. @@ -25,10 +25,10 @@ import json import pybossa.vmcp from flask import Response, request, current_app -from api_base import APIBase, cors_headers +from api_base import APIBase from werkzeug.exceptions import MethodNotAllowed from pybossa.core import ratelimits -from pybossa.util import jsonpify, crossdomain +from pybossa.util import jsonpify from pybossa.ratelimit import ratelimit @@ -41,7 +41,6 @@ class VmcpAPI(APIBase): """ @jsonpify - @crossdomain(origin='*', headers=cors_headers) @ratelimit(limit=ratelimits.get('LIMIT'), per=ratelimits.get('PER')) def get(self, oid=None): """Return signed VMCP for CernVM requests.""" diff --git a/pybossa/auditlogger.py b/pybossa/auditlogger.py index fb63fedbe0..03d5a93c9d 100644 --- a/pybossa/auditlogger.py +++ b/pybossa/auditlogger.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """AuditLogger module.""" from pybossa.model.auditlog import Auditlog diff --git a/pybossa/auth/__init__.py b/pybossa/auth/__init__.py index 690acd10f8..e042fda75a 100644 --- a/pybossa/auth/__init__.py +++ b/pybossa/auth/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import inspect from flask import abort diff --git a/pybossa/auth/auditlog.py b/pybossa/auth/auditlog.py index 54ba2fef04..bc0a48feb5 100644 --- a/pybossa/auth/auditlog.py +++ b/pybossa/auth/auditlog.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class AuditlogAuth(object): diff --git a/pybossa/auth/blogpost.py b/pybossa/auth/blogpost.py index 1a1a402084..31a349ac46 100644 --- a/pybossa/auth/blogpost.py +++ b/pybossa/auth/blogpost.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class BlogpostAuth(object): diff --git a/pybossa/auth/category.py b/pybossa/auth/category.py index 16d01451be..28837688a7 100644 --- a/pybossa/auth/category.py +++ b/pybossa/auth/category.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class CategoryAuth(object): diff --git a/pybossa/auth/errcodes.py b/pybossa/auth/errcodes.py index e87ede0138..55b637b61b 100644 --- a/pybossa/auth/errcodes.py +++ b/pybossa/auth/errcodes.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . INVALID_HEADER_MISSING = {'code': 'invalid_header', 'description': 'Missing Authorization header'} diff --git a/pybossa/auth/project.py b/pybossa/auth/project.py index 07048414fa..d3bbcb7261 100644 --- a/pybossa/auth/project.py +++ b/pybossa/auth/project.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class ProjectAuth(object): diff --git a/pybossa/auth/result.py b/pybossa/auth/result.py index f4082f4d11..0a989afa1f 100644 --- a/pybossa/auth/result.py +++ b/pybossa/auth/result.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class ResultAuth(object): diff --git a/pybossa/auth/task.py b/pybossa/auth/task.py index 48e0d442b6..20a425e31c 100644 --- a/pybossa/auth/task.py +++ b/pybossa/auth/task.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class TaskAuth(object): diff --git a/pybossa/auth/taskrun.py b/pybossa/auth/taskrun.py index da736db597..f8d4b7ab7e 100644 --- a/pybossa/auth/taskrun.py +++ b/pybossa/auth/taskrun.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from flask import abort diff --git a/pybossa/auth/token.py b/pybossa/auth/token.py index 8c46740efc..883ddfbcf7 100644 --- a/pybossa/auth/token.py +++ b/pybossa/auth/token.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class TokenAuth(object): diff --git a/pybossa/auth/user.py b/pybossa/auth/user.py index 15128c442c..52102d49aa 100644 --- a/pybossa/auth/user.py +++ b/pybossa/auth/user.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class UserAuth(object): diff --git a/pybossa/auth/webhook.py b/pybossa/auth/webhook.py index 3813d164fe..dea57c559b 100644 --- a/pybossa/auth/webhook.py +++ b/pybossa/auth/webhook.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # # Copyright (C) 2015 SF Isle of Man Limited # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class WebhookAuth(object): diff --git a/pybossa/cache/__init__.py b/pybossa/cache/__init__.py index 9985c1a24f..1002919d1b 100644 --- a/pybossa/cache/__init__.py +++ b/pybossa/cache/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ This module exports a set of decorators for caching functions. diff --git a/pybossa/cache/categories.py b/pybossa/cache/categories.py index 76b9dc3303..b2278f6d22 100644 --- a/pybossa/cache/categories.py +++ b/pybossa/cache/categories.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.sql import text from pybossa.cache import cache, delete_cached diff --git a/pybossa/cache/helpers.py b/pybossa/cache/helpers.py index 141106714c..b98e86653d 100644 --- a/pybossa/cache/helpers.py +++ b/pybossa/cache/helpers.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Cache module with helper functions.""" from sqlalchemy.sql import text diff --git a/pybossa/cache/project_stats.py b/pybossa/cache/project_stats.py index bc14ee6216..ace3b0747b 100644 --- a/pybossa/cache/project_stats.py +++ b/pybossa/cache/project_stats.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Cache module for project stats.""" from flask import current_app from sqlalchemy.sql import text diff --git a/pybossa/cache/projects.py b/pybossa/cache/projects.py index 1598c93eac..a1980380af 100644 --- a/pybossa/cache/projects.py +++ b/pybossa/cache/projects.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Cache module for projects.""" from sqlalchemy.sql import text from pybossa.core import db, timeouts diff --git a/pybossa/cache/site_stats.py b/pybossa/cache/site_stats.py index 2cf4114b90..7bbf8206d8 100644 --- a/pybossa/cache/site_stats.py +++ b/pybossa/cache/site_stats.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Cache module for site statistics.""" import pygeoip from sqlalchemy.sql import text diff --git a/pybossa/cache/users.py b/pybossa/cache/users.py index c64c56ad49..02463be03a 100644 --- a/pybossa/cache/users.py +++ b/pybossa/cache/users.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Cache module for users.""" from sqlalchemy.sql import text from pybossa.core import db, timeouts diff --git a/pybossa/ckan.py b/pybossa/ckan.py index 6f6f83565a..3665d5703f 100644 --- a/pybossa/ckan.py +++ b/pybossa/ckan.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""CKAN module for PyBossa.""" +# along with PYBOSSA. If not, see . +"""CKAN module for PYBOSSA.""" import requests import json from pybossa.model.task import Task diff --git a/pybossa/contributions_guard.py b/pybossa/contributions_guard.py index 13ffe86d2d..1823823be2 100644 --- a/pybossa/contributions_guard.py +++ b/pybossa/contributions_guard.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model import make_timestamp diff --git a/pybossa/cookies.py b/pybossa/cookies.py index f7d929dc3a..3de611c63d 100644 --- a/pybossa/cookies.py +++ b/pybossa/cookies.py @@ -1,26 +1,26 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Cookie module for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Cookie module for PYBOSSA.""" class CookieHandler(object): - """Cookie Class handler for PyBossa.""" + """Cookie Class handler for PYBOSSA.""" def __init__(self, request, signer, expiration=1200): """Init method.""" diff --git a/pybossa/core.py b/pybossa/core.py index 25be478e7b..edaa0b238c 100644 --- a/pybossa/core.py +++ b/pybossa/core.py @@ -1,31 +1,32 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Core module for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Core module for PYBOSSA.""" import os import logging import humanize from werkzeug.exceptions import Forbidden, Unauthorized, InternalServerError -from werkzeug.exceptions import NotFound +from werkzeug.exceptions import NotFound, BadRequest from flask import Flask, url_for, request, render_template, \ flash, _app_ctx_stack from flask.ext.login import current_user from flask.ext.babel import gettext from flask.ext.assets import Bundle +from flask_json_multidict import get_json_multidict from pybossa import default_settings as settings from pybossa.extensions import * from pybossa.ratelimit import get_view_rate_limit @@ -57,7 +58,7 @@ def create_app(run_as_server=True): signer.init_app(app) if app.config.get('SENTRY_DSN'): # pragma: no cover Sentry(app) - if run_as_server: + if run_as_server: # pragma: no cover setup_scheduled_jobs(app) setup_blueprints(app) setup_hooks(app) @@ -70,6 +71,8 @@ def create_app(run_as_server=True): setup_jinja2_filters(app) setup_newsletter(app) setup_sse(app) + setup_json_serializer(app) + setup_cors(app) plugin_manager.init_app(app) plugin_manager.install_plugins() import pybossa.model.event_listeners @@ -97,6 +100,13 @@ def configure_app(app): dict(slave=app.config.get('SQLALCHEMY_DATABASE_URI')) +def setup_json_serializer(app): + app.json_encoder = JSONEncoder + + +def setup_cors(app): + cors.init_app(app, resources=app.config.get('CORS_RESOURCES')) + def setup_sse(app): if app.config['SSE']: msg = "WARNING: async mode is required as Server Sent Events are enabled." @@ -107,7 +117,7 @@ def setup_sse(app): def setup_theme(app): - """Configure theme for PyBossa app.""" + """Configure theme for PYBOSSA app.""" theme = app.config['THEME'] app.template_folder = os.path.join('themes', theme, 'templates') app.static_folder = os.path.join('themes', theme, 'static') @@ -250,6 +260,8 @@ def _get_locale(): if (lang is None or lang == '' or lang.lower() not in locales): lang = app.config.get('DEFAULT_LOCALE') or 'en' + if request.headers['Content-Type'] == 'application/json': + lang = 'en' return lang.lower() return babel @@ -435,6 +447,12 @@ def setup_jinja(app): def setup_error_handlers(app): """Setup error handlers.""" + @app.errorhandler(400) + def _bad_request(e): + response = dict(template='400.html', code=400, + description=BadRequest.description) + return handle_content_type(response) + @app.errorhandler(404) def _page_not_found(e): response = dict(template='404.html', code=404, @@ -483,6 +501,11 @@ def _api_authentication(): user = user_repo.get_by(api_key=apikey) if user: _request_ctx_stack.top.user = user + # Handle forms + request.body = request.form + if (request.method == 'POST' and + request.headers['Content-Type'] == 'application/json'): + request.body = get_json_multidict(request) @app.context_processor def _global_template_context(): @@ -526,7 +549,7 @@ def _global_template_context(): if app.config.get('CONTACT_TWITTER'): # pragma: no cover contact_twitter = app.config.get('CONTACT_TWITTER') else: - contact_twitter = 'PyBossa' + contact_twitter = 'PYBOSSA' # Available plugins plugins = plugin_manager.plugins @@ -550,6 +573,12 @@ def _global_template_context(): notify_admin=notify_admin, plugins=plugins) + @csrf.error_handler + def csrf_error_handler(reason): + response = dict(template='400.html', code=400, + description=reason) + return handle_content_type(response) + def setup_jinja2_filters(app): """Setup jinja2 filters.""" diff --git a/pybossa/dashboard/__init__.py b/pybossa/dashboard/__init__.py index 1555cea53e..686984e8f0 100644 --- a/pybossa/dashboard/__init__.py +++ b/pybossa/dashboard/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/pybossa/dashboard/data.py b/pybossa/dashboard/data.py index 44060dbb7e..ffc752907f 100644 --- a/pybossa/dashboard/data.py +++ b/pybossa/dashboard/data.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Dashboard queries to be used in admin dashboard view.""" from sqlalchemy import text from sqlalchemy.exc import ProgrammingError diff --git a/pybossa/dashboard/jobs.py b/pybossa/dashboard/jobs.py index 749b1ac30f..05d21b9979 100644 --- a/pybossa/dashboard/jobs.py +++ b/pybossa/dashboard/jobs.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Dashboard Jobs module for running background tasks in PyBossa server.""" +# along with PYBOSSA. If not, see . +"""Dashboard Jobs module for running background tasks in PYBOSSA server.""" from sqlalchemy import text from pybossa.core import db diff --git a/pybossa/default_settings.py b/pybossa/default_settings.py index 41da2d540a..4ca638fec8 100644 --- a/pybossa/default_settings.py +++ b/pybossa/default_settings.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . DEBUG = False @@ -28,8 +28,8 @@ ITSDANGEROUSKEY = 'its-dangerous-key' ## project configuration -BRAND = 'PyBossa' -TITLE = 'PyBossa' +BRAND = 'PYBOSSA' +TITLE = 'PYBOSSA' COPYRIGHT = 'Set Your Institution' DESCRIPTION = 'Set the description in your config' TERMSOFUSE = 'http://okfn.org/terms-of-use/' @@ -126,3 +126,9 @@ 'autoimporter': True, 'better_stats': True } + +CORS_RESOURCES = {r"/api/*": {"origins": "*", + "allow_headers": ['Content-Type', + 'Authorization'], + "max_age": 21600 + }} diff --git a/pybossa/error/__init__.py b/pybossa/error/__init__.py index 419d22321f..326726de95 100644 --- a/pybossa/error/__init__.py +++ b/pybossa/error/__init__.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa error module for processing error status. +PYBOSSA error module for processing error status. This package adds GET, POST, PUT and DELETE errors for the API: * projects, diff --git a/pybossa/exc/__init__.py b/pybossa/exc/__init__.py index bc6e8c76d4..7bb0f157e8 100644 --- a/pybossa/exc/__init__.py +++ b/pybossa/exc/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from repository import WrongObjectError, DBIntegrityError diff --git a/pybossa/exc/repository.py b/pybossa/exc/repository.py index c2143f1d5e..0e79c0a19c 100644 --- a/pybossa/exc/repository.py +++ b/pybossa/exc/repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class DBIntegrityError(Exception): diff --git a/pybossa/exporter/__init__.py b/pybossa/exporter/__init__.py index 997e560c3f..27901726c3 100644 --- a/pybossa/exporter/__init__.py +++ b/pybossa/exporter/__init__.py @@ -1,23 +1,23 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ -Exporter module for exporting tasks and tasks results out of PyBossa +Exporter module for exporting tasks and tasks results out of PYBOSSA """ import os diff --git a/pybossa/exporter/csv_export.py b/pybossa/exporter/csv_export.py index 37373b4296..34a3b17e64 100644 --- a/pybossa/exporter/csv_export.py +++ b/pybossa/exporter/csv_export.py @@ -1,23 +1,23 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ -CSV Exporter module for exporting tasks and tasks results out of PyBossa +CSV Exporter module for exporting tasks and tasks results out of PYBOSSA """ import tempfile diff --git a/pybossa/exporter/json_export.py b/pybossa/exporter/json_export.py index 35e7fffc28..2b5115bce7 100644 --- a/pybossa/exporter/json_export.py +++ b/pybossa/exporter/json_export.py @@ -1,23 +1,23 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ -JSON Exporter module for exporting tasks and tasks results out of PyBossa +JSON Exporter module for exporting tasks and tasks results out of PYBOSSA """ import json diff --git a/pybossa/extensions.py b/pybossa/extensions.py index 2c4d2587e8..d954150bd7 100644 --- a/pybossa/extensions.py +++ b/pybossa/extensions.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -This module exports all the extensions used by PyBossa. +This module exports all the extensions used by PYBOSSA. The objects are: * sentinel: for caching data, ratelimiting, etc. @@ -39,7 +39,7 @@ 'csrf', 'timeouts', 'ratelimits', 'user_repo', 'project_repo', 'task_repo', 'blog_repo', 'auditlog_repo', 'webhook_repo', 'result_repo', 'newsletter', 'importer', 'flickr', - 'plugin_manager', 'assets'] + 'plugin_manager', 'assets', 'JSONEncoder', 'cors'] # CACHE from pybossa.sentinel import Sentinel @@ -126,3 +126,18 @@ from flask.ext.assets import Environment assets = Environment() + +from flask.json import JSONEncoder as BaseEncoder +from speaklater import _LazyString + +class JSONEncoder(BaseEncoder): # pragma: no cover + """JSON Encoder to deal with Babel lazy strings.""" + def default(self, o): + if isinstance(o, _LazyString): + return str(o) + + return BaseEncoder.default(self, o) + +# CORS +from flask_cors import CORS +cors = CORS() diff --git a/pybossa/feed.py b/pybossa/feed.py index c47718e7b1..b4331976f3 100644 --- a/pybossa/feed.py +++ b/pybossa/feed.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from time import time from pybossa.core import sentinel diff --git a/pybossa/flickr_client.py b/pybossa/flickr_client.py index f9d71a217c..632b922e77 100644 --- a/pybossa/flickr_client.py +++ b/pybossa/flickr_client.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Flickr module for authentication.""" from flask_oauthlib.client import OAuth import functools diff --git a/pybossa/forms/__init__.py b/pybossa/forms/__init__.py index 1555cea53e..686984e8f0 100644 --- a/pybossa/forms/__init__.py +++ b/pybossa/forms/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/pybossa/forms/account_view_forms.py b/pybossa/forms/account_view_forms.py index 3470d7a47d..d8f15a8674 100644 --- a/pybossa/forms/account_view_forms.py +++ b/pybossa/forms/account_view_forms.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from forms import ( diff --git a/pybossa/forms/admin_view_forms.py b/pybossa/forms/admin_view_forms.py index c7faf641a0..2a8edd06ac 100644 --- a/pybossa/forms/admin_view_forms.py +++ b/pybossa/forms/admin_view_forms.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from forms import ( diff --git a/pybossa/forms/forms.py b/pybossa/forms/forms.py index fdb8d47ff3..c9cdbf4d7f 100644 --- a/pybossa/forms/forms.py +++ b/pybossa/forms/forms.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from flask import current_app from flask_wtf import Form @@ -245,7 +245,7 @@ def __call__(self, form_name, *form_args, **form_kwargs): class LoginForm(Form): - """Login Form class for signin into PyBossa.""" + """Login Form class for signin into PYBOSSA.""" email = TextField(lazy_gettext('E-mail'), [validators.Required( @@ -259,7 +259,7 @@ class LoginForm(Form): class RegisterForm(Form): - """Register Form Class for creating an account in PyBossa.""" + """Register Form Class for creating an account in PYBOSSA.""" err_msg = lazy_gettext("Full name must be between 3 and %(fullname)s " "characters long", fullname=USER_FULLNAME_MAX_LENGTH) @@ -296,7 +296,7 @@ class RegisterForm(Form): class UpdateProfileForm(Form): - """Form Class for updating PyBossa's user Profile.""" + """Form Class for updating PYBOSSA's user Profile.""" id = IntegerField(label=None, widget=HiddenInput()) diff --git a/pybossa/forms/projects_view_forms.py b/pybossa/forms/projects_view_forms.py index f628184a00..fa0620a4e6 100644 --- a/pybossa/forms/projects_view_forms.py +++ b/pybossa/forms/projects_view_forms.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from forms import ( diff --git a/pybossa/forms/validator.py b/pybossa/forms/validator.py index 936517962b..048c9130d7 100644 --- a/pybossa/forms/validator.py +++ b/pybossa/forms/validator.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from flask.ext.babel import lazy_gettext from wtforms.validators import ValidationError diff --git a/pybossa/hateoas.py b/pybossa/hateoas.py index 522356e7fd..28ed20ea75 100644 --- a/pybossa/hateoas.py +++ b/pybossa/hateoas.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Hateoas module for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Hateoas module for PYBOSSA.""" from flask import url_for diff --git a/pybossa/importers/__init__.py b/pybossa/importers/__init__.py index 6767e8d5fc..4928a50443 100644 --- a/pybossa/importers/__init__.py +++ b/pybossa/importers/__init__.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Importers module for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Importers module for PYBOSSA.""" from .importer import Importer, ImportReport from .base import BulkImportException diff --git a/pybossa/importers/base.py b/pybossa/importers/base.py index 0899a4c801..247db58736 100644 --- a/pybossa/importers/base.py +++ b/pybossa/importers/base.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class BulkImportException(Exception): diff --git a/pybossa/importers/csv.py b/pybossa/importers/csv.py index 9e7bd77e34..3dc06e430b 100644 --- a/pybossa/importers/csv.py +++ b/pybossa/importers/csv.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import requests from StringIO import StringIO diff --git a/pybossa/importers/dropbox.py b/pybossa/importers/dropbox.py index 32f8402c3b..33fc24a251 100644 --- a/pybossa/importers/dropbox.py +++ b/pybossa/importers/dropbox.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import string import json diff --git a/pybossa/importers/epicollect.py b/pybossa/importers/epicollect.py index bb5f3bea00..df48745daf 100644 --- a/pybossa/importers/epicollect.py +++ b/pybossa/importers/epicollect.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json import requests diff --git a/pybossa/importers/flickr.py b/pybossa/importers/flickr.py index 93e37de918..4eeb4d7d6f 100644 --- a/pybossa/importers/flickr.py +++ b/pybossa/importers/flickr.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json import requests diff --git a/pybossa/importers/importer.py b/pybossa/importers/importer.py index 49fcf624e5..89930afeb9 100644 --- a/pybossa/importers/importer.py +++ b/pybossa/importers/importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from flask.ext.babel import gettext from .csv import BulkTaskCSVImport, BulkTaskGDImport diff --git a/pybossa/importers/s3.py b/pybossa/importers/s3.py index ff6e824ffa..b31f20d0d6 100644 --- a/pybossa/importers/s3.py +++ b/pybossa/importers/s3.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from .base import BulkTaskImport diff --git a/pybossa/importers/twitterapi.py b/pybossa/importers/twitterapi.py index 904f40b123..6970b1ee82 100644 --- a/pybossa/importers/twitterapi.py +++ b/pybossa/importers/twitterapi.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from twitter import Twitter, OAuth2, oauth2_dance, OAuth, TwitterHTTPError from .base import BulkTaskImport, BulkImportException diff --git a/pybossa/importers/youtubeapi.py b/pybossa/importers/youtubeapi.py index 85a4eda439..3cd0649afa 100644 --- a/pybossa/importers/youtubeapi.py +++ b/pybossa/importers/youtubeapi.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from .base import BulkTaskImport, BulkImportException from flask.ext.babel import gettext from apiclient.discovery import build @@ -58,7 +58,7 @@ def _get_playlist_id(self, url): pattern = re.compile("^(www\.)?youtu(\.be|be\.com)") if not (pattern.match(url_data.hostname)): msg = gettext("URL is not a youtube domain.") - raise BulkImportException(msg) + raise BulkImportException(msg) params = parse_qs(url_data.query) if not ('list' in params): msg = gettext("No playlist in URL found.") diff --git a/pybossa/jobs.py b/pybossa/jobs.py index b99022bcd3..e130528244 100644 --- a/pybossa/jobs.py +++ b/pybossa/jobs.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Jobs module for running background tasks in PyBossa server.""" +# along with PYBOSSA. If not, see . +"""Jobs module for running background tasks in PYBOSSA server.""" from datetime import datetime import math import requests @@ -80,7 +80,7 @@ def enqueue_job(job): return True def enqueue_periodic_jobs(queue_name): - """Enqueue all PyBossa periodic jobs.""" + """Enqueue all PYBOSSA periodic jobs.""" from pybossa.core import sentinel from rq import Queue redis_conn = sentinel.master @@ -194,13 +194,10 @@ def get_inactive_users_jobs(queue='quaterly'): # First users that have participated once but more than 3 months ago sql = text('''SELECT user_id FROM task_run WHERE user_id IS NOT NULL - AND user_id NOT IN - (SELECT user_id FROM task_run WHERE user_id IS NOT NULL AND to_date(task_run.finish_time, 'YYYY-MM-DD\THH24:MI:SS.US') - >= NOW() - '3 month'::INTERVAL - GROUP BY task_run.user_id order by user_id) + >= NOW() - '12 month'::INTERVAL AND to_date(task_run.finish_time, 'YYYY-MM-DD\THH24:MI:SS.US') - >= NOW() - '1 year'::INTERVAL + < NOW() - '3 month'::INTERVAL GROUP BY user_id ORDER BY user_id;''') results = db.slave_session.execute(sql) for row in results: diff --git a/pybossa/model/__init__.py b/pybossa/model/__init__.py index 1e9b5710c8..ed392dadfd 100644 --- a/pybossa/model/__init__.py +++ b/pybossa/model/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import datetime import uuid diff --git a/pybossa/model/auditlog.py b/pybossa/model/auditlog.py index 2629c012aa..eff17f50f3 100644 --- a/pybossa/model/auditlog.py +++ b/pybossa/model/auditlog.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/blogpost.py b/pybossa/model/blogpost.py index e6fad878b9..8a68d27d6f 100644 --- a/pybossa/model/blogpost.py +++ b/pybossa/model/blogpost.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Unicode, UnicodeText, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/category.py b/pybossa/model/category.py index 49de2969e4..4b343754ff 100644 --- a/pybossa/model/category.py +++ b/pybossa/model/category.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/event_listeners.py b/pybossa/model/event_listeners.py index 57017a6918..92b83e38da 100644 --- a/pybossa/model/event_listeners.py +++ b/pybossa/model/event_listeners.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from datetime import datetime from rq import Queue @@ -63,7 +63,7 @@ def add_blog_event(mapper, conn, target): @event.listens_for(Project, 'after_insert') def add_project_event(mapper, conn, target): - """Update PyBossa feed with new project.""" + """Update PYBOSSA feed with new project.""" obj = dict(id=target.id, name=target.name, short_name=target.short_name, @@ -73,7 +73,7 @@ def add_project_event(mapper, conn, target): @event.listens_for(Task, 'after_insert') def add_task_event(mapper, conn, target): - """Update PyBossa feed with new task.""" + """Update PYBOSSA feed with new task.""" sql_query = ('select name, short_name, info from project \ where id=%s') % target.project_id results = conn.execute(sql_query) diff --git a/pybossa/model/project.py b/pybossa/model/project.py index d12af5b5a9..a64fe27e9f 100644 --- a/pybossa/model/project.py +++ b/pybossa/model/project.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Boolean, Unicode, Float, UnicodeText, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/result.py b/pybossa/model/result.py index c54dabbdc4..1854e2c14c 100644 --- a/pybossa/model/result.py +++ b/pybossa/model/result.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Text, Boolean from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/task.py b/pybossa/model/task.py index b2b425b89a..13033cb697 100644 --- a/pybossa/model/task.py +++ b/pybossa/model/task.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Boolean, Float, UnicodeText, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/task_run.py b/pybossa/model/task_run.py index 6715f85215..a74a4434d6 100644 --- a/pybossa/model/task_run.py +++ b/pybossa/model/task_run.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/model/user.py b/pybossa/model/user.py index 7c10d20594..3586054055 100644 --- a/pybossa/model/user.py +++ b/pybossa/model/user.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Boolean, Unicode, Text, String, BigInteger from sqlalchemy.schema import Column, ForeignKey @@ -43,7 +43,7 @@ class User(db.Model, DomainObject, UserMixin): name = Column(Unicode(length=254), unique=True, nullable=False) #: Fullname of the user. fullname = Column(Unicode(length=500), nullable=False) - #: Language used by the user in the PyBossa server. + #: Language used by the user in the PYBOSSA server. locale = Column(Unicode(length=254), default=u'en', nullable=False) api_key = Column(String(length=36), default=make_uuid, unique=True) passwd_hash = Column(Unicode(length=254), unique=True) diff --git a/pybossa/model/webhook.py b/pybossa/model/webhook.py index b1104cb10a..e27bdaa44b 100644 --- a/pybossa/model/webhook.py +++ b/pybossa/model/webhook.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import Integer, Text from sqlalchemy.schema import Column, ForeignKey diff --git a/pybossa/news.py b/pybossa/news.py index 9fa060120c..78e2717a0d 100644 --- a/pybossa/news.py +++ b/pybossa/news.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.core import sentinel from pybossa.core import db try: diff --git a/pybossa/newsletter/__init__.py b/pybossa/newsletter/__init__.py index 2a46645234..c08095d8d8 100644 --- a/pybossa/newsletter/__init__.py +++ b/pybossa/newsletter/__init__.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""PyBossa module for subscribing users to Mailchimp lists.""" +# along with PYBOSSA. If not, see . +"""PYBOSSA module for subscribing users to Mailchimp lists.""" import mailchimp from mailchimp import Error diff --git a/pybossa/oauth_providers.py b/pybossa/oauth_providers.py index ba1f113dd4..5abc41f5a6 100644 --- a/pybossa/oauth_providers.py +++ b/pybossa/oauth_providers.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from flask_oauthlib.client import OAuth diff --git a/pybossa/password_manager.py b/pybossa/password_manager.py index 3a7bcc8841..674ffa847f 100644 --- a/pybossa/password_manager.py +++ b/pybossa/password_manager.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """Module for password protect a project.""" from flask.ext.login import current_user diff --git a/pybossa/pro_features.py b/pybossa/pro_features.py index 0ee982eae1..e2a4ccb48b 100644 --- a/pybossa/pro_features.py +++ b/pybossa/pro_features.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . class ProFeatureHandler(object): diff --git a/pybossa/ratelimit/__init__.py b/pybossa/ratelimit/__init__.py index ea41feec47..6ebfa98bce 100644 --- a/pybossa/ratelimit/__init__.py +++ b/pybossa/ratelimit/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ Rate limit module for limiting the requests in the API. diff --git a/pybossa/repositories/__init__.py b/pybossa/repositories/__init__.py index 66f1b81173..7b562c9a3c 100644 --- a/pybossa/repositories/__init__.py +++ b/pybossa/repositories/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ This package exports repository objects. @@ -33,7 +33,7 @@ a kind and/or saving them to the DB by calling the ORM apropriate methods. For more complex DB queries, refer to other packages or services within -PyBossa. +PYBOSSA. """ import json from pybossa.model.project import Project diff --git a/pybossa/repositories/auditlog_repository.py b/pybossa/repositories/auditlog_repository.py index d4febafa2c..8cb710aeed 100644 --- a/pybossa/repositories/auditlog_repository.py +++ b/pybossa/repositories/auditlog_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.exc import IntegrityError diff --git a/pybossa/repositories/blog_repository.py b/pybossa/repositories/blog_repository.py index 8a41b0c6fd..148417d31f 100644 --- a/pybossa/repositories/blog_repository.py +++ b/pybossa/repositories/blog_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.exc import IntegrityError diff --git a/pybossa/repositories/project_repository.py b/pybossa/repositories/project_repository.py index 8ddf80e6bf..a83b92fb2c 100644 --- a/pybossa/repositories/project_repository.py +++ b/pybossa/repositories/project_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.exc import IntegrityError from sqlalchemy import cast, Date diff --git a/pybossa/repositories/result_repository.py b/pybossa/repositories/result_repository.py index 967bd486c3..f97b769562 100644 --- a/pybossa/repositories/result_repository.py +++ b/pybossa/repositories/result_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.exc import IntegrityError from sqlalchemy import cast, Date from pybossa.repositories import Repository diff --git a/pybossa/repositories/task_repository.py b/pybossa/repositories/task_repository.py index 38603b7991..7e673f2ab2 100644 --- a/pybossa/repositories/task_repository.py +++ b/pybossa/repositories/task_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.exc import IntegrityError from sqlalchemy import cast, Date diff --git a/pybossa/repositories/user_repository.py b/pybossa/repositories/user_repository.py index 5b445c9432..0c5ac4bc85 100644 --- a/pybossa/repositories/user_repository.py +++ b/pybossa/repositories/user_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import or_, func from sqlalchemy.exc import IntegrityError diff --git a/pybossa/repositories/webhook_repository.py b/pybossa/repositories/webhook_repository.py index f76b9b1230..130b551ac9 100644 --- a/pybossa/repositories/webhook_repository.py +++ b/pybossa/repositories/webhook_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy.exc import IntegrityError diff --git a/pybossa/s3_client.py b/pybossa/s3_client.py index 91718a8e31..509c3d611d 100644 --- a/pybossa/s3_client.py +++ b/pybossa/s3_client.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import requests from xml.dom import minidom diff --git a/pybossa/sched.py b/pybossa/sched.py index 01b23c637c..57535a433b 100644 --- a/pybossa/sched.py +++ b/pybossa/sched.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Scheduler module for PyBossa tasks.""" +# along with PYBOSSA. If not, see . +"""Scheduler module for PYBOSSA tasks.""" from sqlalchemy.sql import text from pybossa.model.task import Task from pybossa.model.task_run import TaskRun diff --git a/pybossa/sentinel/__init__.py b/pybossa/sentinel/__init__.py index 3c34713c09..64173009de 100644 --- a/pybossa/sentinel/__init__.py +++ b/pybossa/sentinel/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from redis import sentinel, StrictRedis diff --git a/pybossa/signer/__init__.py b/pybossa/signer/__init__.py index 6b83dfa6af..f8249bd396 100644 --- a/pybossa/signer/__init__.py +++ b/pybossa/signer/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from itsdangerous import URLSafeTimedSerializer from werkzeug import generate_password_hash, check_password_hash diff --git a/pybossa/themes/default b/pybossa/themes/default index 23ef3c10af..86c7282417 160000 --- a/pybossa/themes/default +++ b/pybossa/themes/default @@ -1 +1 @@ -Subproject commit 23ef3c10affe5db85d02cb60f60bb5dae1a591f9 +Subproject commit 86c7282417e4cdaeb6551946513857e5ec840639 diff --git a/pybossa/uploader/__init__.py b/pybossa/uploader/__init__.py index d3ec586d3c..133f64364c 100644 --- a/pybossa/uploader/__init__.py +++ b/pybossa/uploader/__init__.py @@ -1,23 +1,23 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ -Uploader module for uploading files to PyBossa. +Uploader module for uploading files to PYBOSSA. This module exports: * Uploader class: for uploading files. diff --git a/pybossa/uploader/local.py b/pybossa/uploader/local.py index be978d866e..6c4bef1cd4 100644 --- a/pybossa/uploader/local.py +++ b/pybossa/uploader/local.py @@ -1,23 +1,23 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ -Local module for uploading files to a PyBossa local filesystem. +Local module for uploading files to a PYBOSSA local filesystem. This module exports: * Local class: for uploading files to a local filesystem. @@ -44,10 +44,10 @@ def init_app(self, app): abs_path_app_context = os.path.join(app.root_path, self.upload_folder) abs_upload_path_pybossa = os.path.join(os.path.dirname(app.root_path), self.upload_folder) # ../uploads # If we have an existing relative path to the app context use this. - # In PyBossa there is normally no pybossa/uploads folder. + # In PYBOSSA there is normally no pybossa/uploads folder. if os.path.isdir(abs_path_app_context): self.upload_folder = abs_path_app_context - # otherwise use the PyBossa ../uploads path (standard) + # otherwise use the PYBOSSA ../uploads path (standard) elif os.path.isdir(abs_upload_path_pybossa): self.upload_folder = abs_upload_path_pybossa else: diff --git a/pybossa/uploader/rackspace.py b/pybossa/uploader/rackspace.py index 223241c660..fbbea3e9e8 100644 --- a/pybossa/uploader/rackspace.py +++ b/pybossa/uploader/rackspace.py @@ -1,23 +1,23 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts """ -Local module for uploading files to a PyBossa local filesystem. +Local module for uploading files to a PYBOSSA local filesystem. This module exports: * Local class: for uploading files to a local filesystem. diff --git a/pybossa/util.py b/pybossa/util.py index 4fb0124bc6..3b68a6a5b4 100644 --- a/pybossa/util.py +++ b/pybossa/util.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Module with PyBossa utils.""" +# along with PYBOSSA. If not, see . +"""Module with PYBOSSA utils.""" from datetime import timedelta, datetime from functools import update_wrapper import csv @@ -23,6 +23,7 @@ import cStringIO from flask import abort, request, make_response, current_app from flask import render_template, jsonify +from flask_wtf.csrf import generate_csrf from functools import wraps from flask.ext.login import current_user from math import ceil @@ -33,7 +34,10 @@ def handle_content_type(data): """Return HTML or JSON based on request type.""" if request.headers['Content-Type'] == 'application/json': if 'form' in data.keys(): - del data['form'] + tmp = data['form'] + data['form'] = tmp.data + data['form']['csrf'] = generate_csrf() + data['form']['errors'] = tmp.errors if 'pagination' in data.keys(): pagination = data['pagination'].to_json() data['pagination'] = pagination @@ -77,51 +81,6 @@ def decorated_function(*args, **kwargs): return decorated_function -# from http://flask.pocoo.org/snippets/56/ -def crossdomain(origin=None, methods=None, headers=None, - max_age=21600, attach_to_all=True, - automatic_options=True): - """Crossdomain decorator.""" - if methods is not None: # pragma: no cover - methods = ', '.join(sorted(x.upper() for x in methods)) - if headers is not None and not isinstance(headers, basestring): - headers = ', '.join(x.upper() for x in headers) - if not isinstance(origin, basestring): # pragma: no cover - origin = ', '.join(origin) - if isinstance(max_age, timedelta): # pragma: no cover - max_age = max_age.total_seconds() - - def get_methods(): # pragma: no cover - if methods is not None: - return methods - - options_resp = current_app.make_default_options_response() - return options_resp.headers['allow'] - - def decorator(f): - - def wrapped_function(*args, **kwargs): - if automatic_options and request.method == 'OPTIONS': # pragma: no cover - resp = current_app.make_default_options_response() - else: - resp = make_response(f(*args, **kwargs)) - if not attach_to_all and request.method != 'OPTIONS': # pragma: no cover - return resp - - h = resp.headers - - h['Access-Control-Allow-Origin'] = origin - h['Access-Control-Allow-Methods'] = get_methods() - h['Access-Control-Max-Age'] = str(max_age) - if headers is not None: - h['Access-Control-Allow-Headers'] = headers - return resp - - f.provide_automatic_options = False - return update_wrapper(wrapped_function, f) - return decorator - - # Fromhttp://stackoverflow.com/q/1551382 def pretty_date(time=False): """Return a pretty date. diff --git a/pybossa/view/__init__.py b/pybossa/view/__init__.py index 1555cea53e..686984e8f0 100644 --- a/pybossa/view/__init__.py +++ b/pybossa/view/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/pybossa/view/account.py b/pybossa/view/account.py index 05f84e77c0..7bab8a864f 100644 --- a/pybossa/view/account.py +++ b/pybossa/view/account.py @@ -1,28 +1,28 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa Account view for web projects. +PYBOSSA Account view for web projects. This module exports the following endpoints: - * Accounts index: list of all registered users in PyBossa - * Signin: method for signin into PyBossa - * Signout: method for signout from PyBossa - * Register: method for creating a new PyBossa account + * Accounts index: list of all registered users in PYBOSSA + * Signin: method for signin into PYBOSSA + * Signout: method for signout from PYBOSSA + * Register: method for creating a new PYBOSSA account * Profile: method to manage user's profile (update data, reset password...) """ @@ -84,7 +84,7 @@ def index(page): @blueprint.route('/signin', methods=['GET', 'POST']) def signin(): """ - Signin method for PyBossa users. + Signin method for PYBOSSA users. Returns a Jinja2 template with the result of signing process. @@ -143,9 +143,9 @@ def _sign_in_user(user): @blueprint.route('/signout') def signout(): """ - Signout PyBossa users. + Signout PYBOSSA users. - Returns a redirection to PyBossa home page. + Returns a redirection to PYBOSSA home page. """ logout_user() @@ -191,12 +191,12 @@ def confirm_email(): @blueprint.route('/register', methods=['GET', 'POST']) def register(): """ - Register method for creating a PyBossa account. + Register method for creating a PYBOSSA account. Returns a Jinja2 template """ - form = RegisterForm(request.form) + form = RegisterForm(request.body) if request.method == 'POST' and form.validate(): account = dict(fullname=form.fullname.data, name=form.name.data, email_addr=form.email_addr.data, @@ -213,15 +213,16 @@ def register(): return render_template('account/account_validation.html') if request.method == 'POST' and not form.validate(): flash(gettext('Please correct the errors'), 'error') - return render_template('account/register.html', - title=gettext("Register"), form=form) + data = dict(template='account/register.html', + title=gettext("Register"), form=form) + return handle_content_type(data) @blueprint.route('/newsletter') @login_required def newsletter_subscribe(): """ - Register method for subscribing user to PyBossa newsletter. + Register method for subscribing user to PYBOSSA newsletter. Returns a Jinja2 template diff --git a/pybossa/view/admin.py b/pybossa/view/admin.py index 4f8e28394b..92b031fc00 100644 --- a/pybossa/view/admin.py +++ b/pybossa/view/admin.py @@ -1,21 +1,21 @@ # -* -coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Admin view for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Admin view for PYBOSSA.""" from rq import Queue from flask import Blueprint from flask import render_template @@ -74,7 +74,7 @@ def index(): @login_required @admin_required def featured(project_id=None): - """List featured projects of PyBossa.""" + """List featured projects of PYBOSSA.""" try: if request.method == 'GET': categories = cached_cat.get_all() @@ -121,7 +121,7 @@ def featured(project_id=None): @login_required @admin_required def users(user_id=None): - """Manage users of PyBossa.""" + """Manage users of PYBOSSA.""" form = SearchForm(request.form) users = [user for user in user_repo.filter_by(admin=True) if user.id != current_user.id] @@ -368,7 +368,7 @@ def update_category(id): @login_required @admin_required def dashboard(): - """Show PyBossa Dashboard.""" + """Show PYBOSSA Dashboard.""" try: if request.args.get('refresh') == '1': db_jobs = get_dashboard_jobs() diff --git a/pybossa/view/amazon.py b/pybossa/view/amazon.py index 0b5235dbb8..19da319e84 100644 --- a/pybossa/view/amazon.py +++ b/pybossa/view/amazon.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Amazon view for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Amazon view for PYBOSSA.""" import json from flask import Blueprint, Response from pybossa.s3_client import S3Client, NoSuchBucket, PrivateBucket diff --git a/pybossa/view/facebook.py b/pybossa/view/facebook.py index df89649eed..cd7889a86f 100644 --- a/pybossa/view/facebook.py +++ b/pybossa/view/facebook.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . -"""Facebook view for PyBossa.""" +"""Facebook view for PYBOSSA.""" from flask import Blueprint, request, url_for, flash, redirect, session, current_app from flask.ext.login import login_user, current_user from flask_oauthlib.client import OAuthException diff --git a/pybossa/view/flickr.py b/pybossa/view/flickr.py index 08d782574b..5725d9189f 100644 --- a/pybossa/view/flickr.py +++ b/pybossa/view/flickr.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Flickr view for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Flickr view for PYBOSSA.""" import json from flask import (Blueprint, request, url_for, flash, redirect, session, current_app, Response) @@ -82,4 +82,4 @@ def _save_credentials(session, token, user): def _remove_credentials(session): """Remove user credentials from session.""" session.pop('flickr_token', None) - session.pop('flickr_user', None) \ No newline at end of file + session.pop('flickr_user', None) diff --git a/pybossa/view/google.py b/pybossa/view/google.py index 427da30e32..71f35af07e 100644 --- a/pybossa/view/google.py +++ b/pybossa/view/google.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . -"""Google view for PyBossa.""" +"""Google view for PYBOSSA.""" from flask import Blueprint, request, url_for, flash, redirect, session, current_app from flask.ext.login import login_user, current_user from flask_oauthlib.client import OAuthException diff --git a/pybossa/view/help.py b/pybossa/view/help.py index a1772dccef..6faab2d699 100644 --- a/pybossa/view/help.py +++ b/pybossa/view/help.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Help view for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Help view for PYBOSSA.""" from flask import Blueprint from flask import render_template from pybossa.cache import projects as cached_projects diff --git a/pybossa/view/home.py b/pybossa/view/home.py index 51a6bcaae7..0042a7a9cb 100644 --- a/pybossa/view/home.py +++ b/pybossa/view/home.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Home view for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Home view for PYBOSSA.""" from flask import current_app, abort from flask.ext.login import current_user from pybossa.model.category import Category diff --git a/pybossa/view/leaderboard.py b/pybossa/view/leaderboard.py index 29274a4e2e..4161650a9d 100644 --- a/pybossa/view/leaderboard.py +++ b/pybossa/view/leaderboard.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Leaderboard view for PyBossa.""" +# along with PYBOSSA. If not, see . +"""Leaderboard view for PYBOSSA.""" from flask import Blueprint, current_app from flask import render_template from flask.ext.login import current_user diff --git a/pybossa/view/projects.py b/pybossa/view/projects.py index f5bbbc9909..4f445d557c 100644 --- a/pybossa/view/projects.py +++ b/pybossa/view/projects.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import time import re @@ -261,7 +261,7 @@ def _description_from_long_description(): '' + gettext('Guide and Documentation') + ' ' + - gettext('for adding tasks, a thumbnail, using PyBossa.JS, etc.'), + gettext('for adding tasks, a thumbnail, using PYBOSSA.JS, etc.'), 'info') auditlogger.add_log_entry(None, project, current_user) diff --git a/pybossa/view/stats.py b/pybossa/view/stats.py index 81dbaf37f9..485406bee8 100644 --- a/pybossa/view/stats.py +++ b/pybossa/view/stats.py @@ -1,21 +1,21 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . -"""Stats view on PyBossa.""" +# along with PYBOSSA. If not, see . +"""Stats view on PYBOSSA.""" import json from flask import Blueprint from flask import render_template diff --git a/pybossa/view/twitter.py b/pybossa/view/twitter.py index abc823e110..a65053b372 100644 --- a/pybossa/view/twitter.py +++ b/pybossa/view/twitter.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . -"""Twitter view for PyBossa.""" +"""Twitter view for PYBOSSA.""" from flask import Blueprint, request, url_for, flash, redirect, current_app from flask.ext.login import login_user, current_user from flask_oauthlib.client import OAuthException diff --git a/pybossa/view/uploads.py b/pybossa/view/uploads.py index d852c0147b..fceb26461f 100644 --- a/pybossa/view/uploads.py +++ b/pybossa/view/uploads.py @@ -1,22 +1,22 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ -PyBossa Uploads view for LocalUploader application. +PYBOSSA Uploads view for LocalUploader application. This module serves uploaded content like avatars. diff --git a/pybossa/vmcp.py b/pybossa/vmcp.py index 181f12d3d1..054d47bd0a 100644 --- a/pybossa/vmcp.py +++ b/pybossa/vmcp.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """VMCP module to support CernVM. Sign the data in the given dictionary and return a new hash diff --git a/run.py b/run.py index be52248c13..5ef727ceae 100644 --- a/run.py +++ b/run.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.core import create_app if __name__ == "__main__": # pragma: no cover diff --git a/settings_local.py.tmpl b/settings_local.py.tmpl index 2499fb28c3..555d953264 100644 --- a/settings_local.py.tmpl +++ b/settings_local.py.tmpl @@ -189,3 +189,13 @@ PRO_FEATURES = { # Libsass style. You can use nested, expanded, compact and compressed LIBSASS_STYLE = 'compressed' + +# CORS resources configuration. +# WARNING: Only modify this if you know what you are doing. The below config +# are the defaults, allowing PYBOSSA to have full CORS api. +# For more options, check the Flask-Cors documentation: https://flask-cors.readthedocs.io/en/latest/ +# CORS_RESOURCES = {r"/api/*": {"origins": "*", +# "allow_headers": ['Content-Type', +# 'Authorization'], +# "methods": "*" +# }} diff --git a/settings_test.py b/settings_test.py index f8f1fb54fe..2874f020ab 100644 --- a/settings_test.py +++ b/settings_test.py @@ -20,7 +20,7 @@ MAIL_PASSWORD = None MAIL_PORT = 25 MAIL_FAIL_SILENTLY = False -MAIL_DEFAULT_SENDER = 'PyBossa Support ' +MAIL_DEFAULT_SENDER = 'PYBOSSA Support ' ANNOUNCEMENT = {'admin': 'Root Message', 'user': 'User Message', 'owner': 'Owner Message'} LOCALES = [('en', 'English'), ('es', u'Español'), ('it', 'Italiano'), ('fr', u'Français'), @@ -37,7 +37,7 @@ MAIL_PASSWORD = None MAIL_PORT = 25 MAIL_FAIL_SILENTLY = False -MAIL_DEFAULT_SENDER = 'PyBossa Support ' +MAIL_DEFAULT_SENDER = 'PYBOSSA Support ' ALLOWED_EXTENSIONS = ['js', 'css', 'png', 'jpg', 'jpeg', 'gif', 'zip'] UPLOAD_FOLDER = '/tmp/' UPLOAD_METHOD = 'local' diff --git a/setup.cfg b/setup.cfg index 37367e3306..65673db2b4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [nosetests] verbosity=3 rednose=1 -with-coverage=1 -cover-erase=1 -cover-package=pybossa +with-cov=1 +cov-report=html +cov=pybossa nologcapture=1 diff --git a/setup.py b/setup.py index 05635d3402..789884df5e 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ "redis>=2.9, <2.10", "sphinx>=1.2.2, <2.0", "coverage", + "nose-cov", "mock", "pyrax>=1.9.6, <2.0", "pillow>=3.0, <3.1", @@ -51,7 +52,9 @@ "Flask-Assets", "jsmin", "libsass", - "pyjwt" + "pyjwt", + "flask_json_multidict", + "flask-cors>=3.0.2, <3.0.3" ] setup( @@ -65,16 +68,16 @@ # Example: # dependency_links = ['git+https://github.com/Hypernode/M2Crypto#egg=M2Crypto-0.22.dev'], dependency_links = ['git+https://github.com/maxcountryman/flask-login.git@13af160b3fd14dfb5f35f9cdc3863771efe194eb#egg=Flask-Login', - 'git+https://github.com/PyBossa/rq-dashboard.git#egg=rq-dashboard'], + 'git+https://github.com/Scifabric/rq-dashboard.git#egg=rq-dashboard'], # metadata for upload to PyPI - author = 'SciFabric LTD', + author = 'Scifabric LTD', author_email = 'info@scifabric.com', description = 'Open Source CrowdSourcing framework', - long_description = '''PyBossa is an open source crowdsourcing solution for volunteer computing, thinking and sensing ''', + long_description = '''PYBOSSA is the ultimate crowdsourcing framework to analyze or enrich data that can't be processed by machines alone.''', license = 'AGPLv3', url = 'http://pybossa.com', - download_url = 'https://github.com/PyBossa/pybossa', + download_url = 'https://github.com/Scifabric/pybossa', include_package_data = True, classifiers = [ 'Development Status :: 5 - Production/Stable', diff --git a/test/default.py b/test/default.py index 53d7905397..bed3c0c50b 100644 --- a/test/default.py +++ b/test/default.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from sqlalchemy import text from pybossa.core import db diff --git a/test/factories/__init__.py b/test/factories/__init__.py index c8949ad906..e4519ef634 100644 --- a/test/factories/__init__.py +++ b/test/factories/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.core import db diff --git a/test/factories/auditlog_factory.py b/test/factories/auditlog_factory.py index ba747a0d57..6ead0d72dd 100644 --- a/test/factories/auditlog_factory.py +++ b/test/factories/auditlog_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.auditlog import Auditlog from . import BaseFactory, factory, auditlog_repo diff --git a/test/factories/blogpost_factory.py b/test/factories/blogpost_factory.py index bccfc2f35b..3822ed8dfa 100644 --- a/test/factories/blogpost_factory.py +++ b/test/factories/blogpost_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.blogpost import Blogpost from . import BaseFactory, factory, blog_repo diff --git a/test/factories/category_factory.py b/test/factories/category_factory.py index 6314dfa0f1..05bba1222e 100644 --- a/test/factories/category_factory.py +++ b/test/factories/category_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.category import Category from . import BaseFactory, factory, project_repo diff --git a/test/factories/project_factory.py b/test/factories/project_factory.py index 92a7f02acc..2f41b4088c 100644 --- a/test/factories/project_factory.py +++ b/test/factories/project_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.project import Project from . import BaseFactory, factory, project_repo diff --git a/test/factories/task_factory.py b/test/factories/task_factory.py index 28a21b1bda..756b3cb97b 100644 --- a/test/factories/task_factory.py +++ b/test/factories/task_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.task import Task from . import BaseFactory, factory, task_repo diff --git a/test/factories/taskrun_factory.py b/test/factories/taskrun_factory.py index 759f77981a..136c2929fb 100644 --- a/test/factories/taskrun_factory.py +++ b/test/factories/taskrun_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.task_run import TaskRun from . import BaseFactory, factory, task_repo diff --git a/test/factories/user_factory.py b/test/factories/user_factory.py index d004b56be4..a737c14b0b 100644 --- a/test/factories/user_factory.py +++ b/test/factories/user_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.user import User from . import BaseFactory, factory, user_repo diff --git a/test/factories/webhook_factory.py b/test/factories/webhook_factory.py index e1711cba84..b040d6c05b 100644 --- a/test/factories/webhook_factory.py +++ b/test/factories/webhook_factory.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.model.webhook import Webhook from . import BaseFactory, factory, webhook_repo diff --git a/test/helper/__init__.py b/test/helper/__init__.py index 1555cea53e..686984e8f0 100644 --- a/test/helper/__init__.py +++ b/test/helper/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/test/helper/sched.py b/test/helper/sched.py index 0f3a9729e8..eddccc2d77 100644 --- a/test/helper/sched.py +++ b/test/helper/sched.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from helper import web from default import model, db diff --git a/test/helper/web.py b/test/helper/web.py index b56a091d5c..84703c602b 100644 --- a/test/helper/web.py +++ b/test/helper/web.py @@ -1,27 +1,29 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . +import json from mock import patch from default import Test, db, Fixtures, with_context from pybossa.model.category import Category from pybossa.model.task import Task from pybossa.model.task_run import TaskRun +from werkzeug.http import parse_cookie class Helper(Test): @@ -31,9 +33,9 @@ class Helper(Test): def html_title(self, title=None): """Helper function to create an HTML title""" if title is None: - return "PyBossa - PyBossa by Scifabric" + return "PYBOSSA - PyBossa by Scifabric" else: - return "PyBossa · %s - PyBossa by Scifabric" % title + return "PYBOSSA · %s - PyBossa by Scifabric" % title @patch('pybossa.view.account.signer') def register(self, mock, fullname="John Doe", name="johndoe", @@ -202,3 +204,20 @@ def update_project(self, method="POST", short_name="sampleapp", id=1, else: return self.app.get("/project/%s/update" % short_name, follow_redirects=True) + + def get_csrf(self, endpoint): + """Return csrf token for endpoint.""" + res = self.app.get(endpoint, + content_type='application/json') + csrf = json.loads(res.data).get('form').get('csrf') + return csrf + + def check_cookie(self, response, name): + # Checks for existence of a cookie and verifies the value of it + cookies = response.headers.getlist('Set-Cookie') + for cookie in cookies: + c_key, c_value = parse_cookie(cookie).items()[0] + if c_key == name: + return c_value + # Cookie not found + return False diff --git a/test/test_activity_update.py b/test/test_activity_update.py index 13163d01ab..acefe56172 100644 --- a/test/test_activity_update.py +++ b/test/test_activity_update.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context from pybossa.view.account import get_update_feed diff --git a/test/test_admin.py b/test/test_admin.py index 3385bf52db..7b51d20ae9 100644 --- a/test/test_admin.py +++ b/test/test_admin.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from helper import web diff --git a/test/test_admin_export_users.py b/test/test_admin_export_users.py index d1eab496e1..8cd43cf4c9 100644 --- a/test/test_admin_export_users.py +++ b/test/test_admin_export_users.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json import StringIO diff --git a/test/test_api/__init__.py b/test/test_api/__init__.py index 576519b0be..474230b8d2 100644 --- a/test/test_api/__init__.py +++ b/test/test_api/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context from factories import reset_all_pk_sequences diff --git a/test/test_api/test_api_common.py b/test/test_api/test_api_common.py index fb136fce0f..44f62fa9cf 100644 --- a/test/test_api/test_api_common.py +++ b/test/test_api/test_api_common.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import with_context from nose.tools import assert_equal, assert_raises @@ -233,13 +233,21 @@ def test_jsonpify(self): def test_cors(self): """Test CORS decorator works.""" - res = self.app.get('/api/project/1') + res = self.app.options('/api/project/1', + headers={'Access-Control-Request-Method': 'GET', + 'Access-Control-Request-Headers': 'Authorization', + }) err_msg = "CORS should be enabled" - print res.headers assert res.headers['Access-Control-Allow-Origin'] == '*', err_msg methods = ['PUT', 'HEAD', 'DELETE', 'OPTIONS', 'GET'] for m in methods: + err_msg = "Access-Control-Allow-Methods: %s is missing" % m assert m in res.headers['Access-Control-Allow-Methods'], err_msg assert res.headers['Access-Control-Max-Age'] == '21600', err_msg - headers = 'CONTENT-TYPE, AUTHORIZATION' - assert res.headers['Access-Control-Allow-Headers'] == headers, err_msg + test_headers = ['Content-Type', 'Authorization'] + for header in test_headers: + err_msg = "Access-Control-Allow-Headers: %s is missing" % header + headers={'Access-Control-Request-Method': 'GET', + 'Access-Control-Request-Headers': header} + res = self.app.options('/api/project/1', headers=headers) + assert res.headers['Access-Control-Allow-Headers'] == header, err_msg diff --git a/test/test_api/test_category_api.py b/test/test_api/test_category_api.py index cc389a9f58..cd3778b74d 100644 --- a/test/test_api/test_category_api.py +++ b/test/test_api/test_category_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import db, with_context from nose.tools import assert_equal diff --git a/test/test_api/test_global_stats_api.py b/test/test_api/test_global_stats_api.py index 779f606345..d515b8d0d7 100644 --- a/test/test_api/test_global_stats_api.py +++ b/test/test_api/test_global_stats_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from test_api import TestAPI from factories import ProjectFactory diff --git a/test/test_api/test_jwt.py b/test/test_api/test_jwt.py index 48273fcbce..a109d6eafc 100644 --- a/test/test_api/test_jwt.py +++ b/test/test_api/test_jwt.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import flask_app, with_context from mock import patch, Mock diff --git a/test/test_api/test_project_api.py b/test/test_api/test_project_api.py index c52dca1ec5..a3de98ca54 100644 --- a/test/test_api/test_project_api.py +++ b/test/test_api/test_project_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from mock import patch, call from default import db, with_context diff --git a/test/test_api/test_result.py b/test/test_api/test_result.py index 2c2cfde402..50597d4e4b 100644 --- a/test/test_api/test_result.py +++ b/test/test_api/test_result.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import db, with_context from nose.tools import assert_equal diff --git a/test/test_api/test_task_api.py b/test/test_api/test_task_api.py index 7b66a3d4bf..f0de850dff 100644 --- a/test/test_api/test_task_api.py +++ b/test/test_api/test_task_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import db, with_context from nose.tools import assert_equal diff --git a/test/test_api/test_taskrun_api.py b/test/test_api/test_taskrun_api.py index e304571861..ae7ef53d6f 100644 --- a/test/test_api/test_taskrun_api.py +++ b/test/test_api/test_taskrun_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import with_context, mock_contributions_guard from nose.tools import assert_equal diff --git a/test/test_api/test_token_api.py b/test/test_api/test_token_api.py index 00b574bb8b..98920b49d1 100644 --- a/test/test_api/test_token_api.py +++ b/test/test_api/test_token_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # # Copyright (C) 2013 SF Isle of Man Limited # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import with_context from nose.tools import assert_equal, assert_raises diff --git a/test/test_api/test_user_api.py b/test/test_api/test_user_api.py index 854a4cd99f..e333a5884a 100644 --- a/test/test_api/test_user_api.py +++ b/test/test_api/test_user_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import with_context from nose.tools import assert_raises diff --git a/test/test_api/test_vmcp_api.py b/test/test_api/test_vmcp_api.py index 0e45e7fb9f..abd9a1c4f3 100644 --- a/test/test_api/test_vmcp_api.py +++ b/test/test_api/test_vmcp_api.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import flask_app, with_context from mock import patch, Mock diff --git a/test/test_auditlog.py b/test/test_auditlog.py index acbbbd6895..a9583a55ff 100644 --- a/test/test_auditlog.py +++ b/test/test_auditlog.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from default import db, Test, with_context from collections import namedtuple diff --git a/test/test_authentication.py b/test/test_authentication.py index 9086e532fc..060e5801a2 100644 --- a/test/test_authentication.py +++ b/test/test_authentication.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import jwt from default import Test, with_context diff --git a/test/test_authorization/__init__.py b/test/test_authorization/__init__.py index c1b4db4374..03176888be 100644 --- a/test/test_authorization/__init__.py +++ b/test/test_authorization/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import assert_not_raises from mock import Mock, patch, PropertyMock diff --git a/test/test_authorization/test_auditlog_auth.py b/test/test_authorization/test_auditlog_auth.py index e7ed6d3054..d02b3425e6 100644 --- a/test/test_authorization/test_auditlog_auth.py +++ b/test/test_authorization/test_auditlog_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_blogpost_auth.py b/test/test_authorization/test_blogpost_auth.py index 3dd0c1f6a3..ccf201a562 100644 --- a/test/test_authorization/test_blogpost_auth.py +++ b/test/test_authorization/test_blogpost_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_category_auth.py b/test/test_authorization/test_category_auth.py index 31148f610b..eda6e65202 100644 --- a/test/test_authorization/test_category_auth.py +++ b/test/test_authorization/test_category_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_project_auth.py b/test/test_authorization/test_project_auth.py index ed307f3bb9..a0b953da72 100644 --- a/test/test_authorization/test_project_auth.py +++ b/test/test_authorization/test_project_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_result_auth.py b/test/test_authorization/test_result_auth.py index c1e81eaaa2..c845d0bd60 100644 --- a/test/test_authorization/test_result_auth.py +++ b/test/test_authorization/test_result_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises, db from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_task_auth.py b/test/test_authorization/test_task_auth.py index c5d8afc2f5..4260889f44 100644 --- a/test/test_authorization/test_task_auth.py +++ b/test/test_authorization/test_task_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_taskrun_auth.py b/test/test_authorization/test_taskrun_auth.py index 7b1ced53b1..7018bd210c 100644 --- a/test/test_authorization/test_taskrun_auth.py +++ b/test/test_authorization/test_taskrun_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_token_auth.py b/test/test_authorization/test_token_auth.py index 7d1ab4498e..4cd78662c2 100644 --- a/test/test_authorization/test_token_auth.py +++ b/test/test_authorization/test_token_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_user_auth.py b/test/test_authorization/test_user_auth.py index 153ee89829..2dc62f07a7 100644 --- a/test/test_authorization/test_user_auth.py +++ b/test/test_authorization/test_user_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_authorization/test_webhooks_auth.py b/test/test_authorization/test_webhooks_auth.py index eaa5a9da25..0bdf795b06 100644 --- a/test/test_authorization/test_webhooks_auth.py +++ b/test/test_authorization/test_webhooks_auth.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, assert_not_raises from pybossa.auth import ensure_authorized_to diff --git a/test/test_autoimporter.py b/test/test_autoimporter.py index f885e938b6..e94cfbcad1 100644 --- a/test/test_autoimporter.py +++ b/test/test_autoimporter.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import db from helper import web from pybossa.jobs import import_tasks diff --git a/test/test_cache/__init__.py b/test/test_cache/__init__.py index 069aa14f8b..f171cdb99d 100644 --- a/test/test_cache/__init__.py +++ b/test/test_cache/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import hashlib from mock import patch diff --git a/test/test_cache/test_cache_categories.py b/test/test_cache/test_cache_categories.py index e38760fe79..fe5167aa81 100644 --- a/test/test_cache/test_cache_categories.py +++ b/test/test_cache/test_cache_categories.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test from pybossa.cache import categories as cached_categories diff --git a/test/test_cache/test_cache_helpers.py b/test/test_cache/test_cache_helpers.py index 283bf3406b..816fed886a 100644 --- a/test/test_cache/test_cache_helpers.py +++ b/test/test_cache/test_cache_helpers.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context from factories import (ProjectFactory, TaskFactory, TaskRunFactory, diff --git a/test/test_cache/test_cache_project_stats.py b/test/test_cache/test_cache_project_stats.py index 86bc503a7b..68a6c04e02 100644 --- a/test/test_cache/test_cache_project_stats.py +++ b/test/test_cache/test_cache_project_stats.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context from pybossa.cache.project_stats import * diff --git a/test/test_cache/test_cache_projects.py b/test/test_cache/test_cache_projects.py index 245924dd2b..05e801d878 100644 --- a/test/test_cache/test_cache_projects.py +++ b/test/test_cache/test_cache_projects.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context from pybossa.cache import projects as cached_projects diff --git a/test/test_cache/test_cache_users.py b/test/test_cache/test_cache_users.py index db12283974..030147686b 100644 --- a/test/test_cache/test_cache_users.py +++ b/test/test_cache/test_cache_users.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test from pybossa.cache import users as cached_users diff --git a/test/test_cache/test_site_stats.py b/test/test_cache/test_site_stats.py index 986c6c2b7f..7916392554 100644 --- a/test/test_cache/test_site_stats.py +++ b/test/test_cache/test_site_stats.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import datetime from default import db, Test diff --git a/test/test_ckan.py b/test/test_ckan.py index d4b2711211..b77142ae7c 100644 --- a/test/test_ckan.py +++ b/test/test_ckan.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from mock import patch diff --git a/test/test_contributions_guard.py b/test/test_contributions_guard.py index 3dcc087190..634d97f614 100644 --- a/test/test_contributions_guard.py +++ b/test/test_contributions_guard.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from redis import StrictRedis from pybossa.contributions_guard import ContributionsGuard diff --git a/test/test_cookies.py b/test/test_cookies.py index 47b0eb495c..0afe118bfd 100644 --- a/test/test_cookies.py +++ b/test/test_cookies.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.cookies import CookieHandler from mock import MagicMock diff --git a/test/test_flickr_client.py b/test/test_flickr_client.py index 6ace27446a..710883f476 100644 --- a/test/test_flickr_client.py +++ b/test/test_flickr_client.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch, MagicMock from flask import Response, session diff --git a/test/test_forms.py b/test/test_forms.py index 392e007672..b56b85c51b 100644 --- a/test/test_forms.py +++ b/test/test_forms.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from wtforms import ValidationError from nose.tools import raises diff --git a/test/test_hateoas.py b/test/test_hateoas.py index 40e57c7312..4746f9b11d 100644 --- a/test/test_hateoas.py +++ b/test/test_hateoas.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json diff --git a/test/test_i18n.py b/test/test_i18n.py index 4b671c82b4..e0a0eefd70 100644 --- a/test/test_i18n.py +++ b/test/test_i18n.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from helper import web from default import db diff --git a/test/test_importers/__init__.py b/test/test_importers/__init__.py index 92ee1d8635..745f485318 100644 --- a/test/test_importers/__init__.py +++ b/test/test_importers/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch, Mock from pybossa.importers import Importer diff --git a/test/test_importers/test_csv_importer.py b/test/test_importers/test_csv_importer.py index 11f4e09e0b..899590e681 100644 --- a/test/test_importers/test_csv_importer.py +++ b/test/test_importers/test_csv_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch from nose.tools import assert_raises diff --git a/test/test_importers/test_dropbox_importer.py b/test/test_importers/test_dropbox_importer.py index af0c373304..46b60c9eaf 100644 --- a/test/test_importers/test_dropbox_importer.py +++ b/test/test_importers/test_dropbox_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import string from pybossa.importers import BulkImportException diff --git a/test/test_importers/test_epicollect_importer.py b/test/test_importers/test_epicollect_importer.py index d03bf40d05..ae73bffee6 100644 --- a/test/test_importers/test_epicollect_importer.py +++ b/test/test_importers/test_epicollect_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from mock import patch diff --git a/test/test_importers/test_flickr_importer.py b/test/test_importers/test_flickr_importer.py index 57a3f48a19..4b0cb8880a 100644 --- a/test/test_importers/test_flickr_importer.py +++ b/test/test_importers/test_flickr_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import copy import json diff --git a/test/test_importers/test_googledocs_importer.py b/test/test_importers/test_googledocs_importer.py index 15b9f20be6..9d93b9201c 100644 --- a/test/test_importers/test_googledocs_importer.py +++ b/test/test_importers/test_googledocs_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch from nose.tools import assert_raises diff --git a/test/test_importers/test_s3_importer.py b/test/test_importers/test_s3_importer.py index 1af87f0fc2..d5dcf4c516 100644 --- a/test/test_importers/test_s3_importer.py +++ b/test/test_importers/test_s3_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import string from pybossa.importers.s3 import BulkTaskS3Import diff --git a/test/test_importers/test_twitter_importer.py b/test/test_importers/test_twitter_importer.py index b5cd22512e..6cbd117000 100644 --- a/test/test_importers/test_twitter_importer.py +++ b/test/test_importers/test_twitter_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch, Mock @@ -293,7 +293,7 @@ def create_status(_id): return { u'contributors': None, u'truncated': False, - u'text': u'Burning news! PyBossa v1.2.1 released! This version gets all new @PyBossa releases in your admin page! https://t.co/WkOXc3YL6s', + u'text': u'Burning news! PYBOSSA v1.2.1 released! This version gets all new @PYBOSSA releases in your admin page! https://t.co/WkOXc3YL6s', u'is_quote_status': False, u'in_reply_to_status_id': None, u'id': _id, @@ -336,11 +336,11 @@ def create_status(_id): u'geo_enabled': True, u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/497181885/1401885123', u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png', - u'screen_name': u'PyBossa', + u'screen_name': u'PYBOSSA', u'lang': u'en', u'profile_background_tile': False, u'favourites_count': 185, - u'name': u'PyBossa', + u'name': u'PYBOSSA', u'notifications': False, u'url': u'http://t.co/ASSBcIRZjY', u'created_at': u'Sun Feb 19 18:17:39 +0000 2012', diff --git a/test/test_importers/test_youtube_importer.py b/test/test_importers/test_youtube_importer.py index 8708096239..d39ef568a4 100644 --- a/test/test_importers/test_youtube_importer.py +++ b/test/test_importers/test_youtube_importer.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch from nose.tools import assert_raises @@ -190,7 +190,7 @@ def test_call_to_youtube_api_endpoint(self, build): return_value.execute.return_value = self.short_playlist_response importer = BulkTaskYoutubeImport(**self.form_data) importer._fetch_all_youtube_videos('fakeId') - + build.assert_called_with('youtube', 'v3', developerKey=self.form_data['youtube_api_server_key']) def test_call_to_youtube_api_short_playlist(self, build): diff --git a/test/test_jobs/__init__.py b/test/test_jobs/__init__.py index 6195568008..40339f1f6f 100644 --- a/test/test_jobs/__init__.py +++ b/test/test_jobs/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from datetime import datetime from pybossa.jobs import create_dict_jobs, enqueue_periodic_jobs,\ diff --git a/test/test_jobs/test_dashboard_active_anon_week.py b/test/test_jobs/test_dashboard_active_anon_week.py index 2eaca0a42a..883d6de7e6 100644 --- a/test/test_jobs/test_dashboard_active_anon_week.py +++ b/test/test_jobs/test_dashboard_active_anon_week.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.dashboard.jobs import active_anon_week from pybossa.dashboard.data import format_anon_week diff --git a/test/test_jobs/test_dashboard_active_users_week.py b/test/test_jobs/test_dashboard_active_users_week.py index 03ef61f214..4f17878c9d 100644 --- a/test/test_jobs/test_dashboard_active_users_week.py +++ b/test/test_jobs/test_dashboard_active_users_week.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.dashboard.jobs import active_users_week from pybossa.dashboard.data import format_users_week diff --git a/test/test_jobs/test_dashboard_projects_week.py b/test/test_jobs/test_dashboard_projects_week.py index d76d66b415..c57d0b52c8 100644 --- a/test/test_jobs/test_dashboard_projects_week.py +++ b/test/test_jobs/test_dashboard_projects_week.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.dashboard.jobs import ( draft_projects_week, published_projects_week, update_projects_week diff --git a/test/test_jobs/test_dashboard_task_task_run.py b/test/test_jobs/test_dashboard_task_task_run.py index 4786acf4e7..71225ea9c8 100644 --- a/test/test_jobs/test_dashboard_task_task_run.py +++ b/test/test_jobs/test_dashboard_task_task_run.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.dashboard.jobs import new_tasks_week, new_task_runs_week from pybossa.dashboard.data import format_new_task_runs, format_new_tasks diff --git a/test/test_jobs/test_dashboard_users.py b/test/test_jobs/test_dashboard_users.py index 9fb1b285e6..bbb5a38dee 100644 --- a/test/test_jobs/test_dashboard_users.py +++ b/test/test_jobs/test_dashboard_users.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.dashboard.jobs import new_users_week, returning_users_week from pybossa.dashboard.data import format_new_users, format_returning_users diff --git a/test/test_jobs/test_engage_old_users.py b/test/test_jobs/test_engage_old_users.py index 35c1b8c046..d3f51293db 100644 --- a/test/test_jobs/test_engage_old_users.py +++ b/test/test_jobs/test_engage_old_users.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.jobs import get_inactive_users_jobs, get_non_contributors_users_jobs from default import Test, with_context @@ -54,7 +54,7 @@ def test_get_inactive_users_returns_jobs(self): """Test JOB get inactive users returns a list of jobs.""" today = datetime.datetime.today() - old_date = today - datetime.timedelta(days=120) + old_date = today - datetime.timedelta(days=30) date_str = old_date.strftime('%Y-%m-%dT%H:%M:%S.%f') if calendar.isleap(today.year): n_days_year = 366 @@ -63,10 +63,11 @@ def test_get_inactive_users_returns_jobs(self): one_year = today - datetime.timedelta(days=n_days_year) one_year_str = one_year.strftime('%Y-%m-%dT%H:%M:%S.%f') user = UserFactory.create() - # 3 months old contribution + user_recent = UserFactory.create() + # 1 month old contribution tr = TaskRunFactory.create(finish_time=date_str) # 1 year old contribution - TaskRunFactory.create(finish_time=one_year_str) + tr_year = TaskRunFactory.create(finish_time=one_year_str) # User with a contribution from a long time ago TaskRunFactory.create(finish_time="2010-08-08T18:23:45.714110", user=user) @@ -80,13 +81,12 @@ def test_get_inactive_users_returns_jobs(self): jobs.append(job) msg = "There should be one job." - print jobs - assert len(jobs) == 1, msg + assert len(jobs) == 1, msg job = jobs[0] args = job['args'][0] assert job['queue'] == 'quaterly', job['queue'] assert len(args['recipients']) == 1 - assert args['recipients'][0] == user.email_addr, args['recipients'][0] + assert args['recipients'][0] == tr_year.user.email_addr, args['recipients'][0] assert "UNSUBSCRIBE" in args['body'] assert "Update" in args['html'] diff --git a/test/test_jobs/test_export.py b/test/test_jobs/test_export.py index 104704758e..7edcdd3cdb 100644 --- a/test/test_jobs/test_export.py +++ b/test/test_jobs/test_export.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context, flask_app from factories import ProjectFactory, UserFactory from pybossa.jobs import get_export_task_jobs, project_export diff --git a/test/test_jobs/test_import_tasks.py b/test/test_jobs/test_import_tasks.py index 92669cb650..ee26fd0d9c 100644 --- a/test/test_jobs/test_import_tasks.py +++ b/test/test_jobs/test_import_tasks.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context, flask_app from pybossa.jobs import import_tasks, task_repo, get_autoimport_jobs @@ -43,7 +43,7 @@ def test_sends_email_to_user_with_result_on_success(self, create, send_mail): project = ProjectFactory.create() form_data = {'type': 'csv', 'csv_url': 'http://google.es'} subject = 'Tasks Import to your project %s' % project.name - body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PyBossa team.' % project.name + body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PYBOSSA team.' % project.name email_data = dict(recipients=[project.owner.email_addr], subject=subject, body=body) @@ -59,7 +59,7 @@ def test_it_adds_import_metadata_to_autoimporter_if_is_autoimport_job(self, crea form_data = {'type': 'csv', 'csv_url': 'http://google.es'} project = ProjectFactory.create(info=dict(autoimporter=form_data)) subject = 'Tasks Import to your project %s' % project.name - body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PyBossa team.' % project.name + body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PYBOSSA team.' % project.name email_data = dict(recipients=[project.owner.email_addr], subject=subject, body=body) @@ -76,7 +76,7 @@ def test_it_does_not_add_import_metadata_to_autoimporter_if_is_import_job(self, form_data = {'type': 'csv', 'csv_url': 'http://google.es'} project = ProjectFactory.create(info=dict(autoimporter=form_data)) subject = 'Tasks Import to your project %s' % project.name - body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PyBossa team.' % project.name + body = 'Hello,\n\n1 new task was imported successfully to your project %s!\n\nAll the best,\nThe PYBOSSA team.' % project.name email_data = dict(recipients=[project.owner.email_addr], subject=subject, body=body) diff --git a/test/test_jobs/test_news.py b/test/test_jobs/test_news.py index 0e69bceeb3..d28175a49f 100644 --- a/test/test_jobs/test_news.py +++ b/test/test_jobs/test_news.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from pybossa.core import sentinel diff --git a/test/test_jobs/test_notify_blog_users.py b/test/test_jobs/test_notify_blog_users.py index 2b00581fab..4bd52d6780 100644 --- a/test/test_jobs/test_notify_blog_users.py +++ b/test/test_jobs/test_notify_blog_users.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.jobs import notify_blog_users from default import Test, with_context, flask_app diff --git a/test/test_jobs/test_old_projects.py b/test/test_jobs/test_old_projects.py index e0e6f1ad9d..e0ad59e9fb 100644 --- a/test/test_jobs/test_old_projects.py +++ b/test/test_jobs/test_old_projects.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.core import project_repo from pybossa.jobs import warn_old_project_owners, get_non_updated_projects @@ -87,7 +87,7 @@ def test_warn_project_owner_two(self, clean_mock): warn_old_project_owners() project = project_repo.get(project_id) assert len(outbox) == 1, outbox - subject = 'Your PyBossa project: %s has been inactive' % project.name + subject = 'Your PYBOSSA project: %s has been inactive' % project.name assert outbox[0].subject == subject err_msg = "project.contacted field should be True" assert project.contacted, err_msg @@ -122,7 +122,7 @@ def test_warn_project_excludes_completed_projects(self, clean_mock): warn_old_project_owners() assert len(outbox) == 1, outbox - subject = 'Your PyBossa project: %s has been inactive' % project.name + subject = 'Your PYBOSSA project: %s has been inactive' % project.name assert outbox[0].subject == subject err_msg = "project.contacted field should be True" assert project.contacted, err_msg diff --git a/test/test_jobs/test_project_stats.py b/test/test_jobs/test_project_stats.py index bcb38caf17..18e8bfe3c4 100644 --- a/test/test_jobs/test_project_stats.py +++ b/test/test_jobs/test_project_stats.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.jobs import get_project_jobs, create_dict_jobs, get_project_stats from default import Test, with_context diff --git a/test/test_jobs/test_schedule_jobs.py b/test/test_jobs/test_schedule_jobs.py index 4cb6ccc36f..0762df83b9 100644 --- a/test/test_jobs/test_schedule_jobs.py +++ b/test/test_jobs/test_schedule_jobs.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.jobs import schedule_job from rq_scheduler import Scheduler diff --git a/test/test_jobs/test_send_mail.py b/test/test_jobs/test_send_mail.py index be3d48c374..abacb798c3 100644 --- a/test/test_jobs/test_send_mail.py +++ b/test/test_jobs/test_send_mail.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.jobs import send_mail from mock import patch diff --git a/test/test_jobs/test_webhooks.py b/test/test_jobs/test_webhooks.py index c289ce2e64..0f9d6fe310 100644 --- a/test/test_jobs/test_webhooks.py +++ b/test/test_jobs/test_webhooks.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from pybossa.jobs import webhook diff --git a/test/test_jobs/test_weekly_update.py b/test/test_jobs/test_weekly_update.py index e0b9f54823..a48a0e7b5e 100644 --- a/test/test_jobs/test_weekly_update.py +++ b/test/test_jobs/test_weekly_update.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context, flask_app from pybossa.jobs import get_weekly_stats_update_projects diff --git a/test/test_model/__init__.py b/test/test_model/__init__.py index 1555cea53e..686984e8f0 100644 --- a/test/test_model/__init__.py +++ b/test/test_model/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/test/test_model/test_event_listeners.py b/test/test_model/test_event_listeners.py index bcacaae27a..4d4eb40bb2 100644 --- a/test/test_model/test_event_listeners.py +++ b/test/test_model/test_event_listeners.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context from factories import TaskFactory, TaskRunFactory diff --git a/test/test_model/test_model_base.py b/test/test_model/test_model_base.py index 18355bec19..61ad3842f8 100644 --- a/test/test_model/test_model_base.py +++ b/test/test_model/test_model_base.py @@ -1,7 +1,7 @@ # -*- coding: utf8 -*- # This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # # PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/test/test_model/test_model_blogpost.py b/test/test_model/test_model_blogpost.py index 4e65de233d..b0b0cdc6b1 100644 --- a/test/test_model/test_model_blogpost.py +++ b/test/test_model/test_model_blogpost.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context, assert_not_raises from nose.tools import raises, assert_raises diff --git a/test/test_model/test_model_project.py b/test/test_model/test_model_project.py index bc6857d77f..429598f4d3 100644 --- a/test/test_model/test_model_project.py +++ b/test/test_model/test_model_project.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context from nose.tools import assert_raises diff --git a/test/test_model/test_model_task.py b/test/test_model/test_model_task.py index ff14833057..9dd176eef3 100644 --- a/test/test_model/test_model_task.py +++ b/test/test_model/test_model_task.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context from nose.tools import assert_raises diff --git a/test/test_model/test_model_taskrun.py b/test/test_model/test_model_taskrun.py index 1ba8f4475c..95ac1b952c 100644 --- a/test/test_model/test_model_taskrun.py +++ b/test/test_model/test_model_taskrun.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context from nose.tools import assert_raises diff --git a/test/test_model/test_model_user.py b/test/test_model/test_model_user.py index 384235fb15..32b5f4db9a 100644 --- a/test/test_model/test_model_user.py +++ b/test/test_model/test_model_user.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context from nose.tools import assert_raises diff --git a/test/test_news.py b/test/test_news.py index e913e8bd8a..d26c03c067 100644 --- a/test/test_news.py +++ b/test/test_news.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, with_context from pybossa.news import get_news, notify_news_admins from pybossa.core import sentinel diff --git a/test/test_newsletter.py b/test/test_newsletter.py index 88c17b6272..d59c0b84fc 100644 --- a/test/test_newsletter.py +++ b/test/test_newsletter.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import with_context, Test from helper import web diff --git a/test/test_password_manager.py b/test/test_password_manager.py index 3d7a6508c1..1d9561a4df 100644 --- a/test/test_password_manager.py +++ b/test/test_password_manager.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.cookies import CookieHandler from pybossa.password_manager import ProjectPasswdManager diff --git a/test/test_privacy.py b/test/test_privacy.py index 1d4b06e8c8..f68f17b199 100644 --- a/test/test_privacy.py +++ b/test/test_privacy.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from bs4 import BeautifulSoup diff --git a/test/test_pro_feature_handler.py b/test/test_pro_feature_handler.py index 4ad615e821..0f5693a983 100644 --- a/test/test_pro_feature_handler.py +++ b/test/test_pro_feature_handler.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from pybossa.pro_features import ProFeatureHandler from mock import Mock, patch, PropertyMock diff --git a/test/test_ratelimit.py b/test/test_ratelimit.py index 337e000b6f..3b250ee8a5 100644 --- a/test/test_ratelimit.py +++ b/test/test_ratelimit.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """ This module tests the RateLimit class and decorator for the API. diff --git a/test/test_repository/__init__.py b/test/test_repository/__init__.py index 1555cea53e..686984e8f0 100644 --- a/test/test_repository/__init__.py +++ b/test/test_repository/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/test/test_repository/test_auditlog_repository.py b/test/test_repository/test_auditlog_repository.py index dc123e16b6..1ac9939021 100644 --- a/test/test_repository/test_auditlog_repository.py +++ b/test/test_repository/test_auditlog_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_repository/test_blog_repository.py b/test/test_repository/test_blog_repository.py index 20c3967c7e..6831ea0515 100644 --- a/test/test_repository/test_blog_repository.py +++ b/test/test_repository/test_blog_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_repository/test_project_repository.py b/test/test_repository/test_project_repository.py index 6b26d8d878..9bb86f99ec 100644 --- a/test/test_repository/test_project_repository.py +++ b/test/test_repository/test_project_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_repository/test_result_repository.py b/test/test_repository/test_result_repository.py index a2386ec584..03e4346bf4 100644 --- a/test/test_repository/test_result_repository.py +++ b/test/test_repository/test_result_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_repository/test_task_repository.py b/test/test_repository/test_task_repository.py index fb7318e7e8..9877c07342 100644 --- a/test/test_repository/test_task_repository.py +++ b/test/test_repository/test_task_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_repository/test_user_repository.py b/test/test_repository/test_user_repository.py index aeb2b1c1c7..17f1b2078e 100644 --- a/test/test_repository/test_user_repository.py +++ b/test/test_repository/test_user_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_repository/test_webhook_repository.py b/test/test_repository/test_webhook_repository.py index 9ba9712f32..8ae7103b17 100644 --- a/test/test_repository/test_webhook_repository.py +++ b/test/test_repository/test_webhook_repository.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . # Cache global variables for timeouts from default import Test, db diff --git a/test/test_rq_dashboard.py b/test/test_rq_dashboard.py index 9939665147..5979ffaff2 100644 --- a/test/test_rq_dashboard.py +++ b/test/test_rq_dashboard.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import db, Fixtures, with_context from helper import web diff --git a/test/test_s3_client.py b/test/test_s3_client.py index 8a1650c3d3..5adfffc664 100644 --- a/test/test_s3_client.py +++ b/test/test_s3_client.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch, MagicMock from nose.tools import assert_raises diff --git a/test/test_sched.py b/test/test_sched.py index 30f5309cb9..2b3bd5d9e8 100644 --- a/test/test_sched.py +++ b/test/test_sched.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json import random diff --git a/test/test_sched_2.py b/test/test_sched_2.py index e25da5e86b..f7b9e950d4 100644 --- a/test/test_sched_2.py +++ b/test/test_sched_2.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from helper import sched from default import with_context diff --git a/test/test_stats.py b/test/test_stats.py index 0037774545..176929e567 100644 --- a/test/test_stats.py +++ b/test/test_stats.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import datetime import time diff --git a/test/test_uploader/__init__.py b/test/test_uploader/__init__.py index 1f26ee611d..e4c5031501 100644 --- a/test/test_uploader/__init__.py +++ b/test/test_uploader/__init__.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . #from default import db from mock import Mock, MagicMock, PropertyMock diff --git a/test/test_uploader/test_generic_uploader.py b/test/test_uploader/test_generic_uploader.py index dd1ee55a45..f2984f5d5e 100644 --- a/test/test_uploader/test_generic_uploader.py +++ b/test/test_uploader/test_generic_uploader.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """This module tests the Uploader class.""" from default import Test, with_context @@ -29,7 +29,7 @@ class TestUploader(Test): - """Test PyBossa Uploader module.""" + """Test PYBOSSA Uploader module.""" def setUp(self): """SetUp method.""" diff --git a/test/test_uploader/test_local_uploader.py b/test/test_uploader/test_local_uploader.py index b579d65ea8..8f2da8a84f 100644 --- a/test/test_uploader/test_local_uploader.py +++ b/test/test_uploader/test_local_uploader.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """This module tests the Uploader class.""" import os @@ -27,7 +27,7 @@ class TestLocalUploader(Test): - """Test PyBossa Uploader module.""" + """Test PYBOSSA Uploader module.""" def test_local_uploader_relative_directory_init(self): """Test LOCAL UPLOADER init works with relative path.""" diff --git a/test/test_uploader/test_rackspace_uploader.py b/test/test_uploader/test_rackspace_uploader.py index 7c1a84f335..03adffdbfe 100644 --- a/test/test_uploader/test_rackspace_uploader.py +++ b/test/test_uploader/test_rackspace_uploader.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . """This module tests the Uploader class.""" from default import Test, with_context @@ -28,7 +28,7 @@ class TestRackspaceUploader(Test): - """Test PyBossa Rackspace Uploader module.""" + """Test PYBOSSA Rackspace Uploader module.""" @patch('pybossa.uploader.rackspace.pyrax.set_credentials', return_value=True) diff --git a/test/test_util.py b/test/test_util.py index 62a0a74b19..d831b84b7c 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import pybossa.util as util from mock import MagicMock from mock import patch @@ -97,17 +97,25 @@ def test_handle_content_type_json_error(self, mockjsonify, mockrender, mockreque @patch('pybossa.util.request') @patch('pybossa.util.render_template') @patch('pybossa.util.jsonify') - def test_handle_content_type_json_form(self, mockjsonify, mockrender, mockrequest): + @patch('pybossa.util.generate_csrf') + def test_handle_content_type_json_form(self, mockcsrf, mockjsonify, mockrender, mockrequest): mockrequest.headers.__getitem__.return_value = 'application/json' mockjsonify.side_effect = myjsonify + mockcsrf.return_value = "yourcsrf" + form = MagicMock(data=dict(foo=1), errors=None) res = util.handle_content_type(dict(template='example.html', - form="A Form")) + form=form)) err_msg = "template key should exist" assert res.get('template') == 'example.html', err_msg err_msg = "jsonify should be called" assert mockjsonify.called, err_msg - err_msg = "Form should not exist" - assert res.get('form') is None, err_msg + err_msg = "Form should exist" + assert res.get('form'), err_msg + err_msg = "Form should have a csrf key/value" + assert res.get('form').get('csrf') == 'yourcsrf', err_msg + err_msg = "There should be the keys of the form" + keys = ['foo', 'errors', 'csrf'] + assert res.get('form').keys().sort() == keys.sort(), err_msg @with_context @patch('pybossa.util.request') @@ -562,3 +570,20 @@ def test_rank_by_recent_updates_or_contributions(self): assert ranked[2]['name'] == 'third', ranked[2]['name'] assert ranked[3]['name'] == 'fourth', ranked[3]['name'] assert ranked[4]['name'] == 'last', ranked[4]['name'] + +class TestJSONEncoder(object): + + def test_jsonencoder(self): + """Test JSON encoder.""" + from pybossa.extensions import JSONEncoder + from speaklater import make_lazy_string + encoder = JSONEncoder() + sval = "Hello world" + string = make_lazy_string(lambda: sval) + + encoder = JSONEncoder() + + data = encoder.encode(dict(foo=string)) + data = json.loads(data) + err_msg = "The encoder should manage lazystrings" + assert data.get('foo') == sval, err_msg diff --git a/test/test_view/__init__.py b/test/test_view/__init__.py index 1555cea53e..686984e8f0 100644 --- a/test/test_view/__init__.py +++ b/test/test_view/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . diff --git a/test/test_view/test_amazon.py b/test/test_view/test_amazon.py index a03471c7e6..dd50815af2 100644 --- a/test/test_view/test_amazon.py +++ b/test/test_view/test_amazon.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from mock import patch, MagicMock diff --git a/test/test_view/test_blog.py b/test/test_view/test_blog.py index 2fb46ab0ac..9d40abbeb2 100644 --- a/test/test_view/test_blog.py +++ b/test/test_view/test_blog.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from helper import web diff --git a/test/test_view/test_facebook.py b/test/test_view/test_facebook.py index 820ba564db..42a6cf0b6a 100644 --- a/test/test_view/test_facebook.py +++ b/test/test_view/test_facebook.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test from pybossa.view.facebook import manage_user, manage_user_login from mock import patch diff --git a/test/test_view/test_flickr.py b/test/test_view/test_flickr.py index db1252b259..76b024ac0f 100644 --- a/test/test_view/test_flickr.py +++ b/test/test_view/test_flickr.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2016 SciFabric LTD. +# Copyright (C) 2016 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch, MagicMock import json from flask import Response, session @@ -111,4 +111,4 @@ def test_albums_endpoint_returns_user_albums_in_JSON_format(self, client): client_instance.get_user_albums.return_value = albums resp = flask_app.test_client().get('/flickr/albums') - assert resp.data == json.dumps(albums), resp.data \ No newline at end of file + assert resp.data == json.dumps(albums), resp.data diff --git a/test/test_view/test_google.py b/test/test_view/test_google.py index 26fb0104ba..6a7c5d203d 100644 --- a/test/test_view/test_google.py +++ b/test/test_view/test_google.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test from pybossa.view.google import manage_user, manage_user_login from mock import patch diff --git a/test/test_view/test_project_passwords.py b/test/test_view/test_project_passwords.py index b14a42f583..36873e6f37 100644 --- a/test/test_view/test_project_passwords.py +++ b/test/test_view/test_project_passwords.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, db, with_context from factories import ProjectFactory, TaskFactory, UserFactory, BlogpostFactory diff --git a/test/test_view/test_project_publish.py b/test/test_view/test_project_publish.py index 231e9916c2..9378af0937 100644 --- a/test/test_view/test_project_publish.py +++ b/test/test_view/test_project_publish.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # # Copyright (C) 2015 SF Isle of Man Limited # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from mock import patch from default import db diff --git a/test/test_view/test_twitter.py b/test/test_view/test_twitter.py index 68c145cd6e..0ec537ed16 100644 --- a/test/test_view/test_twitter.py +++ b/test/test_view/test_twitter.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from flask import Response from default import Test, assert_not_raises from pybossa.view.twitter import manage_user, manage_user_login, \ diff --git a/test/test_view/test_webhook.py b/test/test_view/test_webhook.py index fb3ee0607d..4dd429a47f 100644 --- a/test/test_view/test_webhook.py +++ b/test/test_view/test_webhook.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json from helper import web diff --git a/test/test_vmcp.py b/test/test_vmcp.py index ff5dad5e84..0fbf36b1c5 100644 --- a/test/test_vmcp.py +++ b/test/test_vmcp.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import pybossa.vmcp as vmcp from mock import patch diff --git a/test/test_web.py b/test/test_web.py index dbf0f4fd47..e3697d6b5f 100644 --- a/test/test_web.py +++ b/test/test_web.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . import json import os @@ -63,7 +63,7 @@ def clear_temp_container(self, user_id): def test_01_index(self): """Test WEB home page works""" res = self.app.get("/", follow_redirects=True) - assert self.html_title() in res.data, res + assert self.html_title() in res.data, res.data assert "Create" in res.data, res @with_context @@ -221,6 +221,32 @@ def test_register_get(self): assert res.mimetype == 'text/html', res assert self.html_title("Register") in res.data, res + @with_context + def test_register_get_json(self): + """Test WEB register JSON user works""" + from pybossa.forms.account_view_forms import RegisterForm + res = self.app.get('/account/register', + content_type='application/json') + data = json.loads(res.data) + + form = RegisterForm() + expected_fields = form.data.keys() + + err_msg = "There should be a form" + assert data.get('form'), err_msg + for field in expected_fields: + err_msg = "%s form field is missing" + assert field in data.get('form').keys(), err_msg + err_msg = "There should be a CSRF field" + assert data.get('form').get('csrf'), err_msg + err_msg = "There should be no errors" + assert data.get('form').get('errors') == {}, err_msg + err_msg = "There should be a template field" + assert data.get('template') == 'account/register.html', err_msg + err_msg = "There should be a title" + assert data.get('title') == 'Register', err_msg + + @with_context def test_register_errors_get(self): """Test WEB register errors works""" @@ -232,6 +258,84 @@ def test_register_errors_get(self): assert "correct the errors" in res.data, res.data + @with_context + def test_register_wrong_content_type(self): + """Test WEB Register JSON wrong content type.""" + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + userdict = {'fullname': 'a', 'name': 'name', + 'email_addr': None, 'password': 'p'} + + res = self.app.post('/account/register', data=userdict, + content_type='application/json') + print res.data + errors = json.loads(res.data) + err_msg = "The browser (or proxy) sent a request that this server could not understand." + assert errors.get('description') == err_msg, err_msg + err_msg = "Error code should be 400" + assert errors.get('code') == 400, err_msg + assert res.status_code == 400, err_msg + + + @with_context + def test_register_csrf_missing(self): + """Test WEB Register JSON CSRF token missing.""" + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + userdict = {'fullname': 'a', 'name': 'name', + 'email_addr': None, 'password': 'p'} + + res = self.app.post('/account/register', data=json.dumps(userdict), + content_type='application/json') + errors = json.loads(res.data) + err_msg = "CSRF token missing or incorrect." + assert errors.get('description') == err_msg, err_msg + err_msg = "Error code should be 400" + assert errors.get('code') == 400, err_msg + assert res.status_code == 400, err_msg + + + @with_context + def test_register_csrf_wrong(self): + """Test WEB Register JSON CSRF token wrong.""" + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + userdict = {'fullname': 'a', 'name': 'name', + 'email_addr': None, 'password': 'p'} + + res = self.app.post('/account/register', data=json.dumps(userdict), + content_type='application/json', + headers={'X-CSRFToken': 'wrong'}) + errors = json.loads(res.data) + err_msg = "CSRF token missing or incorrect." + assert errors.get('description') == err_msg, err_msg + err_msg = "Error code should be 400" + assert errors.get('code') == 400, err_msg + assert res.status_code == 400, err_msg + + + @with_context + def test_register_json_errors_get(self): + """Test WEB register errors JSON works""" + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + csrf = self.get_csrf('/account/register') + + userdict = {'fullname': 'a', 'name': 'name', + 'email_addr': None, 'password': 'p'} + + res = self.app.post('/account/register', data=json.dumps(userdict), + content_type='application/json', + headers={'X-CSRFToken': csrf}) + # The output should have a mime-type: application/json + errors = json.loads(res.data).get('form').get('errors') + assert res.mimetype == 'application/json', res.data + err_msg = "There should be an error with the email" + assert errors.get('email_addr'), err_msg + err_msg = "There should be an error with fullname" + assert errors.get('fullname'), err_msg + err_msg = "There should be an error with password" + assert errors.get('password'), err_msg + err_msg = "There should NOT be an error with name" + assert errors.get('name') is None, err_msg + + @with_context @patch('pybossa.view.account.mail_queue', autospec=True) @patch('pybossa.view.account.render_template') @@ -261,6 +365,40 @@ def test_register_post_creates_email_with_link(self, signer, render, queue): assert 'body' in mail_data.keys() assert 'html' in mail_data.keys() + @with_context + @patch('pybossa.view.account.mail_queue', autospec=True) + @patch('pybossa.view.account.render_template') + @patch('pybossa.view.account.signer') + def test_register_post_json_creates_email_with_link(self, signer, render, queue): + """Test WEB register post JSON creates and sends the confirmation email if + account validation is enabled""" + from flask import current_app + current_app.config['ACCOUNT_CONFIRMATION_DISABLED'] = False + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + csrf = self.get_csrf('/account/register') + data = dict(fullname="John Doe", name="johndoe", + password="p4ssw0rd", confirm="p4ssw0rd", + email_addr="johndoe@example.com") + signer.dumps.return_value = '' + render.return_value = '' + res = self.app.post('/account/register', data=json.dumps(data), + content_type='application/json', + headers={'X-CSRFToken': csrf}) + del data['confirm'] + current_app.config['ACCOUNT_CONFIRMATION_DISABLED'] = True + + signer.dumps.assert_called_with(data, salt='account-validation') + render.assert_any_call('/account/email/validate_account.md', + user=data, + confirm_url='http://localhost/account/register/confirmation?key=') + assert send_mail == queue.enqueue.call_args[0][0], "send_mail not called" + mail_data = queue.enqueue.call_args[0][1] + assert 'subject' in mail_data.keys() + assert 'recipients' in mail_data.keys() + assert 'body' in mail_data.keys() + assert 'html' in mail_data.keys() + + @with_context @patch('pybossa.view.account.mail_queue', autospec=True) @patch('pybossa.view.account.render_template') @@ -297,6 +435,40 @@ def test_update_email_validates_email(self, signer, render, queue): msg = "Email should remain not updated, as it's not been validated" assert user.email_addr != 'new@email.com', msg + @with_context + def test_register_json(self): + """Test WEB register JSON creates a new user and logs in.""" + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + csrf = self.get_csrf('/account/register') + data = dict(fullname="John Doe", name="johndoe", password='daniel', + email_addr="new@mail.com", confirm='daniel') + res = self.app.post('/account/register', data=json.dumps(data), + content_type='application/json', + headers={'X-CSRFToken': csrf}, + follow_redirects=False) + cookie = self.check_cookie(res, 'remember_token') + err_msg = "User should be logged in" + assert "johndoe" in cookie, err_msg + + @with_context + def test_register_json_error(self): + """Test WEB register JSON does not create a new user + and does not log in.""" + with patch.dict(self.flask_app.config, {'WTF_CSRF_ENABLED': True}): + csrf = self.get_csrf('/account/register') + data = dict(fullname="John Doe", name="johndoe", password='daniel', + email_addr="new@mailcom", confirm='') + res = self.app.post('/account/register', data=json.dumps(data), + content_type='application/json', + headers={'X-CSRFToken': csrf}, + follow_redirects=False) + cookie = self.check_cookie(res, 'remember_token') + err_msg = "User should not be logged in" + assert cookie is False, err_msg + errors = json.loads(res.data) + assert errors.get('form').get('errors').get('password'), err_msg + + @with_context def test_confirm_email_returns_404(self): """Test WEB confirm_email returns 404 when disabled.""" @@ -360,10 +532,13 @@ def test_register_post_valid_data_validation_enabled(self): def test_register_post_valid_data_validation_disabled(self, redirect): """Test WEB register post with valid form data and account validation disabled redirects to home page""" + from flask import current_app + current_app.config['ACCOUNT_CONFIRMATION_DISABLED'] = True data = dict(fullname="John Doe", name="johndoe", password="p4ssw0rd", confirm="p4ssw0rd", email_addr="johndoe@example.com") - res = self.app.post('/account/register', data=data) + res = self.app.post('/account/register', data=data, + follow_redirects=True) print dir(redirect) redirect.assert_called_with('/') diff --git a/test/test_web_module.py b/test/test_web_module.py index ae47af91b2..886532257a 100644 --- a/test/test_web_module.py +++ b/test/test_web_module.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from default import Test, flask_app, with_context from pybossa.util import get_port from pybossa.core import url_for_other_page diff --git a/test/test_web_sse.py b/test/test_web_sse.py index b7201d4806..2eda8510b8 100644 --- a/test/test_web_sse.py +++ b/test/test_web_sse.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . from helper import web from default import with_context from factories import ProjectFactory diff --git a/warm.py b/warm.py index 82a3c5b2dd..758746b431 100755 --- a/warm.py +++ b/warm.py @@ -1,20 +1,20 @@ # -*- coding: utf8 -*- -# This file is part of PyBossa. +# This file is part of PYBOSSA. # -# Copyright (C) 2015 SciFabric LTD. +# Copyright (C) 2015 Scifabric LTD. # -# PyBossa is free software: you can redistribute it and/or modify +# PYBOSSA is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# PyBossa is distributed in the hope that it will be useful, +# PYBOSSA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with PyBossa. If not, see . +# along with PYBOSSA. If not, see . #!/usr/bin/env python import os