Commit 14c5ee77 authored by Romain Loth's avatar Romain Loth

fixes for minor reload problems

parent 10032b23
...@@ -7,7 +7,7 @@ from django import forms ...@@ -7,7 +7,7 @@ from django import forms
from urllib.parse import quote_plus as urlencode from urllib.parse import quote_plus as urlencode
from gargantext import settings from gargantext import settings
from sqlalchemy.orm.exc import DetachedInstanceError
# authentication # authentication
...@@ -19,7 +19,20 @@ def requires_auth(func): ...@@ -19,7 +19,20 @@ def requires_auth(func):
if not request.user.is_authenticated(): if not request.user.is_authenticated():
url = '/auth/login/?next=%s' % urlencode(request.path) url = '/auth/login/?next=%s' % urlencode(request.path)
return redirect(url) return redirect(url)
return func(request, *args, **kwargs) try:
# normal return the subfunction when user ok
return func(request, *args, **kwargs)
except DetachedInstanceError as die:
print("===\n" * 10)
print(die)
print("===\n" * 10)
# user was authenticated but something made it expire (session.commit ?)
session.rollback()
# and relogin for safety
url = '/auth/login/?next=%s' % urlencode(request.path)
return redirect(url)
return _requires_auth return _requires_auth
......
...@@ -2243,15 +2243,4 @@ function AfterAjax(sourceUrl) { ...@@ -2243,15 +2243,4 @@ function AfterAjax(sourceUrl) {
$("#content_loader").remove() $("#content_loader").remove()
$(".nav-tabs a").click(function(e){
e.preventDefault();
$(this).tab('show');
});
$('.nav-tabs a').on('shown.bs.tab', function(event){
var x = $(event.target).text(); // active tab
var y = $(event.relatedTarget).text(); // previous tab
$(".act span").text(x);
$(".prev span").text(y);
});
} }
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
{% endif %} {% endif %}
{% endifequal %} {% endifequal %}
{% endfor %} {% endfor %}
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content=" data-content="
<ul> <ul>
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
}, },
success: function(data) { success: function(data) {
console.log("in doTheQuery() Ajax.Success:") console.log("in doTheQuery() Ajax.Success:")
console.log(data) // console.log(data)
setTimeout( setTimeout(
function() { function() {
location.reload(); location.reload();
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
success: function(data) { success: function(data) {
console.log("SUCCESS") console.log("SUCCESS")
console.log("in getGlobalResults") console.log("in getGlobalResults")
console.log(data) // console.log(data)
console.log("enabling "+"#"+value.id) console.log("enabling "+"#"+value.id)
$("#"+value.id).attr('onclick','getGlobalResults(this);'); $("#"+value.id).attr('onclick','getGlobalResults(this);');
// $("#submit_thing").prop('disabled' , false) // $("#submit_thing").prop('disabled' , false)
...@@ -551,7 +551,7 @@ ...@@ -551,7 +551,7 @@
}, },
success: function(data) { success: function(data) {
console.log("ajax_success: in testISTEX()") console.log("ajax_success: in testISTEX()")
console.log(data) // console.log(data)
setTimeout( setTimeout(
function() { function() {
location.reload(); location.reload();
......
Markdown is supported
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