Re: [web2py] Re: Flash messages

2018-04-05 Thread Maurice Waka
Dave. Did you send a blank message?

On Thu, 5 Apr 2018, 00:13 Dave S  wrote:

>
>
> On Wednesday, April 4, 2018 at 2:37:07 AM UTC-7, Maurice Waka wrote:
>>
>> In web2py we have flash messages such as 'Success' when form is accepted
>> etc.
>> Is there a way to have an animation flash with a  message such as
>> 'loading', 'Please wait' in web2py as the page reloads?
>> *** My pages sometimes take a few more seconds to open e.g. switching
>> from index  page to other html.views.
>> Kind regards
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/gU1MOFTgeWs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to update script deployment with the latest master commit ?

2018-04-05 Thread icodk
Script  deployment ( ex. setup-web2py-nginx-uwsgi-ubuntu.sh) installs the 
latest release. 
how to update it to the latest master commit ?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to update script deployment with the latest master commit ?

2018-04-05 Thread 黄祥
perhaps you can change this part
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip

with (untested and assuming git already installed on your machine)
git clone --recursive https://github.com/web2py/web2py.git

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to update script deployment with the latest master commit ?

2018-04-05 Thread icodk
Yes this will probably work. Thanks
What I did was to delete web2py after script installation and clone it fro 
master.
Because only after the installation I discovered that there are some errors 
in the release that are fixed in the master.
( the error I found is in definition of fieldVirtual)

On Thursday, April 5, 2018 at 1:20:40 PM UTC+2, 黄祥 wrote:
>
> perhaps you can change this part
> wget http://web2py.com/examples/static/web2py_src.zip
> unzip web2py_src.zip
>
> with (untested and assuming git already installed on your machine)
> git clone --recursive https://github.com/web2py/web2py.git
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Flash messages

2018-04-05 Thread António Ramos
I guess you have to use ajax to load the page
for example use js
jQuery('#target').html("LOADING...");  //
this creates a spinner or a waiting message in the #target

ajax('"yoururl", [], 'target');when data received, replaces the
spinner. in the #target

Just an example . I´m sure there is other options...


regards

2018-04-04 10:37 GMT+01:00 Maurice Waka :

> In web2py we have flash messages such as 'Success' when form is accepted
> etc.
> Is there a way to have an animation flash with a  message such as
> 'loading', 'Please wait' in web2py as the page reloads?
> *** My pages sometimes take a few more seconds to open e.g. switching from
> index  page to other html.views.
> Kind regards
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-05 Thread Richard Vézina
Thank you Anthony as always very clear explanations.

:)

Richard

On Wed, Apr 4, 2018 at 5:19 PM, Anthony  wrote:

