Skip to content

Commit

Permalink
revert : many 14th legislature dossiers page are still there and livi…
Browse files Browse the repository at this point in the history
…ng, while dyn ones miss. If there are actually 14th dossiers with only the redirection, it is not the rule yet
  • Loading branch information
boogheta committed Jul 4, 2018
1 parent c3a5b1f commit 6df5aab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lawfactory_utils/__version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.11'
__version__ = '0.0.12'
10 changes: 5 additions & 5 deletions lawfactory_utils/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def clean_url(url):
legislature, slug = parse_national_assembly_url(url)
if legislature and slug:
template = AN_OLD_URL_TEMPLATE
if legislature >= 14:
if legislature > 14:
template = AN_NEW_URL_TEMPLATE
return template.format(legislature=legislature, slug=slug)

Expand All @@ -213,18 +213,18 @@ def parse_national_assembly_url(url_an):
>>> # old format
>>> parse_national_assembly_url("http://www.assemblee-nationale.fr/13/dossiers/devoir_vigilance_entreprises_donneuses_ordre.asp")
(13, 'devoir_vigilance_entreprises_donneuses_ordre')
(14, 'devoir_vigilance_entreprises_donneuses_ordre')
>>> # new format
>>> parse_national_assembly_url("http://www.assemblee-nationale.fr/dyn/15/dossiers/retablissement_confiance_action_publique")
(15, 'retablissement_confiance_action_publique')
>>> # sometimes there's a linked subsection, it's the real dosleg ID, we only use it if we are in the 15th legislature
>>> parse_national_assembly_url("http://www.assemblee-nationale.fr/13/dossiers/le_dossier.asp#deuxieme_partie")
(13, 'le_dossier')
(14, 'le_dossier')
>>> parse_national_assembly_url("http://www.assemblee-nationale.fr/15/dossiers/le_nouveau_dossier.asp#deuxieme_partie")
(15, 'deuxieme_partie')
>>> # some dossier-like urls are not actual dossiers
>>> parse_national_assembly_url("http://www.assemblee-nationale.fr/13/dossiers/motion_referendaire_2097.pdf")
(13, None)
(14, None)
"""
legislature_match = re.search(r"\.fr/(dyn/)?(\d+)/", url_an)
Expand All @@ -236,7 +236,7 @@ def parse_national_assembly_url(url_an):
slug = None
slug_match = re.search(r"/([\w_\-]*)(?:\.asp)?(?:#([\w_\-]*))?$", url_an)
if slug_match:
if legislature and legislature in (14, 15):
if legislature and legislature > 14:
slug = slug_match.group(2) or slug_match.group(1)
else:
slug = slug_match.group(1)
Expand Down

4 comments on commit 6df5aab

@mdamien
Copy link
Member

@mdamien mdamien commented on 6df5aab Jul 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arf, then the fix is gonna be in anpy I guess

@boogheta
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point out the cases you encountered so we can try and put in the tests examples of both?

@mdamien
Copy link
Member

@mdamien mdamien commented on 6df5aab Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, it's simply doing a tlfp-parse http://www.assemblee-nationale.fr/14/dossiers/retablissement_confiance_action_publique.asp (in this direction, instead of starting with the senat dosleg)

@boogheta
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah then I guess it's a specific case because it's a crosslegislature text, but I feel like as they promised, they won't do it for all dossiers of the 14th.
If I'm correct, I'm not sure we really need to try and handle this specific case as it is properly handled the regular way?

Please sign in to comment.