From 909b9aebf743e5af1b82ff6db2237eb5b1abb460 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 14 Apr 2015 14:16:12 +0200 Subject: No bad default 'No title' for feed creation --- pyaggr3g470r/models/feed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaggr3g470r/models/feed.py b/pyaggr3g470r/models/feed.py index a36d9573..aff11460 100644 --- a/pyaggr3g470r/models/feed.py +++ b/pyaggr3g470r/models/feed.py @@ -36,7 +36,7 @@ class Feed(db.Model): Represent a feed. """ id = db.Column(db.Integer, primary_key=True) - title = db.Column(db.String(), default="No title") + title = db.Column(db.String(), default="") description = db.Column(db.String(), default="FR") link = db.Column(db.String()) site_link = db.Column(db.String(), default="") -- cgit From 7c145da932191effab00f585664980d2e591b3df Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Wed, 15 Apr 2015 15:07:19 +0200 Subject: redoing full text search using SQL LIKE condition using main home design for displaying results --- conf.py | 11 ++--- pyaggr3g470r/controllers/abstract.py | 4 +- pyaggr3g470r/templates/layout.html | 11 ++++- pyaggr3g470r/views/views.py | 92 +++++++++++++++++------------------- 4 files changed, 60 insertions(+), 58 deletions(-) diff --git a/conf.py b/conf.py index 03ff23a2..05899bbb 100644 --- a/conf.py +++ b/conf.py @@ -1,11 +1,9 @@ #! /usr/bin/env python -#-*- coding: utf-8 -*- - +# -*- coding: utf-8 -*- """ Program variables. This file contain the variables used by the application. """ - import os basedir = os.path.abspath(os.path.dirname(__file__)) @@ -29,7 +27,7 @@ DEFAULTS = {"python": "/usr/bin/python3.4", "nb_worker": "100", "default_max_error": "3", "log_path": "pyaggr3g470r.log", - "user_agent": "pyAggr3g470r " \ + "user_agent": "pyAggr3g470r " "(https://bitbucket.org/cedricbonhomme/pyaggr3g470r)", "resolve_article_url": "false", "http_proxy": "", @@ -42,7 +40,7 @@ DEFAULTS = {"python": "/usr/bin/python3.4", "host": "0.0.0.0", "port": "5000", "crawling_method": "classic", -} + } if not ON_HEROKU: try: @@ -105,7 +103,8 @@ else: "(X11; Debian; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0" RESOLVE_ARTICLE_URL = int(os.environ.get('RESOLVE_ARTICLE_URL', 0)) == 1 DEFAULT_MAX_ERROR = int(os.environ.get('DEFAULT_MAX_ERROR', 6)) - CRAWLING_METHOD = os.environ.get('CRAWLING_METHOD', DEFAULTS['crawling_method']) + CRAWLING_METHOD = os.environ.get('CRAWLING_METHOD', + DEFAULTS['crawling_method']) WEBSERVER_DEBUG = False WEBSERVER_HOST = '0.0.0.0' diff --git a/pyaggr3g470r/controllers/abstract.py b/pyaggr3g470r/controllers/abstract.py index 8f0a8e3f..29905c0c 100644 --- a/pyaggr3g470r/controllers/abstract.py +++ b/pyaggr3g470r/controllers/abstract.py @@ -25,7 +25,7 @@ class AbstractController(object): each parameters of the function is treated as an equality unless the name of the parameter ends with either "__gt", "__lt", "__ge", "__le", - "__ne" or "__in". + "__ne", "__in" ir "__like". """ if self.user_id is not None: filters[self._user_id_key] = self.user_id @@ -43,6 +43,8 @@ class AbstractController(object): db_filters.add(getattr(self._db_cls, key[:-4]) != value) elif key.endswith('__in'): db_filters.add(getattr(self._db_cls, key[:-4]).in_(value)) + elif key.endswith('__like'): + db_filters.add(getattr(self._db_cls, key[:-6]).like(value)) else: db_filters.add(getattr(self._db_cls, key) == value) return db_filters diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html index 484bbdc7..06567953 100644 --- a/pyaggr3g470r/templates/layout.html +++ b/pyaggr3g470r/templates/layout.html @@ -86,6 +86,7 @@
  • {{ _('Profile') }}
  • {{ _('Your data') }}
  • {% if g.user.is_admin() %} +
  • {{ _('About') }}
  • {{ _('Dashboard') }}
  • @@ -101,9 +102,15 @@