public inbox for [email protected]
help / color / mirror / Atom feedFrom: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch]: RM1171 - Fix IE caching issue
Date: Tue, 20 Sep 2016 19:28:55 +0530
Message-ID: <CAM5-9D8F3UQGEUMZzBY-N0rzVhmoYaBzmXUsNb3Khu7Yd-YheQ@mail.gmail.com> (raw)
In-Reply-To: <CAM5-9D-oAaDErm4CvPKYk+0NdSRJr_4xUesOL=etu2fUJKFXnQ@mail.gmail.com>
References: <CAM5-9D90JkDMwj+AqJQZGbpyHJdfy6Z6w2s7EtH3vGP7tmvapQ@mail.gmail.com>
<CAM5-9D-oAaDErm4CvPKYk+0NdSRJr_4xUesOL=etu2fUJKFXnQ@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Missed method closing parenthesis while calling
Please find updated patch
On Tue, Sep 20, 2016 at 7:25 PM, Surinder Kumar <
[email protected]> wrote:
> This patch has some issue in chrome while loading nodes. I will send
> updated patch.
>
> On Tue, Sep 20, 2016 at 7:16 PM, Surinder Kumar <
> [email protected]> wrote:
>
>> Hi
>>
>> *Issue:*
>> IE always caching the response data returned from the server and when
>> same request is made for next time, it doesn't bring new data, instead it
>> use cached data.
>>
>> *Solution:*
>> Set cache to '*no-cache*' in response headers while sending from the
>> server side. This prevents browser from caching data every time an http
>> request is made.
>>
>> Thanks to Harshal & Murtaza for discussing issue and solution.
>>
>> Please find attached patch and review.
>>
>>
>> Thanks,
>> Surinder Kumar
>>
>
>
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM1171_v1.patch (1.3K, 3-RM1171_v1.patch)
download | inline diff:
diff --git a/web/pgadmin/utils/ajax.py b/web/pgadmin/utils/ajax.py
index 0e11eac..0c8ad56 100644
--- a/web/pgadmin/utils/ajax.py
+++ b/web/pgadmin/utils/ajax.py
@@ -29,6 +29,18 @@ class DataTypeJSONEncoder(json.JSONEncoder):
return json.JSONEncoder.default(self, obj)
+def get_no_cache_header():
+ """
+ Prevent browser from caching data every time an
+ http request is made.
+ Returns: headers
+ """
+ headers = {}
+ headers["Cache-Control"] = "no-cache, no-store, must-revalidate" # HTTP 1.1.
+ headers["Pragma"] = "no-cache" # HTTP 1.0.
+ headers["Expires"] = "0" # Proxies.
+ return headers
+
def make_json_response(
success=1, errormsg='', info='', result=None, data=None, status=200
@@ -45,7 +57,8 @@ def make_json_response(
return Response(
response=json.dumps(doc, cls=DataTypeJSONEncoder),
status=status,
- mimetype="application/json"
+ mimetype="application/json",
+ headers=get_no_cache_header()
)
@@ -54,7 +67,8 @@ def make_response(response=None, status=200):
return Response(
response=json.dumps(response, cls=DataTypeJSONEncoder),
status=status,
- mimetype="application/json"
+ mimetype="application/json",
+ headers=get_no_cache_header()
)
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4][Patch]: RM1171 - Fix IE caching issue
In-Reply-To: <CAM5-9D8F3UQGEUMZzBY-N0rzVhmoYaBzmXUsNb3Khu7Yd-YheQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox