From 8c194430f5c59132075c9dc9787f2fbba6fd59fd Mon Sep 17 00:00:00 2001 From: Nicolas Joyard <joyard.nicolas@gmail.com> Date: Mon, 30 May 2016 21:54:06 +0200 Subject: [PATCH] Fix test errors --- .../contrib/import_positions.py | 2 -- representatives_positions/models.py | 2 +- .../contrib/dossier_mappings.py | 15 +++++++++++++++ .../contrib/import_recommendations.py | 17 ++--------------- setup.py | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 representatives_recommendations/contrib/dossier_mappings.py diff --git a/representatives_positions/contrib/import_positions.py b/representatives_positions/contrib/import_positions.py index 1718985e..95c1936b 100644 --- a/representatives_positions/contrib/import_positions.py +++ b/representatives_positions/contrib/import_positions.py @@ -3,7 +3,6 @@ import csv import django from django.apps import apps -from django.db import transaction import logging import sys import re @@ -106,4 +105,3 @@ def main(stream=None): imported = imported + 1 logger.info('%d rows imported, %d rows rejected', imported, len(rejected)) - diff --git a/representatives_positions/models.py b/representatives_positions/models.py index a45dfdfe..1e68c8c9 100644 --- a/representatives_positions/models.py +++ b/representatives_positions/models.py @@ -2,9 +2,9 @@ from django.db import models from django.core.urlresolvers import reverse from django.template.defaultfilters import truncatewords from taggit.managers import TaggableManager - from representatives.models import Representative + class Position(models.Model): representative = models.ForeignKey(Representative, related_name='positions') diff --git a/representatives_recommendations/contrib/dossier_mappings.py b/representatives_recommendations/contrib/dossier_mappings.py new file mode 100644 index 00000000..69d4e08d --- /dev/null +++ b/representatives_recommendations/contrib/dossier_mappings.py @@ -0,0 +1,15 @@ +# coding: utf-8 +# flake8: noqa + +dossier_mappings = { + "Resolution on Anti-Counterfeiting Trade Agreement (ACTA)": + "Resolution on the Anti-Counterfeiting Trade Agreement (ACTA)", + "Rapport Bono on cultural industries in Europe": + "Cultural industries in Europe", + "Rapport Gallo on enforcement of intellectual property rights in the internal market": + "Enforcement of intellectual property rights in the internal market", + "Rapport Lambrinidis on strengthening security and fundamental freedoms on the Internet": + "Strengthening security and fundamental freedoms on the Internet", + "Criminal measures aimed at ensuring the enforcement of intellectual property rights (IPRED 2), 1st reading": + "Criminal measures aimed at ensuring the enforcement of intellectual property rights" +} diff --git a/representatives_recommendations/contrib/import_recommendations.py b/representatives_recommendations/contrib/import_recommendations.py index 04c55391..ba6a1ccb 100644 --- a/representatives_recommendations/contrib/import_recommendations.py +++ b/representatives_recommendations/contrib/import_recommendations.py @@ -3,27 +3,15 @@ import csv import django from django.apps import apps -from django.db import transaction import logging import sys from representatives_recommendations.models import Recommendation from representatives_votes.models import Dossier, Proposal -logger = logging.getLogger(__name__) +from .dossier_mappings import dossier_mappings -dossier_mappings = { - "Resolution on Anti-Counterfeiting Trade Agreement (ACTA)": - "Resolution on the Anti-Counterfeiting Trade Agreement (ACTA)", - "Rapport Bono on cultural industries in Europe": - "Cultural industries in Europe", - "Rapport Gallo on enforcement of intellectual property rights in the internal market": - "Enforcement of intellectual property rights in the internal market", - "Rapport Lambrinidis on strengthening security and fundamental freedoms on the Internet": - "Strengthening security and fundamental freedoms on the Internet", - "Criminal measures aimed at ensuring the enforcement of intellectual property rights (IPRED 2), 1st reading": - "Criminal measures aimed at ensuring the enforcement of intellectual property rights" -} +logger = logging.getLogger(__name__) class RecommendationImporter: @@ -124,4 +112,3 @@ def main(stream=None): imported = imported + 1 logger.info('%d rows imported, %d rows rejected', imported, len(rejected)) - diff --git a/setup.py b/setup.py index d8950c82..307e63f3 100644 --- a/setup.py +++ b/setup.py @@ -44,8 +44,8 @@ setup(name='political-memory', }, entry_points={ 'console_scripts': [ - 'memopol_import_positions = representatives_positions.contrib.import_positions:main', - 'memopol_import_recommendations = representatives_recommendations.contrib.import_recommendations:main', + 'memopol_import_positions = representatives_positions.contrib.import_positions:main', # noqa + 'memopol_import_recommendations = representatives_recommendations.contrib.import_recommendations:main', # noqa ] } ) -- GitLab