[web2py] How to capture auth_user.id during registration

2015-04-27 Thread Anthony
In form.vars, it's just id, not auth_user.id.

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] Cron @reboot and socket server on web2py startup

2015-04-27 Thread tommasot
I want run a simple script on web2py startup,that listen on a tcp port

the script is the following example.py. The file in the 
applications/myapp/cron folder



*import SocketServer*
*import logging*

*class MyTCPHandler(SocketServer.BaseRequestHandler):*


*# handle syslog event message*
* def handle(self):*
* self.logger = logging.getLogger(web2py.app.easylog)*
* self.logger.setLevel(logging.DEBUG)*
* messagelog = self.request.recv(1024).strip()*
* self.logger.info(messagelog)*

*if __name__ == __main__:*
* HOST, PORT = 0.0.0.0, 514*
* servertcp = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)*


* servertcp.serve_forever()*

i have created into the cron folder the crontab file with the following 
content:
*@reboot root *applications/easylog/cron/example.py*

*i run web2py with the following shell command sudo python web2py.py -Y*

*The first time web2py is running everything works fine and i am able to 
connect with telnet on port 514*

*If i kill web2py and restart it the no more open port on 514*

*The question is Why? *

-- 
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: Email auth settings

2015-04-27 Thread Gael Princivalle
Thanks a lot Anthony.

However I don't understand how using form.vars.field_name in 
auth.settings.register_onaccept.
Can you give me an example?

