From 5379fd6392ff8222f0a18c04519c4ad8310d0b02 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 21 Apr 2016 22:03:08 +0200 Subject: Fixed encoding problems in the translations. --- src/web/translations/fr/LC_MESSAGES/messages.mo | Bin 17292 -> 17210 bytes src/web/translations/fr/LC_MESSAGES/messages.po | 70 ++++++++++++------------ 2 files changed, 34 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/web/translations/fr/LC_MESSAGES/messages.mo b/src/web/translations/fr/LC_MESSAGES/messages.mo index 03a45ed8..432a75b6 100644 Binary files a/src/web/translations/fr/LC_MESSAGES/messages.mo and b/src/web/translations/fr/LC_MESSAGES/messages.mo 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 \n" "Language-Team: fr \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 source code\n" +" redistribute the source " +"code\n" " according to the Affero GPL license." msgstr "" "Ce logiciel est sous licence AGPLv3. Vous êtes invité à copier, modifier ou " -"redistribuer le code " -"source selon la licence Affero GPL." +"redistribuer le code source " +"selon la licence Affero GPL." #: src/web/templates/about.html:14 msgid "" -"Found a bug? Report it here." +"Found a bug? Report it here." msgstr "" "Vous avez trouvé un bug? Signalez-le ici." @@ -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 %(nick)s" 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" -- cgit From bef45ce3e0a1a883a7f1ee9c656fe6def843481b Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 24 Apr 2016 18:18:02 +0200 Subject: Updated preprocessors for the v3 Article API. --- src/web/models/article.py | 2 +- src/web/views/api/v3/article.py | 35 ++++++++++++++++++++++++++++++----- src/web/views/api/v3/common.py | 6 ++++++ 3 files changed, 37 insertions(+), 6 deletions(-) (limited to 'src') 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/views/api/v3/article.py b/src/web/views/api/v3/article.py index 1f6e757a..44c5fe45 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_to_modify(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 4234a91a..f0dd45ab 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 -- cgit