> This behavior is controlled by the following auth.settings:
>
> renew_session_onlogin (default=True)
> keep_session_onlogin (default=True)
> renew_session_onlogout (default=True)
> keep_session_onlogout (default=False)
>
> Renewing the session causes a new session ID and therefore file to be
> created -- that explains why the new files are created on both login and
> logout.
>
> Keeping the session means that the content of the session is retained when
> the session is renewed. If keep is set to False, then the old file is
> deleted when the session is renewed (but the old file is not deleted when
> the keep is set to True). That explains why the old file is deleted on
> logout but not on login (given the above noted defaults). I believe this
> should probably be considered a bug -- the old file should be deleted in
> either case (the problem is that in the code, the file deletion happens in
> the same method that clears the session data, and of course that method is
> not called when the session is kept). Feel free to file a Github issue
> about this and refer back to this thread.
>
> For now, if you don't need to retain any session data upon login (i.e.,
> session data stored before login does not need to remain available once
> logged in), then you can set auth.settings.keep_session_onlogin=False,
> and the old session file will be deleted upon login (so, at any given time,
> there will be only one session file for a given user session).
>
> Alternatively, of course you can set either or both of the renew_session_*
> settings to False, and no additional session files will be created on login
> or logout.
>
> Anthony
>
> On Tuesday, April 3, 2018 at 1:01:21 PM UTC-4, AlighaThor wrote:
>>
>> Hi. I'm experimenting for the first time (but I'm quite a bit old using
>> this amazing framework :)) storing sessions in the DB instead the
>> filesystem, as I always did. I'm monitoring those two behaviours and
>> somehow it feels (at least for me) that the DB session handling is far away
>> more efficient/manteinable than the filesystem session handling.
>>
>> Look at this:
>>
>> *When using the filesystem handling:*
>>
>> 1 - I go to my login form. A session file is created (for the form key I
>> suposse.).
>>
>>
>>
>> 
>>
>>
>> 2 - Then I finally log in. Another session file is created.
>>
>>
>> 
>>
>>
>> 3 - Next I log out. A new file is created or somehow "moved" or "deleted"
>> from the directory "165".
>>
>>
>> 
>>
>> 4 - Next I log in again. This time my form action did not create any new
>> file, but a new one after the log in.
>>
>>
>> 
>>
>>
>> 5 - Everything is repeated again. I log out, then a new file is created.
>>
>>
>> *Now let's see the DB behaviour:*
>>
>>
>> 1 - Login form. A session record is created.
>>
>>
>>
>> 
>>
>>
>> 2 - I log in. The same record remains, but instead, as we expect, the
>> unique_key is updated.
>>
>>
>> 
>>
>> 3 - I log out. Again, the record remains and the unique_key field is
>> updated.
>>
>>
>>
>> 
>>
>>
>> (Updated: My bad, after the log out, the record is deleted and a new one
>> is created. I did'nt notice the new ID "17".)
>>
>>
>> Whatever I do, only one record is stored according my session origin (IP,
>> Browser, etc) and this remains true until my session expires or is deleted.
>>
>> Maybe I'm talking nonesenses, but it is feel "better" to me, having a
>> "true one instance per session", using the DB, that many files/folders
>> created over and over again related to the same origin using the filesystem.
>>
>> What I am missing here?
>> Is this the normal/expected behaviour when the default FS session
>> handling is used?
>> Can we consider that is more performant using the DB alternative that the
>> FS one?
>>
>> BTW: It seems that the admin option to "cleanup" only clear the sessions
>> store in the filesystem, not the DB alternative.
>>
>> T

[web2py] Web2py locks row at auth_user and web2py_session_* tables and doesn't unlock them

2018-04-05 Thread Lisandro
Hi there! This is somehow related to this other topic [1], which I have 
closed because I've found some new evidence and I though it would be better 
to open a new topic.

I'm having this problem where a simple select on auth_user table hangs 
indefinitely, until timeout.
The problem occurs in one specific user account. The user logs in, but 
after the successfull login, any request hangs.
I checked the postgres long running queries and I see this query hanging 
until timeout:

SELECT auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.
email, auth_user.password, auth_user.registration_key, auth_user.
reset_password_key, auth_user.registration_id, auth_user.alta,auth_user.
plantel, auth_user.responsable, auth_user.nombre, auth_user.telefono, 
auth_user.autor, auth_user.foto, auth_user.foto_temp, auth_user.moderador, 
auth_user.descripcion, auth_user.facebook,auth_user.twitter, auth_user.
linkedin, auth_user.gplus FROM auth_user WHERE (auth_user.id = 2) LIMIT 1 
OFFSET 0;


As you see, the query is a simple select to the auth_user table. Also, 
notice that it uses LIMIT, so it retrieves one only row.
Additionally, I can confirm that the table has only four rows.

I went a little further, and I checked the pg_locks at postgres when the 
problem is happening (that is, during the 60 seconds until timeout).
This is the query I run to check the locks and this is what I see during 
that time:

select t.relname,l.locktype,page,virtualtransaction,pid,mode,granted from 
pg_locks l, pg_stat_all_tables t where l.relation=t.relid order by relation 
asc;


   relname   | locktype | page | virtualtransaction | pid  | 
 mode   | granted 
-+--+--++--+-+-
 pg_class| relation |  | 70/908027  | 4421 | 
AccessShareLock | t
 pg_index| relation |  | 70/908027  | 4421 | 
AccessShareLock | t
 pg_namespace| relation |  | 70/908027  | 4421 | 
AccessShareLock | t
 web2py_session_infosanpedro | relation |  | 16/1858255 | 9865 | 
AccessShareLock | t
 auth_user   | relation |  | 16/1858255 | 9865 | 
AccessShareLock | t
(5 rows)


*Notice the lock of the web2py_session_* and auth_user tables.*
*That lock is there during the whole 60 seconds, until timeout*.

After timeout, the lock isn't there anymore.
If I reload the page, again, the lock appears and the request hangs until 
timeout.

All the other user accounts can login normally.
Also, there is nothing particularly different with the user account having 
the problem (it's an account like any other else).
Of course, I already tried to delete everything from the web2py_session 
table, but it doesn't work, the problem remains.

Where else should I look? 
Would it help if I share with you the app code for the login? It doesn't do 
any tricky stuff.
What concerns me is that the problem is generated in one specific account, 
but in several of our customers (we have the same web2py app installed for 
every one of our customers, each one has its own database). The same 
problem is happening randomly in a few accounts. Database activity is 
really low.

I'm pretty lost here, so any help or suggestion will be appreciated.
Thanks in advance.
Regards,
Lisandro


[1] https://groups.google.com/forum/#!topic/web2py/o0FBeimrr5c

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Stephan
Hi Antony, 
does not seem to work.
I still get an error by setting migrate to true. In which directory are the 
*.table file written to? 
thx



 (1050, "Table 'auth_user' 
already exists")Version
web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.

Traceback (most recent call last):
  File "/home/mhoch4/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File "/home/mhoch4/web2py/applications/psychogramm/models/db.py" 
,
 line 53, in 
auth.define_tables(username=False, signature=False)
  File "/home/mhoch4/web2py/gluon/tools.py", line 1737, in define_tables
format='%(first_name)s %(last_name)s (%(id)s)'))
  File "/home/mhoch4/web2py/gluon/dal.py", line 8139, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/home/mhoch4/web2py/gluon/dal.py", line 8176, in lazy_define_table
polymodel=polymodel)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1058, in create_table
self.create_sequence_and_triggers(query,table)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1899, in 
create_sequence_and_triggers
self.execute(query)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1916, in execute
return self.log_execute(*a, **b)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1910, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, 
in execute
self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 
36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1050, "Table 'auth_user' already exists")

Am Dienstag, 3. April 2018 21:17:52 UTC+2 schrieb Anthony:
>
> Probably you don't have *.table files indicating the current status of the 
> database schema. First, without the new column in the code, run a request 
> with fake_migrate_all=True, which will create an updated set of *.table 
> files. Then add the new column, and the migration should work.
>
> Anthony
>
> On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:
>>
>> I am getting an "tables already exist" error after adding column to an 
>> existing table in db.py  and setting migrate from false to true. It's 
>> connected to a mysql. Application is running in version 2.8.2. Is there 
>> some cahce to be cleared? thx
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Request with login privileges hangs for a specific user account, how to debug it?

2018-04-05 Thread Anthony
On Tuesday, April 3, 2018 at 8:43:31 AM UTC-4, Lisandro wrote:
>
> I store the sessions in the database, so there is no problem with a locked 
> file.
>
> I've just found something interesting that could help to figure out: when 
> the problem presents, I checked the pg_stat_activity in postgres to see if 
> there was a long running query, and there is indeed. But the query is a 
> simple select to the auth_user table, to select the row of the logged in 
> user. How can this query take that long? Does web2py lock the user row? If 
> so, how do I release it?
>
> Something to consider: in my db.py, at the end, I do this:
>
> response.user = db.auth_user[auth.user.id] if auth.is_logged_in() else 
> None
>

FYI, auth.user is the user's record from db.auth_user (minus the password 
field and the update_record and delete_record attributes), so depending on 
what you are doing with response.user, you might be able to replace the 
above with:

response.user = auth.user

Or just use auth.user directly in your code.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Request with login privileges hangs for a specific user account, how to debug it?

2018-04-05 Thread Lisandro
Thank you Anthony, yes I'm aware of that.
I use it like that for this reason: sometimes (not very often) an external 
app modifies a field of the auth_user table (specifically, it sets true or 
false a field that I use as a flag). However that change isn't updated to 
auth.user. In order to do so, the user needs to logout and login again. So 
I retrieve the auth_user record again and store it to response.answer.

Maybe it could be done like this:
if auth.is_logged_in():
auth.user = db.auth_user[auth.user.id]

But I thought it could be break something with Auth methods, so I store it 
in response.user.

Anyway, I set this topic as "no action needed" because I opened a new 
topic, I've found some more info and I think the issue isn't related to 
that sentence. In fact, if it was related to that sentence, the problem 
would trigger with every user account. Today we just had two more of those 
cases. This is the new topic I posted:
https://groups.google.com/forum/#!topic/web2py/E9jrmf5E-B4

Regards,
Lisandro.


El jueves, 5 de abril de 2018, 12:55:26 (UTC-3), Anthony escribió:
>
> On Tuesday, April 3, 2018 at 8:43:31 AM UTC-4, Lisandro wrote:
>>
>> I store the sessions in the database, so there is no problem with a 
>> locked file.
>>
>> I've just found something interesting that could help to figure out: when 
>> the problem presents, I checked the pg_stat_activity in postgres to see if 
>> there was a long running query, and there is indeed. But the query is a 
>> simple select to the auth_user table, to select the row of the logged in 
>> user. How can this query take that long? Does web2py lock the user row? If 
>> so, how do I release it?
>>
>> Something to consider: in my db.py, at the end, I do this:
>>
>> response.user = db.auth_user[auth.user.id] if auth.is_logged_in() else 
>> None
>>
>
> FYI, auth.user is the user's record from db.auth_user (minus the password 
> field and the update_record and delete_record attributes), so depending on 
> what you are doing with response.user, you might be able to replace the 
> above with:
>
> response.user = auth.user
>
> Or just use auth.user directly in your code.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Allow to add new record from formdropdown list

2018-04-05 Thread greenpoise
nevermind. Figured this one out. It does take you away from the page 
though. Or so it seams like.


On Wednesday, April 4, 2018 at 4:33:15 PM UTC-7, greenpoise wrote:
>
> how can I test this? I tried following your example. Trying to accomplish 
> the same. Thanks
>
> On Thursday, March 22, 2018 at 3:33:29 AM UTC-7, 黄祥 wrote:
>>
>> perhaps you can do it with bootstrap modal (in views) and dal table 
>> constructor comment
>> *e.g. (not tested)*
>> *models/db.**py*
>> db.Firmware.DeviceID.comment = A(_class="glyphicon glyphicon-plus-sign", 
>> **{"_data-toggle":"modal", "_data-target":"#modal_device"} )
>>
>> *controllers**/default.**py*
>> def modal_device():
>>  table = db.Device
>>  fields = None
>>  target_response = '(function($) 
>> {$("#modal_device").modal("hide");}(jQuery));'
>>  form = SQLFORM(table, fields = fields)
>>  if form.process(formname = 'form_modal').accepted:
>>  response.js = target_response
>>  redirect(request.env.http_web2py_component_location, client_side = True)
>>  elif form.errors:
>>  response.flash = 'form has errors'
>>  return dict(form = form)
>>
>> def firmware():
>>  table = db.Firmware
>>  grid = SQLFORM.grid(table)
>>  return locals()
>>
>> *views**/default/modal_device.**load*
>> {{=form}}
>>
>> *views**/default/firmware.**html*
>> {{extend 'layout.html'}}
>> {{=grid}}
>> > aria-labelledby="myModalLabel">
>>  
>>  
>>  
>>  > "Close">×
>>  {{=DIV(T('Device') ) }}
>>  
>>  
>>  {{=LOAD('master_marketing', 'modal_device.load', ajax = True) }}
>>  
>>  
>>  
>> 
>>
>>
>> best regards,
>> stifan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web2py locks row at auth_user and web2py_session_* tables and doesn't unlock them

2018-04-05 Thread Anthony
For any select that takes place within a transaction, Postgres by default 
automatically acquires a access share lock on the involved tables, so this 
should be happening on all requests. However, access share locks do not 
conflict with each other, so I don't think these locks are necessarily the 
source of your problem.

Anthony

