aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
Diffstat (limited to 'src/web')
-rw-r--r--src/web/models/article.py2
-rw-r--r--src/web/translations/fr/LC_MESSAGES/messages.mobin17292 -> 17210 bytes
-rw-r--r--src/web/translations/fr/LC_MESSAGES/messages.po70
-rw-r--r--src/web/views/api/v3/article.py35
-rw-r--r--src/web/views/api/v3/common.py6
5 files changed, 71 insertions, 42 deletions
diff --git a/src/web/models/article.py b/src/web/models/article.py
index f4314d8b..0a2a082e 100644
--- a/src/web/models/article.py
+++ b/src/web/models/article.py
@@ -35,7 +35,7 @@ from web.models.right_mixin import RightMixin
class Article(db.Model, RightMixin):
"Represent an article from a feed."
id = db.Column(db.Integer(), primary_key=True)
- entry_id = db.Column(db.String())
+ entry_id = db.Column(db.String(), nullable=False)
link = db.Column(db.String())
title = db.Column(db.String())
content = db.Column(db.String())
diff --git a/src/web/translations/fr/LC_MESSAGES/messages.mo b/src/web/translations/fr/LC_MESSAGES/messages.mo
index 03a45ed8..432a75b6 100644
--- a/src/web/translations/fr/LC_MESSAGES/messages.mo
+++ b/src/web/translations/fr/LC_MESSAGES/messages.mo
Binary files differ
diff --git a/src/web/translations/fr/LC_MESSAGES/messages.po b/src/web/translations/fr/LC_MESSAGES/messages.po
index 76a76578..f95347db 100644
--- a/src/web/translations/fr/LC_MESSAGES/messages.po
+++ b/src/web/translations/fr/LC_MESSAGES/messages.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2016-04-09 14:05+0200\n"
-"PO-Revision-Date: 2016-04-09 14:06+0200\n"
+"POT-Creation-Date: 2016-04-21 22:02+0200\n"
+"PO-Revision-Date: 2016-04-21 22:02+0200\n"
"Last-Translator: Cédric Bonhomme <cedric@cedricbonhomme.org>\n"
"Language-Team: fr <LL@li.org>\n"
"Language: fr\n"
@@ -173,20 +173,20 @@ msgstr ""
#: src/web/templates/about.html:11
msgid ""
"This software is under AGPLv3 license. You are welcome to copy, modify or\n"
-" redistribute the <a href=\"https://github.com/JARR/JARR"
-"\">source code</a>\n"
+" redistribute the <a href=\"https://github.com/JARR/JARR\">source "
+"code</a>\n"
" according to the <a href=\"https://www.gnu.org/licenses/agpl-3.0.html"
"\">Affero GPL</a> license."
msgstr ""
"Ce logiciel est sous licence AGPLv3. Vous êtes invité à copier, modifier ou "
-"redistribuer le <a href=\"https://github.com/JARR/JARR\">code "
-"source</a> selon la licence <a href=\"https://www.gnu.org/licenses/agpl-3.0."
-"html\">Affero GPL</a>."
+"redistribuer le <a href=\"https://github.com/JARR/JARR\">code source</a> "
+"selon la licence <a href=\"https://www.gnu.org/licenses/agpl-3.0.html"
+"\">Affero GPL</a>."
#: src/web/templates/about.html:14
msgid ""
-"Found a bug? Report it <a href=\"https://github.com/JARR/JARR"
-"issues\">here</a>."
+"Found a bug? Report it <a href=\"https://github.com/JARR/JARRissues\">here</"
+"a>."
msgstr ""
"Vous avez trouvé un bug? Signalez-le <a href=\"https://github.com/JARR-"
"aggregator/JARR/issues\">ici</a>."
@@ -268,16 +268,8 @@ msgstr "Marquer cet article comme non lu"
msgid "Mark this article as read"
msgstr "Marquer cet article comme lu"
-#: src/web/templates/article.html:26
-msgid "Next post:"
-msgstr "Billet suivant:"
-
-#: src/web/templates/article.html:29
-msgid "Previous post:"
-msgstr "Billet précédent:"
-
-#: src/web/templates/article.html:35 src/web/templates/article.html:38
-#: src/web/templates/article.html:41
+#: src/web/templates/article.html:25 src/web/templates/article.html:28
+#: src/web/templates/article.html:31
msgid "Share on"
msgstr "Partager sur"
@@ -716,7 +708,7 @@ msgstr "Éditer l'utilisateur <i>%(nick)s</i>"
msgid "Some errors were found"
msgstr "Des erreurs ont été trouvées"
-#: src/web/views/admin.py:68 src/web/views/user.py:87
+#: src/web/views/admin.py:68 src/web/views/user.py:88
#, python-format
msgid "User %(nick)s successfully updated"
msgstr "Utilisateur %(nick)s mis à jour avec succès."
@@ -745,21 +737,21 @@ msgstr "Cet utilisateur n'existe pas."
msgid "User %(nickname)s successfully %(is_active)s"
msgstr "Utilisateur %(nickname)s %(is_active)s avec succès."
-#: src/web/views/article.py:72
+#: src/web/views/article.py:63
#, python-format
msgid "Article %(article_title)s deleted"
msgstr "Article %(article_title)s supprimé."
-#: src/web/views/article.py:129
+#: src/web/views/article.py:120
#, python-format
msgid "%(count)d articles deleted"
msgstr "%(count)d articles supprimés."
-#: src/web/views/article.py:146 src/web/views/article.py:157
+#: src/web/views/article.py:137 src/web/views/article.py:148
msgid "Error when exporting articles."
msgstr "Erreur lors de l'export des articles."
-#: src/web/views/article.py:172
+#: src/web/views/article.py:163
msgid "Export format not supported."
msgstr "Ce format d'export n'est pas supporté."
@@ -849,11 +841,11 @@ msgstr "Flux %(feed_title)r créé avec succès."
msgid "No duplicates in the feed \"{}\"."
msgstr "Pas de doublon dans le flux \"{}\"."
-#: src/web/views/home.py:152 src/web/views/user.py:39
+#: src/web/views/home.py:168 src/web/views/user.py:40
msgid "Downloading articles..."
msgstr "Téléchargement des articles."
-#: src/web/views/home.py:154
+#: src/web/views/home.py:170
msgid ""
"The manual retrieving of news is only available for administrator, on the "
"Heroku platform."
@@ -874,43 +866,43 @@ msgstr "Problème lors de l'envoi d'email d'activation: %(error)s"
msgid "Your account has been created. Check your mail to confirm it."
msgstr "Votre compte a été créé. Vérifiez votre courrier pour le confirmer."
-#: src/web/views/user.py:31 src/web/views/user.py:47 src/web/views/user.py:56
+#: src/web/views/user.py:32 src/web/views/user.py:48 src/web/views/user.py:57
msgid "File not allowed."
msgstr "Fichier non autorisé."
-#: src/web/views/user.py:37
+#: src/web/views/user.py:38
msgid "feeds imported."
msgstr "flux importés."
-#: src/web/views/user.py:41
+#: src/web/views/user.py:42
msgid "Impossible to import the new feeds."
msgstr "Impossible d'importer les nouveaux flux."
-#: src/web/views/user.py:51
+#: src/web/views/user.py:52
msgid "Account imported."
msgstr "Compte importé."
-#: src/web/views/user.py:53
+#: src/web/views/user.py:54
msgid "Impossible to import the account."
msgstr "Impossible d'importer le compte."
-#: src/web/views/user.py:105
+#: src/web/views/user.py:106
msgid "Your account has been deleted."
msgstr "Votre compte a été supprimé."
-#: src/web/views/user.py:122
+#: src/web/views/user.py:123
msgid "Your account has been confirmed."
msgstr "Votre compte a été confirmé."
-#: src/web/views/user.py:124
+#: src/web/views/user.py:125
msgid "Impossible to confirm this account."
msgstr "Impossible de confirmer ce compte."
-#: src/web/views/user.py:149
+#: src/web/views/user.py:150
msgid "New password sent to your address."
msgstr "Nouveau mot de passe envoyé à votre adresse."
-#: src/web/views/user.py:151
+#: src/web/views/user.py:152
#, python-format
msgid "Problem while sending your new password: %(error)s"
msgstr "Problème lors de l'envoi de votre nouveau mot de passe: %(error)s"
@@ -923,6 +915,12 @@ msgstr "Authentification requise."
msgid "Forbidden."
msgstr "Interdit."
+#~ msgid "Next post:"
+#~ msgstr "Billet suivant:"
+
+#~ msgid "Previous post:"
+#~ msgstr "Billet précédent:"
+
#~ msgid "Submit"
#~ msgstr "Soumettre"
diff --git a/src/web/views/api/v3/article.py b/src/web/views/api/v3/article.py
index a367a62f..49a9842e 100644
--- a/src/web/views/api/v3/article.py
+++ b/src/web/views/api/v3/article.py
@@ -1,7 +1,9 @@
from flask.ext.login import current_user
+from werkzeug.exceptions import NotFound
+from flask.ext.restless import ProcessingException
from web import models
from bootstrap import application, manager
-from web.controllers import ArticleController
+from web.controllers import ArticleController, FeedController
from web.views.api.v3.common import AbstractProcessor
from web.views.api.v3.common import url_prefix, auth_func
@@ -14,6 +16,26 @@ class ArticleProcessor(AbstractProcessor):
if not self.is_authorized(current_user, article):
raise ProcessingException(description='Not Authorized', code=401)
+ def post_put_preprocessor(self, data=None, **kw):
+ data["user_id"] = current_user.id
+
+ fcontr = FeedController()
+ try:
+ feed = fcontr.get(id=data["feed_id"])
+ except NotFound:
+ raise ProcessingException(description='No such feed.', code=404)
+
+ data["category_id"] = feed.category_id
+
+ def delete_preprocessor(self, instance_id=None, **kw):
+ contr = ArticleController()
+ try:
+ article = contr.get(id=instance_id)
+ except NotFound:
+ raise ProcessingException(description='No such article.', code=404)
+ if article.user_id != current_user.id:
+ raise ProcessingException(description='Not Authorized', code=401)
+
article_processor = ArticleProcessor()
@@ -22,9 +44,12 @@ blueprint_article = manager.create_api_blueprint(models.Article,
methods=['GET', 'POST', 'PUT', 'DELETE'],
preprocessors=dict(GET_SINGLE=[auth_func,
article_processor.get_single_preprocessor],
- GET_MANY=[auth_func,
+ GET_MANY=[auth_func,
article_processor.get_many_preprocessor],
- PUT_SINGLE=[auth_func],
- POST=[auth_func],
- DELETE=[auth_func]))
+ POST=[auth_func,
+ article_processor.post_put_preprocessor],
+ PUT_SINGLE=[auth_func,
+ article_processor.post_put_preprocessor],
+ DELETE=[auth_func,
+ article_processor.delete_preprocessor]))
application.register_blueprint(blueprint_article)
diff --git a/src/web/views/api/v3/common.py b/src/web/views/api/v3/common.py
index 00e5b3f9..bd20ad38 100644
--- a/src/web/views/api/v3/common.py
+++ b/src/web/views/api/v3/common.py
@@ -47,3 +47,9 @@ class AbstractProcessor():
search_params["filters"] = []
search_params["filters"].append(filt)
+
+ def post_put_preprocessor(self, data=None, **kw):
+ pass
+
+ def delete_preprocessor(self, instance_id=None, **kw):
+ pass
bgstack15