auth.settings.register_onaccept = lambda user: mail.send(to=
'myem...@mydomain.com',subject='New user on mydomain.com',message='htmlFirst 
name of the new user: ' + form.vars.first_name + '/html')

This give me an error, global name form is not defined.


Il giorno lunedì 27 aprile 2015 01:23:02 UTC+2, Anthony ha scritto:

 On Sunday, April 26, 2015 at 4:07:40 PM UTC-4, Gael Princivalle wrote:

 Hi all.

 I would like to customize emails that web2py send to the user for email 
 verification and password change.
 For example now I have for email verification:
 Welcome mye...@mydomain.com javascript:! Click on the link http... to 
 verify your email


 auth.messages.verify_email and auth.messages.verify_email_subject. The 
 former can contain string formatting keys with the names of any fields in 
 the registration form as well as link (e.g., Welcome %(first_name)s 
 %(last_name)s. Click on the link %(link)s to verify your email.).
  

 Another thing, how is it possible to have the last registered user row in 
 auth.settings.register_onaccept?
 I would like to send an email when a new user sign in.
 auth.settings.register_onaccept = lambda user: mail.send(to='
 my_e...@my_domain.com javascript:',subject='New user on 
 my_domain.com',message='htmlNew 
 user on my_domain.combr/' + user.first_name + '/html')


 The form object is passed to register_onaccept, so you can access all the 
 values entered by the user via form.vars (i.e., form.vars.email, 
 form.vars.first_name, etc.).

 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: Email auth settings

2015-04-27 Thread Anthony
No, the one and only argument passed to the callback is the form (not the 
user record), so it might be more clear if you change your lambda argument 
name to form instead of user.

lambda form: ... form.vars.first_name ...

Anthony

On Monday, April 27, 2015 at 4:35:55 PM UTC-4, Gael Princivalle wrote:

 Thanks a lot Anthony.

 However I don't understand how using form.vars.field_name in 
 auth.settings.register_onaccept.
 Can you give me an example?

 auth.settings.register_onaccept = lambda user: mail.send(to='
 myem...@mydomain.com',subject='New user on mydomain.com',message='htmlFirst 
 name of the new user: ' + form.vars.first_name + '/html')

 This give me an error, global name form is not defined.


 Il giorno lunedì 27 aprile 2015 01:23:02 UTC+2, Anthony ha scritto:

 On Sunday, April 26, 2015 at 4:07:40 PM UTC-4, Gael Princivalle wrote:

 Hi all.

 I would like to customize emails that web2py send to the user for email 
 verification and password change.
 For example now I have for email verification:
 Welcome mye...@mydomain.com! Click on the link http... to verify your 
 email


 auth.messages.verify_email and auth.messages.verify_email_subject. The 
 former can contain string formatting keys with the names of any fields in 
 the registration form as well as link (e.g., Welcome %(first_name)s 
 %(last_name)s. Click on the link %(link)s to verify your email.).
  

 Another thing, how is it possible to have the last registered user row 
 in auth.settings.register_onaccept?
 I would like to send an email when a new user sign in.
 auth.settings.register_onaccept = lambda user: mail.send(to='
 my_e...@my_domain.com',subject='New user on 
 my_domain.com',message='htmlNew 
 user on my_domain.combr/' + user.first_name + '/html')


 The form object is passed to register_onaccept, so you can access all the 
 values entered by the user via form.vars (i.e., form.vars.email, 
 form.vars.first_name, etc.).

 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] How to capture auth_user.id during registration

2015-04-27 Thread Alex Glaros
How to capture auth_user.id during registration

Code is below.  No error message but the value is None instead of the 
auth_user.id

It correctly captures first_name and last_name from auth_user form vars.


form=SQLFORM.factory(db.SuperObject,db.Party,db.auth_user,db.PartyAddressIntersection,db.Address)
 
if form.process().accepted:
response.flash='Thanks for filling the form'
form.vars.displayName = form.vars.objectDisplayName = 
'%(first_name)s %(last_name)s' % form.vars
form.vars.superObjectID = 
db.SuperObject.insert(**db.SuperObject._filter_fields(form.vars))
form.vars.partyID = 
db.Party.insert(**db.Party._filter_fields(form.vars))
db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
form.vars.addressID = 
db.Address.insert(**db.Address._filter_fields(form.vars))

db.PartyAddressIntersection.insert(**db.PartyAddressIntersection._filter_fields(form.vars))
theMessage =  'newly registered user: '  + ' ' + str(request.now) 
 + ' ' + '%(auth_user.id)s %(first_name)s %(last_name)s' % form.vars
theSubject = 'newly registered user' 
mail.send(to='a...@gmail.com', subject=theSubject, 
message=theMessage) 
redirect(URL('/user/login'))
return dict(form=form)

thanks,

Alex Glaros

-- 
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: Setup.py

2015-04-27 Thread Angelo Compagnucci
Hi Massimo,

I will look into this. So in the end is definitively possibile to
install web2py core with python distutils and keep the application
outside.

I'll try with having applications in /var/www and serve that with
apache using web2py.

I'll post my results as soon as possible.

Sincerely, Angelo

2015-04-21 0:59 GMT+02:00 Massimo Di Pierro massimo.dipie...@gmail.com:
 It is possible to have a the gluon folder under site packages and the
 applications folder somewhere else. This used to work. I am not sure how and
 when it broke but it has nothing to do with the web2py default folder
 structure. Perhaps the problem is that the options.py example moved from
 web2py/ to web2py/examples/


 On Monday, 20 April 2015 09:30:05 UTC-5, AngeloC wrote:

 Hi Massimo,

 I'm trying to look at it. I have only a question about permission.
 Applications should run in a writable folder such as the whole web2py.
 I don't think there is an easy way to give writable permissions to
 slices of python sitepackage.

 I don't think also web2py could be disjointed to have the application
 directory in a path totally different from web2py path.

 In the end I dont think could be easily feasible to use python package
 infrastructure to pack web2py.

 What do you think?

 Sincerely, Angelo.

 2015-04-18 4:58 GMT+02:00 Massimo Di Pierro massimo.dipie...@gmail.com:
  It is very well possible that it does not work. Somebody should adopt
  it.
 
 
  On Friday, 17 April 2015 15:05:37 UTC-5, AngeloC wrote:
 
  Hello List,
 
  I'm trying to understand how setup.py works. It seems to me that it
  doesn't work.
 
  There is no web2py binary in system path or somewhere else.
 
  It's a bug or feature?
 
  Thank you!
 
  Sincerely, Angelo
 
  --
  Profile: http://it.linkedin.com/in/compagnucciangelo
 
  --
  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.



 --
 Profile: http://it.linkedin.com/in/compagnucciangelo

 --
 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.



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

-- 
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: Updating multiple targets using AJAX callback

2015-04-27 Thread Sarbjit
Thanks Anthony !!

It worked.

On Sunday, April 26, 2015 at 8:33:55 PM UTC+5:30, Anthony wrote:

 Maybe try triggering the onchange event when dropdown2_a is changed. You 
 could do that by changing the dropdown1 Ajax call from:

 ajax('{{=URL('default', 'getoptionsfordropdown2'})}}', [''], 'dropdown2')

 to:

 ajax('{{=URL('default', 'getoptionsfordropdown2'})}}', [''], ':eval')

 Then in the getoptionsfordropdown2 function, instead of just returning the 
 select HTML, you can return Javascript code that changes the select HTML 
 and then triggers the onchange event. This is not tested, by something 
 along these lines:

 def getoptionsfordropdown2():
 html = [code to generate the select]
 return 'jQuery(#dropdown2).html(%s); 
 jQuery(#dropdown2_a).change();' % html

 Anthony

 On Sunday, April 26, 2015 at 9:24:13 AM UTC-4, Sarbjit wrote:

 Hi,

 I have used AJAX based cascading drop down menu based on slice 
 http://www.web2pyslices.com/slice/show/1526/cascading-drop-down-lists-with-ajax-2
 

 I have introduced a third drop down whose value is populated based on the 
 selection of second drop down.

 I am using the following code : (Not the exact code, but it'll be enough 
 to explain the flow)

 *VIEWS:*

 select  !-- DROPDOWN1--
 onchange=jQuery('#dropdown2_a').empty();  
 ajax('{{=URL('default','getoptionsfordropdown2'})}}', [''], 
 'dropdown2');
 ..
 /select
 span id='dropdown2'
 select id='dropdown2_a'  !-- DROPDOWN2--
 onchange=jQuery('#dropdown3_a').empty();  
 ajax('{{=URL('default','getoptionsfordropdown3'})}}', [''], 
 'dropdown3');
 /select
 /span
 span id='dropdown3'
 select id='dropdown3_a'   !-- DROPDOWN3--
 /select
 /span

 *CONTROLLER:*

 getoptionsfordropdown2/getoptionsfordropdown3:

 def ...
  query the db and build SELECT 
 return SELECT(...)


 *Problem:*

 So, at any point of time, if the option in the drop down1 is not changed, 
 then everything works fine i.e. changes in dropdown2 updates the options in 
 dropdown3.

 However, once the dropdown1 option is changed, dropdown3 contents are not 
 RESET (No code for it, and I need some guidance for it). So, I have to 
 change the option in dropdown2 and come-back in order to change the options 
 in dropdown3. Basically, once an option is changed in drop down1, user has 
 to change the option in dropdown2 once in order to update the dropdown3.

 Can someone please suggest me on how to handle this situation such that 
 changing the dropdown1 should update dropdown3 as well (based on the value 
 of dropdown2).

 Is it possible to call multiple forcefully trigger the onchange event for 
 dropdown2 once it is re-populated based on the changes in dropdown1.




-- 
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] print html page view on dot matrix printer

2015-04-27 Thread 黄祥
hi, 

is it possible to print html page view on dot matrix printer using web2py?
i've tried it but the result is not expected? the font is near each other.
how can i solve this when i generate a html view using web2py?

thanks and 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] Best way to load password at startup.

2015-04-27 Thread hiro
I connect to an external DB in one of my models:

my_model.db:

my_db = DAL(
'postgres://use:password@url/database',
pool_size=20,
after_connection=lambda self: self.execute('set search_path to 
my_schema, other_schema, public; set statement_timeout to 6;'),
migrate=False
)

Now we are planning to adding the project to a git repository and I would 
now like to store our password there. 

I though about just creating the connection string by reading the .pgpass 
file. It will probably work but it seems unnecessary to read .pgpass every 
request. What is the best way to load the password at startup but not all 
other requests? Maybe just create in if statement?

-- 
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] creating DAL from SQL file

2015-04-27 Thread Richard Vézina
You know what... You may consider using an older web2py version... If
possible the version which saw this contrib be added, that way you should
raise your chance to make it works properly...

This guy : https://groups.google.com/d/msg/web2py/5GNG-g1M8T8/fq8UN1fqumMJ

Report it was working, back to jully 2014... So go to github select the
proper tag version and download an older web2py version anterior to july
2014.

Richard

On Sun, Apr 26, 2015 at 12:56 AM, Ron Chatterjee achatterjee...@gmail.com
wrote:

 I got the code to run half way. I am saying, if we can bypass
 subprocess.Popen by:

 cat_str = 'SELECT *From' +   + table_name[0]

 get_table = cursor.execute(cat_str)

 sql_create_stmnt = cursor.fetchall()


 I may not need to have mysqldump or anything. I just don't know what
 subprocess.Popen does that we can't do with cursor.



 On Saturday, April 25, 2015 at 7:57:56 PM UTC-7, Richard wrote:

 I never try it... I may try it for you, but not now, I am working late
 tonight to push a new app version in production :(

 From the script doc :

 This plugin needs:mysqlmysqldumpinstalled and globally available.Under
 Windows you will probably need to add the mysql executable directory to the
 PATH variable,you will also need to modify mysql to mysql.exe and
 mysqldump to mysqldump.exe below.Just guessing here :)Access your tables
 with:legacy_db(legacy_db.mytable.id0).select()If the script crashes
 this is might be due to that fact that the data_type_map dictionary below
 is incomplete.Please complete it, improve it and continue.


 1) Do you have mysqldump installed??
 https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
 2) Is it globally available (You talk about some LAMP setup so I guess
 you are under windows in a virtual LAMP stack?? if so, this has to be check)
 3) Under windows? ... (same thing goes here...)
 4) Are you able to create a dummy app define a connection string and
 define one of your model (one table of your mysql db) and then do a simple
 db().select(db.yourTableName.ALL)??
 5) If the answer to 4 is yes I guess your are neer to make it works if
 the precedent point are cover...

 Richard





 On Sat, Apr 25, 2015 at 10:41 PM, Ron Chatterjee achatte...@gmail.com
 wrote:

 I very simple question. Have you tried? Does the script works for you?
 Because it didn't work for me. Idk what you don't understand that I am
 doing. Its all the same code. someone can just step through it and figure
 out that its failing on subprocess.Popen. Idk why its so hard to
 understand. Specially someone as good as you. And I mean it the good way:-).



 On Saturday, April 25, 2015 at 6:40:14 PM UTC-7, Richard wrote:

 I don't know what you are doing... As far as I can see the only thing
 you have to do is to is that you call the script with as argument a valid
 web2py db connection string...

 a database dump is what is say you dump your db into a file... But I
 don't think this script work like that, I thought it could work over a
 file, but it seems to work against a web2py live db connection string...

 Richard

 On Sat, Apr 25, 2015 at 2:21 AM, Ron Chatterjee achatte...@gmail.com
 wrote:

 Thanks for all the help Richard. I tried to work around the code
 extract_mysql_models.py (attached is the code). Basically, I installed
 XAMP/WAMP and in the phpmyadmin I have the sql database. I am running this
 code but it fails in line #74:

  p = subprocess.Popen(['mysqldump','--user=%s' %
 username,'--password=%s' % password,'--skip-add-drop-table','--no-data',
 database_name,table_name[0]], stdin=subprocess.PIPE,
 stdout=subprocess.PIPE, stderr=subprocess.PIPE)

 sql_create_stmnt, stderr = p.communicate()


 I don't know what a mysql dump is. Wondering if the above two lines
 can be written like,


 cat_str = 'SELECT *From' +   + table_name[0]

 get_table = cursor.execute(cat_str)

 sql_create_stmnt = cursor.fetchall()


 And then go on with if 'CREATE' in sql_create_stmnt:


 Anyway, I am attaching the script if it make it makes it any clear.







 On Wednesday, April 22, 2015 at 12:44:08 PM UTC-7, Richard wrote:

 The version in the thread seems not have been included in web2py...

 Try the one in gluon/scripts/

 Richard

 On Wed, Apr 22, 2015 at 3:41 PM, Richard Vézina 
 ml.richa...@gmail.com wrote:

 This regex : regex = re.compile('(.*?):(.*?)@(.*)')

 Seems to parse the below command line call!!

 Richard

 On Wed, Apr 22, 2015 at 3:39 PM, Richard Vézina 
 ml.richa...@gmail.com wrote:


 https://github.com/web2py/web2py/blob/master/scripts/extract_mysql_models.py

 Ok, it is not working exactly how I thought it was... Do you have
 myslqldump install?

 Do you use Linux or Windows...

 what if you do

 python extract_mysql_models.py username:password@data_basename

 On Wed, Apr 22, 2015 at 3:28 PM, Ron Chatterjee 
 achatte...@gmail.com wrote:

 I used this version (the first one) and change to MySQLdb.

 