On Thursday, April 5, 2018 at 10:58:07 AM UTC-4, Lisandro wrote:
>
> Hi there! This is somehow related to this other topic [1], which I have 
> closed because I've found some new evidence and I though it would be better 
> to open a new topic.
>
> I'm having this problem where a simple select on auth_user table hangs 
> indefinitely, until timeout.
> The problem occurs in one specific user account. The user logs in, but 
> after the successfull login, any request hangs.
> I checked the postgres long running queries and I see this query hanging 
> until timeout:
>
> SELECT auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.
> email, auth_user.password, auth_user.registration_key, auth_user.
> reset_password_key, auth_user.registration_id, auth_user.alta,auth_user.
> plantel, auth_user.responsable, auth_user.nombre, auth_user.telefono, 
> auth_user.autor, auth_user.foto, auth_user.foto_temp, auth_user.moderador, 
> auth_user.descripcion, auth_user.facebook,auth_user.twitter, auth_user.
> linkedin, auth_user.gplus FROM auth_user WHERE (auth_user.id = 2) LIMIT 1 
> OFFSET 0;
>
>
> As you see, the query is a simple select to the auth_user table. Also, 
> notice that it uses LIMIT, so it retrieves one only row.
> Additionally, I can confirm that the table has only four rows.
>
> I went a little further, and I checked the pg_locks at postgres when the 
> problem is happening (that is, during the 60 seconds until timeout).
> This is the query I run to check the locks and this is what I see during 
> that time:
>
> select t.relname,l.locktype,page,virtualtransaction,pid,mode,granted from 
> pg_locks l, pg_stat_all_tables t where l.relation=t.relid order by 
> relation asc;
>
>
>relname   | locktype | page | virtualtransaction | pid 
>  |  mode   | granted 
>
> -+--+--++--+-+-
>  pg_class| relation |  | 70/908027  | 4421 
> | AccessShareLock | t
>  pg_index| relation |  | 70/908027  | 4421 
> | AccessShareLock | t
>  pg_namespace| relation |  | 70/908027  | 4421 
> | AccessShareLock | t
>  web2py_session_infosanpedro | relation |  | 16/1858255 | 9865 
> | AccessShareLock | t
>  auth_user   | relation |  | 16/1858255 | 9865 
> | AccessShareLock | t
> (5 rows)
>
>
> *Notice the lock of the web2py_session_* and auth_user tables.*
> *That lock is there during the whole 60 seconds, until timeout*.
>
> After timeout, the lock isn't there anymore.
> If I reload the page, again, the lock appears and the request hangs until 
> timeout.
>
> All the other user accounts can login normally.
> Also, there is nothing particularly different with the user account having 
> the problem (it's an account like any other else).
> Of course, I already tried to delete everything from the web2py_session 
> table, but it doesn't work, the problem remains.
>
> Where else should I look? 
> Would it help if I share with you the app code for the login? It doesn't 
> do any tricky stuff.
> What concerns me is that the problem is generated in one specific account, 
> but in several of our customers (we have the same web2py app installed for 
> every one of our customers, each one has its own database). The same 
> problem is happening randomly in a few accounts. Database activity is 
> really low.
>
> I'm pretty lost here, so any help or suggestion will be appreciated.
> Thanks in advance.
> Regards,
> Lisandro
>
>
> [1] https://groups.google.com/forum/#!topic/web2py/o0FBeimrr5c
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Request with login privileges hangs for a specific user account, how to debug it?

2018-04-05 Thread Anthony
On Thursday, April 5, 2018 at 2:57:20 PM UTC-4, Lisandro wrote:
>
> Thank you Anthony, yes I'm aware of that.
> I use it like that for this reason: sometimes (not very often) an external 
> app modifies a field of the auth_user table (specifically, it sets true or 
> false a field that I use as a flag). However that change isn't updated to 
> auth.user. In order to do so, the user needs to logout and login again. So 
> I retrieve the auth_user record again and store it to response.answer.
>
> Maybe it could be done like this:
> if auth.is_logged_in():
> auth.user = db.auth_user[auth.user.id]
>
> But I thought it could be break something with Auth methods, so I store it 
> in response.user.
>

Got it. Yeah, don't replace auth.user -- create a separate variable.
 

> Anyway, I set this topic as "no action needed" because I opened a new 
> topic, I've found some more info and I think the issue isn't related to 
> that sentence.
>

But you indicated the select generated by that code was causing Postgres to 
hang. Are you sure that is the case? In other words, is the web2py code 
getting stuck at that line and ultimately causing your server to time out? 
Have you tried adding some logging statements to your code to determine 
exactly where it is getting stuck?

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Anthony
Need to see your code. With fake_migrate_all=True, the DAL will generate 
migration files but no run any migrations, so you cannot get that error.

Anthony

On Thursday, April 5, 2018 at 11:49:38 AM UTC-4, Stephan wrote:
>
> Hi Antony, 
> does not seem to work.
> I still get an error by setting migrate to true. In which directory are 
> the *.table file written to? 
> thx
>
>
>
>  (1050, "Table 'auth_user' 
> already exists")Version
> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
>
> Traceback (most recent call last):
>   File "/home/mhoch4/web2py/gluon/restricted.py", line 217, in restricted
> exec ccode in environment
>   File "/home/mhoch4/web2py/applications/psychogramm/models/db.py" 
> ,
>  line 53, in 
> auth.define_tables(username=False, signature=False)
>   File "/home/mhoch4/web2py/gluon/tools.py", line 1737, in define_tables
> format='%(first_name)s %(last_name)s (%(id)s)'))
>   File "/home/mhoch4/web2py/gluon/dal.py", line 8139, in define_table
> table = self.lazy_define_table(tablename,*fields,**args)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 8176, in lazy_define_table
> polymodel=polymodel)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1058, in create_table
> self.create_sequence_and_triggers(query,table)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1899, in 
> create_sequence_and_triggers
> self.execute(query)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1916, in execute
> return self.log_execute(*a, **b)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1910, in log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, 
> in execute
> self.errorhandler(self, exc, value)
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 
> 36, in defaulterrorhandler
> raise errorclass, errorvalue
> OperationalError: (1050, "Table 'auth_user' already exists")
>
> Am Dienstag, 3. April 2018 21:17:52 UTC+2 schrieb Anthony:
>>
>> Probably you don't have *.table files indicating the current status of 
>> the database schema. First, without the new column in the code, run a 
>> request with fake_migrate_all=True, which will create an updated set of 
>> *.table files. Then add the new column, and the migration should work.
>>
>> Anthony
>>
>> On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:
>>>
>>> I am getting an "tables already exist" error after adding column to an 
>>> existing table in db.py  and setting migrate from false to true. It's 
>>> connected to a mysql. Application is running in version 2.8.2. Is there 
>>> some cahce to be cleared? thx
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Stephan
I got the error afterwards, i.e. I ran fake_migration_all (without errors) 
and then I altered a table and kicked migrate=true. That's where I ran into 
the same error as before.

Am Donnerstag, 5. April 2018 22:54:16 UTC+2 schrieb Anthony:
>
> Need to see your code. With fake_migrate_all=True, the DAL will generate 
> migration files but no run any migrations, so you cannot get that error.
>
> Anthony
>
> On Thursday, April 5, 2018 at 11:49:38 AM UTC-4, Stephan wrote:
>>
>> Hi Antony, 
>> does not seem to work.
>> I still get an error by setting migrate to true. In which directory are 
>> the *.table file written to? 
>> thx
>>
>>
>>
>>  (1050, "Table 'auth_user' 
>> already exists")Version
>> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>> 23.
>> 24.
>> 25.
>>
>> Traceback (most recent call last):
>>   File "/home/mhoch4/web2py/gluon/restricted.py", line 217, in restricted
>> exec ccode in environment
>>   File "/home/mhoch4/web2py/applications/psychogramm/models/db.py" 
>> ,
>>  line 53, in 
>> auth.define_tables(username=False, signature=False)
>>   File "/home/mhoch4/web2py/gluon/tools.py", line 1737, in define_tables
>> format='%(first_name)s %(last_name)s (%(id)s)'))
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 8139, in define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 8176, in lazy_define_table
>> polymodel=polymodel)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1058, in create_table
>> self.create_sequence_and_triggers(query,table)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1899, in 
>> create_sequence_and_triggers
>> self.execute(query)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1916, in execute
>> return self.log_execute(*a, **b)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1910, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 
>> 205, in execute
>> self.errorhandler(self, exc, value)
>>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 
>> 36, in defaulterrorhandler
>> raise errorclass, errorvalue
>> OperationalError: (1050, "Table 'auth_user' already exists")
>>
>> Am Dienstag, 3. April 2018 21:17:52 UTC+2 schrieb Anthony:
>>>
>>> Probably you don't have *.table files indicating the current status of 
>>> the database schema. First, without the new column in the code, run a 
>>> request with fake_migrate_all=True, which will create an updated set of 
>>> *.table files. Then add the new column, and the migration should work.
>>>
>>> Anthony
>>>
>>> On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:

 I am getting an "tables already exist" error after adding column to an 
 existing table in db.py  and setting migrate from false to true. It's 
 connected to a mysql. Application is running in version 2.8.2. Is there 
 some cahce to be cleared? thx

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Anthony
On Thursday, April 5, 2018 at 5:39:38 PM UTC-4, Stephan wrote:
>
> I got the error afterwards, i.e. I ran fake_migration_all (without errors) 
> and then I altered a table and kicked migrate=true. That's where I ran into 
> the same error as before.
>

*.table files are in the /databases folder. There should be a file for the 
table in question. Hard to say more without seeing your code and what's in 
the /databases folder.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.