So, I spend the best part of the day playing with your example but wasn't
able to make it work.
The best I have is that I see that before the form is submitted
*getprogress* is called and return the expected value, but while progress
is running it blocks the invocation of *getprogress* and the
Ill try to explain it here but this is gonna require a video tutorial:
First there are several ways to achieve it. Although Anthony's suggestion
(cache.ram) is optimal it didnt work on production, I dont know why
cache.ram doesnt work on pythonanywhere.
I got the progress bar working on product
Alfonso, so if you have a working progress bar, can you please post your
complete solution (with a view and java-script) here?
TIA,
On Thursday, February 18, 2016 at 2:21:01 AM UTC+2, Alfonso Serra wrote:
>
> Omg it did work!. Thanks you very much Anthony, i owe you one.
>
> Console log:
> progr
Try calling session.connect().
Anthony
On Monday, February 22, 2016 at 4:18:10 PM UTC-5, Dan wrote:
>
> I've hit another obstacle using *session.forget(response)...*
>
> In the same controller / function where I'm using this
> session.forget(response) for the progress bar (ajax) to work properly
I've hit another obstacle using *session.forget(response)...*
In the same controller / function where I'm using this
session.forget(response) for the progress bar (ajax) to work properly, I
cannot use any session variables (since these are "forgotten" as per the
command above) ?!
Is there a wa
I am working on a progress bar and I have used the suggestion on this post
to use *cache.ram* as the mechanism to update the client (via ajax call)
while the controller (on the server) is still working.
Using cache makes sense, since a global variable defined in a model such as
db.py cannot be u
Omg it did work!. Thanks you very much Anthony, i owe you one.
Console log:
progress -1
progress -1
main: 0
progress 0
main: 1
progress 1
main: 2
progress 2
main: 3
progress 3
main: 4
progress 4
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web
> return cache.ram.storage['message'][1]
>
Where did you see that as the way to access cached values? That is not the
proper API. Note, cache.ram.storage is not initialized until cache.ram has
been called at least once, so unless you have a cache.ram() somewhere prior
in the same request,
Ive adapted the code to use cache.ram, but the docs about this mechanism is
quite confusing, and i can't get it to work.
There are several questions like,
how to store simple values instead callables?
what happens if i access a cache value after expiration?
This is the code:
def getprogress()
Yes, I would say cache.ram might be a better approach. Also, keep in mind
that although you might want to check every second or two, you don't have
to update the progress variable after every single record insertion. For
example, for a precision of 1%, just update the progress after every 300
i
>
>
> Perhaps you should update a field in some db table and use it instead of
> session.
>
Please note that the end of this, is to create an ajax progress bar that
indicates the numbers of records being inserted on a request.
Although that might work as well, still it isnt good to read and w
On 17-02-2016 00:17, Alfonso Serra wrote:
> Thanks Anthony, it does work.
>
> The hack is easy to implement, but to represent the insertion of 30k records
> into the database, writing the session file and connecting 30k times might not
> be optimal.
>
Perhaps you should update a field in some db
Thanks Anthony, it does work.
The hack is easy to implement, but to represent the insertion of 30k
records into the database, writing the session file and connecting 30k
times might not be optimal.
Theres a chapter about the Scheduler that may work for this. Ill read about
it, it has something
Here's a hack that might work:
def progress():
# when a form is submitted, change progress each second
if request.post_vars:
for i in range(5):
session.progress = i
# Write to the session file and unlock/close it.
session._try_store_in_file(reque
During a single request, the "session" object is just a copy of the session
data stored in the session file. Any updates to the session during a
request are not written back out to the session file until after the
request has completed. So, in the progress() function, you are not updating
the s
15 matches
Mail list logo