[web2py] Re: Cron @reboot and socket server on web2py startup

2015-04-27 Thread tommasot
SOLVED:
Not a Web2py problem,but when i kill it, the port status remain in 
TIME_WAIT,so another process cannot open the port again

If i wait about 30 seconds after kill the process,it restart without 
problems

Il giorno lunedì 27 aprile 2015 23:44:29 UTC+2, tommasot ha scritto:

 I want run a simple script on web2py startup,that listen on a tcp port

 the script is the following example.py. The file in the 
 applications/myapp/cron folder



 *import SocketServer*
 *import logging*

 *class MyTCPHandler(SocketServer.BaseRequestHandler):*


 *# handle syslog event message*
 * def handle(self):*
 * self.logger = logging.getLogger(web2py.app.easylog)*
 * self.logger.setLevel(logging.DEBUG)*
 * messagelog = self.request.recv(1024).strip()*
 * self.logger.info http://self.logger.info(messagelog)*

 *if __name__ == __main__:*
 * HOST, PORT = 0.0.0.0, 514*
 * servertcp = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)*


 * servertcp.serve_forever()*

 i have created into the cron folder the crontab file with the following 
 content:
 *@reboot root *applications/easylog/cron/example.py*

 *i run web2py with the following shell command sudo python web2py.py -Y*

 *The first time web2py is running everything works fine and i am able to 
 connect with telnet on port 514*

 *If i kill web2py and restart it no more open port on 514*

 *The question is Why? *



