Commit 3a33f512 authored by Gaël Duval's avatar Gaël Duval 🏄🏼
Browse files

Merge branch 'nicofonk/short-fixes' into 'master'

some fixes about issues spotted during my manual tests

See merge request e/cloud/my-spot!20
parents 440114f0 485e4671
......@@ -203,14 +203,14 @@ class ResultContainer(object):
result['parsed_url'] = result['parsed_url']._replace(scheme="http")
result['url'] = result['parsed_url'].geturl()
result['engines'] = set([result['engine']])
result['engines'] = [result['engine']]
# strip multiple spaces and cariage returns from content
if result.get('content'):
result['content'] = WHITESPACE_REGEX.sub(' ', result['content'])
# check for duplicates
duplicated = False
duplicated = None
for merged_result in self._merged_results:
if compare_urls(result['parsed_url'], merged_result['parsed_url'])\
and result.get('template') == merged_result.get('template'):
......@@ -233,7 +233,8 @@ class ResultContainer(object):
duplicated['positions'].append(position)
# add engine to list of result-engines
duplicated['engines'].add(result['engine'])
if result['engine'] not in duplicated['engines']:
duplicated['engines'].append(result['engine'])
# using https if possible
if duplicated['parsed_url'].scheme != 'https' and result['parsed_url'].scheme == 'https':
......
......@@ -119,9 +119,6 @@ def get_search_data(q, r):
results_number = 0
results = r.get_ordered_results()
for result in results:
result['engines'] = list(result['engines'])
if not type(result['engines']) is list:
print(result['engines'])
if 'publishedDate' in result:
try:
result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S')
......
......@@ -46,7 +46,7 @@ except:
from sys import exit
exit(1)
from cgi import escape
from html import escape
from datetime import datetime, timedelta
from werkzeug.contrib.fixers import ProxyFix
from flask import (
......@@ -486,8 +486,6 @@ def index():
# search
search_data = None
try:
print(request.form)
if is_general_first_page:
request.form['categories'] = ['general', 'videos', 'images']
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment