Adding licenses to files and fixing some pyflakes errors

remotes/origin/issue/4217/improving-mail-design
Jesús Espino 2017-03-03 08:13:12 +01:00
parent c90460f283
commit 16caedce81
21 changed files with 155 additions and 39 deletions

View File

@ -20,10 +20,8 @@ from taiga.base.api import viewsets
from taiga.base import response
from taiga.base import exceptions as exc
from taiga.base.decorators import list_route
from taiga.users.models import AuthData, User
from taiga.users.services import get_user_photo_url
from taiga.users.gravatar import get_user_gravatar_id
from taiga.projects.serializers import ProjectSerializer
from taiga.importers import permissions, exceptions
from taiga.importers.services import resolve_users_bindings

View File

@ -1,6 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
import requests
import asana
import json
from django.core.files.base import ContentFile
from django.contrib.contenttypes.models import ContentType

View File

@ -44,7 +44,7 @@ def import_project(self, user_id, token, project_id, options):
"project": project_id,
"exception": e
}
email = mail_builder.importer_import_error(admin, ctx)
email = mail_builder.importer_import_error(user, ctx)
email.send()
logger.error('Error importing Asana project %s (by %s)', project_id, user, exc_info=sys.exc_info())
else:

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
class InvalidRequest(Exception):
pass

View File

@ -20,10 +20,8 @@ from taiga.base.api import viewsets
from taiga.base import response
from taiga.base import exceptions as exc
from taiga.base.decorators import list_route
from taiga.users.models import AuthData, User
from taiga.users.services import get_user_photo_url
from taiga.users.gravatar import get_user_gravatar_id
from taiga.projects.serializers import ProjectSerializer
from taiga.importers import permissions
from taiga.importers import exceptions

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
import requests
from urllib.parse import parse_qsl
from django.core.files.base import ContentFile
@ -19,7 +37,7 @@ from taiga.timeline.rebuilder import rebuild_timeline
from taiga.timeline.models import Timeline
from taiga.users.models import User, AuthData
from taiga.importers.exceptions import InvalidAuthResult
from taiga.importers.exceptions import InvalidAuthResult, FailedRequest
class GithubClient:

View File

@ -44,7 +44,7 @@ def import_project(self, user_id, token, project_id, options):
"project": project_id,
"exception": e
}
email = mail_builder.importer_import_error(admin, ctx)
email = mail_builder.importer_import_error(user, ctx)
email.send()
logger.error('Error importing GitHub project %s (by %s)', project_id, user, exc_info=sys.exc_info())
else:

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
from django.template.defaultfilters import slugify

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
import requests
from urllib.parse import parse_qsl
from oauthlib.oauth1 import SIGNATURE_RSA
@ -7,7 +25,7 @@ from django.core.files.base import ContentFile
from django.contrib.contenttypes.models import ContentType
from taiga.users.models import User
from taiga.projects.models import Project, ProjectTemplate, Membership, Points
from taiga.projects.models import Points
from taiga.projects.userstories.models import UserStory
from taiga.projects.tasks.models import Task
from taiga.projects.issues.models import Issue

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
from collections import OrderedDict
from django.template.defaultfilters import slugify

View File

@ -21,11 +21,8 @@ from django.conf import settings
from django.db.models import Q
from taiga.importers.asana.importer import AsanaImporter
from taiga.users.models import User, AuthData
from taiga.projects.services import projects as service
from taiga.users.models import User
import unittest.mock
import timeit
import json

View File

@ -21,11 +21,7 @@ from django.conf import settings
from django.db.models import Q
from taiga.importers.github.importer import GithubImporter
from taiga.users.models import User, AuthData
from taiga.projects.services import projects as service
import unittest.mock
import timeit
from taiga.users.models import User
class Command(BaseCommand):
@ -57,8 +53,8 @@ class Command(BaseCommand):
print("Go to here and come with your code (in the redirected url): {}".format(url))
code = input("Code: ")
access_data = GithubImporter.get_access_token(
settings.IMPORTERS.get('github', {}).get('client_id', None)
settings.IMPORTERS.get('github', {}).get('client_secret', None)
settings.IMPORTERS.get('github', {}).get('client_id', None),
settings.IMPORTERS.get('github', {}).get('client_secret', None),
code
)
token = access_data

View File

@ -23,10 +23,7 @@ from django.conf import settings
from taiga.importers.jira.agile import JiraAgileImporter
from taiga.importers.jira.normal import JiraNormalImporter
from taiga.users.models import User
from taiga.projects.services import projects as service
import unittest.mock
import timeit
import json
@ -69,7 +66,7 @@ class Command(BaseCommand):
True
)
print(url)
code = input("Go to the url and get back the code")
input("Go to the url, allow the user and get back and press enter")
token = JiraNormalImporter.get_access_token(
server,
settings.IMPORTERS.get('jira', {}).get('consumer_key', None),

View File

@ -21,10 +21,6 @@ from django.db.models import Q
from taiga.importers.pivotal import PivotalImporter
from taiga.users.models import User
from taiga.projects.services import projects as service
import unittest.mock
import timeit
class Command(BaseCommand):

View File

@ -21,10 +21,6 @@ from django.db.models import Q
from taiga.importers.trello.importer import TrelloImporter
from taiga.users.models import User
from taiga.projects.services import projects as service
import unittest.mock
import timeit
class Command(BaseCommand):

View File

@ -16,10 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from taiga.base.api.permissions import TaigaResourcePermission, AllowAny, IsAuthenticated
from taiga.base.api.permissions import IsSuperUser, HasProjectPerm, IsProjectAdmin
from taiga.permissions.permissions import CommentAndOrUpdatePerm
from taiga.base.api.permissions import TaigaResourcePermission, IsAuthenticated
class ImporterPermission(TaigaResourcePermission):

View File

@ -23,7 +23,6 @@ from taiga.base.decorators import list_route
from taiga.users.models import AuthData, User
from taiga.users.services import get_user_photo_url
from taiga.users.gravatar import get_user_gravatar_id
from taiga.projects.serializers import ProjectSerializer
from taiga.importers import permissions
from .importer import PivotalImporter

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
from django.core.files.base import ContentFile
from django.contrib.contenttypes.models import ContentType
import requests

View File

@ -44,7 +44,7 @@ def import_project(self, user_id, token, project_id, options):
"project": project_id,
"exception": e
}
email = mail_builder.importer_import_error(admin, ctx)
email = mail_builder.importer_import_error(user, ctx)
email.send()
logger.error('Error importing PivotalTracker project %s (by %s)', project_id, user, exc_info=sys.exc_info())
else:

View File

@ -1,3 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
from taiga.users.models import User

View File

@ -25,7 +25,6 @@ from taiga.base.decorators import list_route
from taiga.users.models import AuthData, User
from taiga.users.services import get_user_photo_url
from taiga.users.gravatar import get_user_gravatar_id
from taiga.projects.serializers import ProjectSerializer
from .importer import TrelloImporter
from taiga.importers import permissions