0001-misc-use-mtime-of-schema-as-last-update-time-41836.patch
bijoe/schemas.py | ||
---|---|---|
415 | 415 | |
416 | 416 | |
417 | 417 |
class Warehouse(Base): |
418 |
__slots__ = ['name', 'slug', 'label', 'pg_dsn', 'search_path', 'cubes', 'path'] |
|
418 |
__slots__ = ['name', 'slug', 'label', 'pg_dsn', 'search_path', 'cubes', 'path', 'timestamp']
|
|
419 | 419 |
__types__ = { |
420 | 420 |
'name': str, |
421 | 421 |
'slug': str, |
bijoe/templates/bijoe/cube.html | ||
---|---|---|
71 | 71 |
<a rel="popup" href="{% url "create-visualization" warehouse=warehouse.name cube=cube.name %}?{% firstof view.request.POST.urlencode view.request.GET.urlencode %}" |
72 | 72 |
title="{{ visualization.title }}" class="button">{% trans "Save" %}</a> |
73 | 73 |
{% endblock %} |
74 |
<p>{% trans "Last update" %} {{ warehouse.timestamp }}</p> |
|
74 | 75 |
{% else %} |
75 | 76 |
<div class="big-msg-info">{% trans "Please choose some measures and groupings." %}</div> |
76 | 77 |
{% endif %} |
bijoe/templates/bijoe/homepage.html | ||
---|---|---|
21 | 21 |
{% if visualizations %} |
22 | 22 |
{% include "bijoe/visualizations_list.html" %} |
23 | 23 |
{% else %} |
24 |
{% trans "No visualizations to display yet." %} |
|
24 |
{% trans "No visualizations to display yet." %})
|
|
25 | 25 |
{% endif %} |
26 | 26 |
{% if warehouses %} |
27 | 27 |
<h2>{% trans "Data sources" %}</h2> |
28 | 28 |
<ul class="objects-list single-links bijoe-warehouses"> |
29 | 29 |
{% for warehouse in warehouses %} |
30 | 30 |
{% url 'warehouse' warehouse=warehouse.name as warehouse_url %} |
31 |
<li><a href="{{ warehouse_url }}">{{ warehouse.label }}</a></li> |
|
31 |
<li> |
|
32 |
<a href="{{ warehouse_url }}">{{ warehouse.label }} ({% trans "last update" %} {{ warehouse.timestamp}})</a> |
|
33 |
</li> |
|
32 | 34 |
{% endfor %} |
33 | 35 |
</ul> |
34 | 36 |
{% endif %} |
bijoe/templates/bijoe/warehouse.html | ||
---|---|---|
12 | 12 |
{% endblock %} |
13 | 13 | |
14 | 14 |
{% block content %} |
15 |
<p>{% trans "Last update " %} {{ warehouse.timestamp }}</p> |
|
15 | 16 |
<table class="bijoe-table bijoe-form-table main"> |
16 | 17 |
<thead> |
17 | 18 |
<tr> |
bijoe/utils.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
import datetime |
|
17 | 18 |
import os |
18 | 19 |
import glob |
19 | 20 |
import json |
... | ... | |
21 | 22 |
from django.conf import settings |
22 | 23 |
from django.db import connection, transaction |
23 | 24 |
from django.utils.translation import ugettext as _ |
25 |
from django.utils.timezone import utc |
|
26 | ||
24 | 27 |
try: |
25 | 28 |
from functools import lru_cache |
26 | 29 |
except ImportError: |
... | ... | |
41 | 44 | |
42 | 45 |
@lru_cache() |
43 | 46 |
def get_warehouse_by_path_and_mtime(path, mtime): |
44 |
warehouse = json.load(open(path)) |
|
47 |
with open(path) as fd: |
|
48 |
warehouse = json.load(fd) |
|
45 | 49 |
warehouse['path'] = path |
50 |
warehouse['timestamp'] = datetime.datetime.fromtimestamp(os.path.getmtime(path), utc) |
|
46 | 51 |
return Warehouse.from_json(warehouse) |
47 | 52 | |
48 | 53 | |
49 |
- |