-- 
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 capture auth_user.id during registration

2015-04-27 Thread Anthony
Why don't you just store the ID?

user_id = db.auth_user.insert(**db.auth_user._filter_fields(form.vars))

Now you've got the user ID.

Anthony

On Monday, April 27, 2015 at 7:12:46 PM UTC-4, Alex Glaros wrote:

 Anthony, plain id returns None.

 There are other tables' info in form vars so how would it know which table 
 to get id from?

 The following gets all the ids from all the tables except auth_user:  
 str(db.auth_user._filter_fields(form.vars))

 But those IDs are captured with statements above like: form.vars.partyID 
 = db.Party.insert(**db.Party._filter_fields(form.vars))

 If that is a good way to capture the data, then I am unsure how to write 
 that for auth_user table without impacting the insertion process

 thanks,

 Alex


-- 
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: AJAX div reload indicator

2015-04-27 Thread Dave S


On Saturday, April 25, 2015 at 8:28:15 AM UTC-7, Gary Cowell wrote:

 I found that I can use:

 {{=LOAD('tenant','stackList.load',ajax=True, target=stackList,vars={
 'reload_div':'stackList'},content=CENTER(IMG(_src=URL(request.application,
 'static','images/ajax_loader_blue_256.gif'}}

 So this gives me a spinner gif inside my component div on page reload.

 It doesn't give me a spinner though, when 

 response.js = jQuery('#stackList').get(0).reload()

 is called.

 So my question still stands, the reload time for my stackList controller 
 is quite long, looks okay on page load, but spinner is missing on refresh.

 Do I have to do something more to get the spinner to work on refresh, or 
 should I be doing my component refresh a different way?


I believe the LOAD() loading message is triggered by ${document).ready(), 
and the reload call doesn't hit that trigger.

I have ajax calls that I run with onclick via a button, and doing that 
displays my spinner each time.  But using LOAD() puts that under a wrapper.

/dps



 




 On Tuesday, 21 April 2015 16:05:32 UTC+1, Gary Cowell wrote:

 Hello

 I have a DIV component I'm reloading using another controller , so I end 
 up calling:

response.js = jQuery('#stackList').get(0).reload()

 Problem is, my stackList controller function does a lot of work to 
 rebuild the grid, it makes many AWS api calls, to populate the grid.

 The reload works, and the grid eventually updates, but there is no 
 indication that it's doing anything, it has the old values for ages (well, 
 10 seconds or so, seems like ages) after the other form is submitted then 
 it snaps to its new output.

 How can I make the div update immediately with a spinning 'progress' , or 
 maybe fade it out at the start of the refresh, and in at the end? Anything 
 to provide a visual clue that the controller function is running, and that 
 the display is stale

 Thanks



-- 
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] anyone had developed something related to electronic signature in web2py app

2015-04-27 Thread Richard
Hello,

I would like to know if anyone had developed any kind of electronic 
signature involving some record signature or encryption inside a web2py app?

Thanks

Richard

-- 
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 capture auth_user.id during registration

2015-04-27 Thread Alex Glaros
Anthony, plain id returns None.

There are other tables' info in form vars so how would it know which table 
to get id from?

The following gets all the ids from all the tables except auth_user:  
str(db.auth_user._filter_fields(form.vars))

But those IDs are captured with statements above like: form.vars.partyID = 
db.Party.insert(**db.Party._filter_fields(form.vars))

If that is a good way to capture the data, then I am unsure how to write 
that for auth_user table without impacting the insertion process

thanks,

Alex

-- 
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] anyone had developed something related to electronic signature in web2py app

2015-04-27 Thread Dave S


On Monday, April 27, 2015 at 4:56:47 PM UTC-7, Richard wrote:

 Hello,

 I would like to know if anyone had developed any kind of electronic 
 signature involving some record signature or encryption inside a web2py app?



Not an answer, but with all the ads on the radio for CudaSign, I was 
wondering how we would handle e-signing.
CudaSign, formerly SignNow, is from Barracuda Networks.
URL:https://www.cudasign.com/

Barracuda Networks advertises on radio (at least in LA), especially during 
sports broadcasts like Kings Hockey games, Angels Baseball games, and the 
like.  They must figure that a lot SMB IT people listen to those games.  
(SMB IT people seems to include a lot of startup people having to develop 
products and run the company computers at the same time.)

/dps



 

-- 
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: print html page view on dot matrix printer

2015-04-27 Thread Derek
I would suggest using a fixed width font, preferably a font that is 
installed on the printer. 

On Monday, April 27, 2015 at 6:13:04 AM UTC-7, 黄祥 wrote:

 hi, 

 is it possible to print html page view on dot matrix printer using web2py?
 i've tried it but the result is not expected? the font is near each other.
 how can i solve this when i generate a html view using web2py?

 thanks and 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: Best way to load password at startup.

2015-04-27 Thread Niphlod
use an environmental variable or a configuration file that you'll have in 
private/ but won't commit to git. For the latter solution, the current 
scaffolding uses a new module, named appconfig.

On Monday, April 27, 2015 at 4:40:06 PM UTC+2, hiro wrote:

 I connect to an external DB in one of my models:

 my_model.db:

 my_db = DAL(
 'postgres://user:password@url/database',
 pool_size=20,
 after_connection=lambda self: self.execute('set search_path to 
 my_schema, other_schema, public; set statement_timeout to 6;'),
 migrate=False
 )

 Now we are planning to adding the project to a git repository and I would 
 now like to store our password there. 

 I though about just creating the connection string by reading the .pgpass 
 file. It will probably work but it seems unnecessary to read .pgpass every 
 request. What is the best way to load the password at startup but not all 
 other requests? Maybe just create in if statement?


-- 
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.