Prechádzať zdrojové kódy

[core] ConditionalGetMiddleware should import `parse_http_date_safe`

Fix 500 error on some etag cache cases
Fix creating a new query in DB Query
Romain Rigaux 11 rokov pred
rodič
commit
1bab576a9a

+ 4 - 2
apps/rdbms/src/rdbms/views.py

@@ -15,8 +15,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from functools import wraps
 import logging
+import json
+
+from functools import wraps
 
 from django.utils.translation import ugettext as _
 from django.core.urlresolvers import reverse
@@ -70,7 +72,7 @@ def execute_query(request, design_id=None, query_history_id=None):
 
   return render('execute.mako', request, {
     'action': action,
-    'doc_id': design.id and design.doc.get().id,
+    'doc_id': json.dumps(design.id and design.doc.get().id),
     'design': design,
     'autocomplete_base_url': reverse('rdbms:api_autocomplete_databases', kwargs={}),
     'can_edit_name': design.id and not design.is_auto,

+ 2 - 1
desktop/core/src/desktop/middleware.py

@@ -638,6 +638,7 @@ class EnsureSafeRedirectURLMiddleware(object):
     else:
       return response
 
+
 # FIXME: This was backported from Django 1.5 to work around streaming generator
 # responses incorrectly getting a length returned with the response. This can
 # be removed once we upgrade.
@@ -650,7 +651,7 @@ class ConditionalGetMiddleware(object):
     Also sets the Date and Content-Length response-headers.
     """
     def process_response(self, request, response):
-        from django.utils.http import http_date
+        from django.utils.http import http_date, parse_http_date_safe
 
         response['Date'] = http_date()
         if not getattr(response, 'streaming', False) and not response.has_header('Content-Length'):