[web2py] Show the pop up by using the controller
I want to use the pop up on certain conditions through controller
Re: [web2py] Re: Facing Trouble in Cascading drop-down with ajax
Thanks Alan On Fri, Mar 30, 2012 at 6:11 PM, Alan Etkin spame...@gmail.com wrote: There may be javascript issues: onchange=ajax('admin_assign',['org_name'],'shadow_clone'); Wouldn't the 'shadow_clone' be specified as '#shadow_clone'? (as it is an element selected by id) onchange=jQuery(maker_name).remove(); ... Does the maker_name js variable exist? if maker_name is an element's name I'd use this instead: jQuery('[name=maker_name]').remove(); On Friday, March 30, 2012 1:54:48 AM UTC-3, Sanjeet Kumar wrote: Yes my code is from web2py slices I have the following view :- {{left_sidebar_enabled,right_**sidebar_enabled=True,False}} {{extend 'adminlayout.html'}} div id=contdoc h4Themis Project Console/h4 /div div id=contdoc form name=assign action={{=URL('default','** admin_submit_assign_project')}**} method=post onsubmit=return showcnf() Select Organization : select name='org_name' onchange=ajax('admin_assign',**['org_name'],'shadow_clone');** {{for org in organization:}} option value={{=org.organization}} {{=org.organization}} /option {{pass}} /select /br Select Department : select name='category_name' onchange=jQuery(maker_name).**remove(); ajax('admin_assign_pro', ['category_name'], 'shadow_clone'); {{for category in categories:}} option value={{=category.category}}** {{= selected='selected' if str(category.category)==**request.vars.category_name else }} {{=category.category}} /option {{pass}} /select span id='shadow_clone'/span /br Select Employee Email : select name='maker_name' {{for maker in makers:}} option value={{=maker.email}} {{=XML( selected='selected') if str(maker.email)==request.**vars.maker_name else }} {{=maker.email}} /option {{pass}} /select /br input type=submit value=Submit / /form hr /div div id=contdoc {{=form}} /div and the following Controller :- def admin_assign_project(): for row2 in db(db.image.email == auth.user.email).select(): images=row2.image db.assign_project.id.readable=**False form=SQLFORM.grid(db.assign_**project) projects=db().select(db.admin_**add_project.ALL) organization=db().select(db.**auth_user.ALL) categories = db().select(db.category.ALL) if request.vars.org_name: makers = db(db.auth_user.organization==**request.vars.org_name).select(** db.auth_user.ALL) else: makers = db(db.auth_user.organization==**'').select(db.auth_user.ALL) return dict(organization=**organization,categories=**categories, makers=makers, images=images, form=form) def admin_assign(): makers = db((db.auth_user.organization=**=request.vars.org_name)).** select(db.auth_user.ALL) result = select name='maker_name' for maker in makers: result += option value=' + str(maker.category) + ' + str(maker.category) + /option result += /select return XML(result) def admin_assign_pro(): makers = db((db.auth_user.department==**request.vars.category_name)). **select(db.auth_user.ALL) result = select name='maker_name' for maker in makers: result += option value=' + str(maker.email) + ' + str(maker.email+'\t'+'('+**maker.first_name+'\t'+maker.**last_name+')') + /option result += /select return XML(result) Here I want to value in second drop-down category_name filtered on the first drop-down org_name which are selected and the value in the third drop-down maker_name filtered on the second drop-down which will be selected via ajax. I am getting the value only in the second drop-down but i am not be able to get the value in the third drop-down filtered on the second . Thanks in advance .
[web2py] Facing Trouble in Cascading drop-down with ajax
I am using the three cascading drop-down menu with the help of slices i am able to show the value in the second drop-down filtered on the first one but i am not be able to shown the value in the third drop-down filtration on the second via ajax so please help me.
Re: [web2py] Re: Facing Trouble in Cascading drop-down with ajax
Yes my code is from web2py slices I have the following view :- {{left_sidebar_enabled,right_sidebar_enabled=True,False}} {{extend 'adminlayout.html'}} div id=contdoc h4Themis Project Console/h4 /div div id=contdoc form name=assign action={{=URL('default','admin_submit_assign_project')}} method=post onsubmit=return showcnf() Select Organization : select name='org_name' onchange=ajax('admin_assign',['org_name'],'shadow_clone'); {{for org in organization:}} option value={{=org.organization}} {{=org.organization}} /option {{pass}} /select /br Select Department : select name='category_name' onchange=jQuery(maker_name).remove(); ajax('admin_assign_pro', ['category_name'], 'shadow_clone'); {{for category in categories:}} option value={{=category.category}} {{= selected='selected' if str(category.category)==request.vars.category_name else }} {{=category.category}} /option {{pass}} /select span id='shadow_clone'/span /br Select Employee Email : select name='maker_name' {{for maker in makers:}} option value={{=maker.email}} {{=XML( selected='selected') if str(maker.email)==request.vars.maker_name else }} {{=maker.email}} /option {{pass}} /select /br input type=submit value=Submit / /form hr /div div id=contdoc {{=form}} /div and the following Controller :- def admin_assign_project(): for row2 in db(db.image.email == auth.user.email).select(): images=row2.image db.assign_project.id.readable=False form=SQLFORM.grid(db.assign_project) projects=db().select(db.admin_add_project.ALL) organization=db().select(db.auth_user.ALL) categories = db().select(db.category.ALL) if request.vars.org_name: makers = db(db.auth_user.organization==request.vars.org_name).select(db.auth_user.ALL) else: makers = db(db.auth_user.organization=='').select(db.auth_user.ALL) return dict(organization=organization,categories=categories, makers=makers, images=images, form=form) def admin_assign(): makers = db((db.auth_user.organization==request.vars.org_name)).select(db.auth_user.ALL) result = select name='maker_name' for maker in makers: result += option value=' + str(maker.category) + ' + str(maker.category) + /option result += /select return XML(result) def admin_assign_pro(): makers = db((db.auth_user.department==request.vars.category_name)).select(db.auth_user.ALL) result = select name='maker_name' for maker in makers: result += option value=' + str(maker.email) + ' + str(maker.email+'\t'+'('+maker.first_name+'\t'+maker.last_name+')') + /option result += /select return XML(result) Here I want to value in second drop-down category_name filtered on the first drop-down org_name which are selected and the value in the third drop-down maker_name filtered on the second drop-down which will be selected via ajax. I am getting the value only in the second drop-down but i am not be able to get the value in the third drop-down filtered on the second . Thanks in advance .
[web2py] Re: cascading select, automatic triggers
Can you post your code for three cascading select via ajax i need this code thanks in advance On Thursday, April 21, 2011 10:19:46 AM UTC+5:30, ニコノコ wrote: I have a form with three cascading selects. A change in the selection, causes it to change the contents of the other selects. They work just fine, but I have other optional fields in the form which I wish the user to check out or input something before doing a real user triggered form submit. What are my other options for triggering the changes in the cascading selects without doing a submit of the form? Other than using JQuery, that is. I tried adding a checkbox as a workaround so that a user must click it first, something like All of the above is complete and correct. If the user clicks on it, but there are form errors, the checkbox resets to False. I tried to set the form.vars.completed variable in a function called by onvalidation, but it's not changing the value. Also tried 'value', '_value', '_checked' of the form.element('#myselect'), with no success. (Can I even change the values a user has entered in a form?) /r Nik
[web2py] Re: How to hide all fields of SQLFORM with submit button only?
first write the following code and than use the SQLFORM it will hide your name field db.to_be_lawyer.name.readable = False On Mar 26, 3:31 pm, web2py_lover lia...@gmail.com wrote: How to hide all fields of SQLFORM with submit button only? all fields of db.to_be_lawyer are 'name' and 'age'. I try db.to_be_lawyer.name.default = 'default name' db.to_be_lawyer.age.default = '28' form_to_be_lawyer= SQLFORM(db.to_be_lawyer, fields=[], buttons = [INPUT(_type='submit',_value=apply to be a lawyer)] ) but fail.
[web2py] Re: SQLForm.grid : is it possible to delete multiple rows at once ?
can use the following :- form=SQLFORM.grid(db.auth_user, create=False, selectable = lambda ids: del_emp(ids)) def del_emp(ids): if not ids: response.flash='Please Select the Check-box to Delete' else: for row in ids: db(db.auth_user.id == row).delete() pass pass return '' you can see the submit button at the bottom of grid you can select the multiple check-box at a time and click the submit button it will delete the all select-able row at a time On Mar 26, 12:06 pm, Sebastien Stormacq sebastien.storm...@gmail.com wrote: Thanks ! On Saturday, March 24, 2012 5:26:52 AM UTC+1, Javier wrote: sabsto You can use selectable, for example: selectable = lambda ids: delete(ids) form=SQLFORM.grid(query,selectable=selectable) def delete(ids): to_delete=db(db.tabla.id.belongs(ids)) to_delete.delete() On Fri, Mar 23, 2012 at 9:46 PM, Derek sp1d...@gmail.com wrote: Or you could avoid javascript, store the IDs of the deleted items in the session and do your own calls to the DAL to delete items. On Friday, March 23, 2012 7:33:42 AM UTC-7, Anthony wrote: Is it possible to select and delete multiple rows with one button click using SQLFORM.grid ? (instead of clicking delete on each row) I tried the selectable property but this doesn't help to delete. I searched the archive of this group / mailing-list without success Not out of the box. I suppose you could add a column (via the links argument) with delete checkboxes, and then add a delete checked button to the page with a Javascript event handler that identifies the checked records, submits a request to the server, and then possibly reloads the whole page or just the grid via Ajax. Anthony
[web2py] How to check the extension of file from the controller
I have the upload field in table i want to check the file extension from the controller during the upload i am using :- SQLFORM.factory(db.emp_detail) if form.accepts(request.vars, session): img = form.vars.image if file.extension == 'something': update query
[web2py] Generate the render the html file in to doc file
How can i render the html file in to the doc file
Re: [web2py] Re: Generate the render the html file in to doc file
ok thanks Allan On Thu, Mar 15, 2012 at 5:13 PM, Alan Etkin spame...@gmail.com wrote: If you want to render html output as .rtf (a similar type of document that will work in old ms-word versions) check the book at 10.3.2 (PyRTF) On Mar 15, 8:15 am, Sanjeet Kumar sanjeet@gmail.com wrote: How can i render the html file in to the doc file
Re: [web2py] Re: How to check the extension of file from the controller
Thanks Anthony correct Alan i tried this working fine On Thu, Mar 15, 2012 at 10:14 PM, Alan Etkin spame...@gmail.com wrote: Anthony's answer is the right one, mine is for retrieving the extension of the url requested On 15 mar, 10:40, Anthony abasta...@gmail.com wrote: request.vars.image.filename.split('.')[-1] or import os os.path.splitext(request.vars.image.filename)[1][1:] Anthony On Thursday, March 15, 2012 6:18:10 AM UTC-4, Sanjeet Kumar wrote: I have the upload field in table i want to check the file extension from the controller during the upload i am using :- SQLFORM.factory(db.emp_detail) if form.accepts(request.vars, session): img = form.vars.image if file.extension == 'something': update query
[web2py] Re: Multiple Login methods
Hi Hassan please refer this link i think it will be useful for you :- http://www.web2py.com/books/default/chapter/29/9#Integration-with-OpenID,-Facebook,-etc. On Monday, March 12, 2012 8:30:36 PM UTC+5:30, Hassan Alnatour wrote: Dear ALL, I want to use Facebook and linked in and open iD and the normal auth form form login and registration , how can i do that and when i use this things for my website where dose the user register ?? Best Regards,
[web2py] Web2Py Version 1.99.7 giving the trace back during run the Cron
I am using the following model for test the cron : db.define_table(('emp'), Field('name')) and in crontab file inside the welcome app i am using the : */1 * * * * root *applications/welcome/modules/background_updater.py and makes the file inside the modules folder background_updater.py and used the code : db.emp.insert(name = 'Alex') this code is inserting the Alex in the table emp within 1 minutes interval this code is working in the version of web2py 1.99.4 perfectly but when i try this same code in the version 1.99.7 i got the following error :- RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last): File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 5955, in __init__ self._adapter = ADAPTERS[self._dbname](*args) File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 1732, in __init__ self.pool_connection(connect) File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 465, in pool_connection self.connection = f() File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 1731, in connect return self.driver.Connection(dbpath, **driver_args) OperationalError: unable to open database file
[web2py] add the drop-down and multiple selection in grid
How can i add the drop-down in the grid for the better searching and when i select the multiple check box at a time should be able to delete it by using the one button
Re: [web2py] Re: Get the Image from the database filtered on the email id
Thanks Anthony On Wed, Mar 7, 2012 at 8:40 PM, Anthony abasta...@gmail.com wrote: URL('default', 'download', args=db(db.employee.email_id == some_id).select().first().image) This assumes you have the standard download() function in your default.py controller: def download(): return response.download(request, db) Anthony On Wednesday, March 7, 2012 3:20:39 AM UTC-5, Sanjeet Kumar wrote: I have the following table :- db.define_table(('employee', Field('email_id', requires = IS_EMAIL()), Field('image', 'upload')) i want to show the image according to the filtration of email id. how it will be possible in web2py
Re: [web2py] Re: get the dynamically value from the list and send the mail by using the cron job
Thanks Alan On Thu, Mar 8, 2012 at 3:24 AM, Alan Etkin spame...@gmail.com wrote: If you want to avoid redundant mails, you can set a sequence of sent id's and compare them at every loop iteration for message to send: if not (the message was sent): send the email Also, you should store email sent info between actions/task instances to be able to query the sent list before sending. You can use a special table or an extra field. On 6 mar, 09:29, Sanjeet Kumar sanjeet@gmail.com wrote: i am able to send the mail through the cron job but when i am going to send the mail by fetching the email id from the database i got confused in the logic :- i have the followng code : list = [] import datetime currentdate = datetime.datetime.now() for row in db(db.employee.time == currentdate).select(): list.append(row.empdetail) here is my send mail function it is sending only the last id i know the for loop scope is ended that is the reason its happening but i am not be able to get the proper solution to send the mail to the each of the id only once with the all details when the date will be matched in the same table more than one emp details are there so i want to send the mail to the each individual employee at a time.
Re: [web2py] Re: get the dynamically value from the list and send the mail by using the cron job
Thanks Kim i will try this On Thu, Mar 8, 2012 at 5:03 AM, Sean Kim moon...@gmail.com wrote: Not really sure what you're saying, but I assume that basically you want to email the company with due date that matches current date. Wouldn't this work? currentdate = datetime.date.today() for row in db(db.company.due_date==currentdate).select(): mail.send(to=[row.cowner_id], subject='Sending the mail by using Cron job' message=row.details) Why are you appending the company details to the list? If you want to get all of the company's details and email that to everyone, you will need to email once the loop's done retrieving all the details and emails. co_details = [] co_emails = [] for row in db(db.company.due_date==currentdate).select(): co_emails.append(row.cowner_id) co_details.append(row.details) msg = ' '.join(co_details) for co_email in co_emails: # you could just do to=co_emails if you don't need to send individual emails mail.send(to=[co_email], subject='Sending the mail by using Cron job' message=msg) On Mar 6, 11:17 pm, Sanjeet Kumar sanjeet@gmail.com wrote: Actually i have the one company table :- db.define_table(('comany'), Field('cowner_id'), Field('details'), Field('due_date','date')) here i want to send the mail with the details by using the cron when the date will match to the due date :- i have the following code in my modules send.py :- from gluon.tools import Mail mail=Mail() #specify server mail=auth.settings.mailer mail.settings.server='smtp.gmail.com:587' mail.settings.login='usern...@mail.com:password' #specify address to send as mail.settings.sender='usern...@mail.com' #send the message try: import datetime list[] currentdate = datetime.date.today() for row in db(db.company.due_date == currentdate).select(): list.append(details) mail.send(to=[row.cowner_id], subject='Sending the mail by using Cron job', message=str(list)) except Exception, e: print 'oops: %s' % e here the problem is the if the i have many companies in our database than how i sent the different mail to each of the different companies at a time with all details when the due_date will match to the each of the companies. here the for loop scope is ended so that is the reason to it is sending and taking the only last data from my database and if i sent the mail by using inside the scope of the for loop than the for each of the rows mail will be sent with the details so its frustrated that is the reason i want to sent the only one mail with all the details to the companies with date which matches the today's date. But if the more than one companies in our database than it is taking only the last because scope of for loop is ended so how i resolve these issues please help me.
Re: [web2py] Re: Get the Image from the database filtered on the email id
Anthony i have one more question regarding this when the employee will update his image than the updated images are shown but i guess the one more problem here is the previous images are not deleted from our database so how the previous image will be deleted when the employee will update the image. On Fri, Mar 9, 2012 at 9:11 AM, Sanjeet Kumar sanjeet@gmail.com wrote: Thanks Anthony On Wed, Mar 7, 2012 at 8:40 PM, Anthony abasta...@gmail.com wrote: URL('default', 'download', args=db(db.employee.email_id == some_id).select().first().image) This assumes you have the standard download() function in your default.py controller: def download(): return response.download(request, db) Anthony On Wednesday, March 7, 2012 3:20:39 AM UTC-5, Sanjeet Kumar wrote: I have the following table :- db.define_table(('employee', Field('email_id', requires = IS_EMAIL()), Field('image', 'upload')) i want to show the image according to the filtration of email id. how it will be possible in web2py
Re: [web2py] Re: Get the Image from the database filtered on the email id
ok Antony On Fri, Mar 9, 2012 at 9:50 AM, Anthony abasta...@gmail.com wrote: Anthony i have one more question regarding this when the employee will update his image than the updated images are shown but i guess the one more problem here is the previous images are not deleted from our database so how the previous image will be deleted when the employee will update the image. You mean the image isn't deleted from the filesystem, right? If you want to delete old images upon update, I think you have to do that manually. We should probably automate that. Anthony
Re: [web2py] Re: Get the Image from the database filtered on the email id
Ok Anthony how can we automate that
Re: [web2py] Re: Get the Image from the database filtered on the email id
Ok Anthony Thanks
[web2py] Get the image from database
I have the following table :- d.define_table(('employee', )
[web2py] Get the Image from the database filtered on the email id
I have the following table :- db.define_table(('employee', Field('email_id', requires = IS_EMAIL()), Field('image', 'upload')) i want to show the image according to the filtration of email id. how it will be possible in web2py
[web2py] get the dynamically value from the list and send the mail by using the cron job
i am able to send the mail through the cron job but when i am going to send the mail by fetching the email id from the database i got confused in the logic :- i have the followng code : list = [] import datetime currentdate = datetime.datetime.now() for row in db(db.employee.time == currentdate).select(): list.append(row.empdetail) here is my send mail function it is sending only the last id i know the for loop scope is ended that is the reason its happening but i am not be able to get the proper solution to send the mail to the each of the id only once with the all details when the date will be matched in the same table more than one emp details are there so i want to send the mail to the each individual employee at a time.
[web2py] Re: get the dynamically value from the list and send the mail by using the cron job
Actually i have the one company table :- db.define_table(('comany'), Field('cowner_id'), Field('details'), Field('due_date','date')) here i want to send the mail with the details by using the cron when the date will match to the due date :- i have the following code in my modules send.py :- from gluon.tools import Mail mail=Mail() #specify server mail=auth.settings.mailer mail.settings.server='smtp.gmail.com:587' mail.settings.login='usern...@mail.com:password' #specify address to send as mail.settings.sender='usern...@mail.com' #send the message try: import datetime list[] currentdate = datetime.date.today() for row in db(db.company.due_date == currentdate).select(): list.append(details) mail.send(to=[row.cowner_id], subject='Sending the mail by using Cron job', message=str(list)) except Exception, e: print 'oops: %s' % e here the problem is the if the i have many companies in our database than how i sent the different mail to each of the different companies at a time with all details when the due_date will match to the each of the companies. here the for loop scope is ended so that is the reason to it is sending and taking the only last data from my database and if i sent the mail by using inside the scope of the for loop than the for each of the rows mail will be sent with the details so its frustrated that is the reason i want to sent the only one mail with all the details to the companies with date which matches the today's date. But if the more than one companies in our database than it is taking only the last because scope of for loop is ended so how i resolve these issues please help me.
Re: [web2py] Hide the Extra added fields from auth table during the registrations
Thanks Bruno On Friday, February 24, 2012 11:36:08 AM UTC+5:30, rochacbruno wrote: def user(): *if 'register' in request.args: fields_to_hide = ['city', 'preferred_color', 'soccer_team'] for fieldname in fields_to_hide: field = db.auth_user[fieldname] field.readable = field.writable = False* return dict(form=auth()) On Fri, Feb 24, 2012 at 3:21 AM, Sanjeet Kumar sanjeet@gmail.comwrote: I am added the some extra fields in the auth_user table and i want to hide those fields when the user will go for the registration user can only see the following fields during the registration: - First name - Last name - email-id - Password - verify password -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Use the other login page instead of index
Actually i want to go to the another function in the default controller when i click on the login it should be call the function such as emp() istead of index and after login i want to stay on the emp() only On Mon, Mar 5, 2012 at 1:14 PM, Bruno Rocha rochacbr...@gmail.com wrote: the login is by default in defautl/user/login not in index. you can set your own controller and function. Create a new controller with a function to expose dict(form=auth()) and in models set: auth.settings.controller = myothercontroller auth.settings.function = myfunction I am not sure if navbar will be automatically updated but you can create your own links using URL(controller, function, args=login) http://zerp.ly/rochacbruno Em 05/03/2012 04:13, Sanjeet Kumar sanjeet@gmail.com escreveu: I am using the index as my home page and i want to call the another controller for login when the user click on the login link
Re: [web2py] Use the other login page instead of index
My problem is solved through capturing the login event On Mon, Mar 5, 2012 at 1:48 PM, Sanjeet Kumar sanjeet@gmail.com wrote: Actually i want to go to the another function in the default controller when i click on the login it should be call the function such as emp() istead of index and after login i want to stay on the emp() only On Mon, Mar 5, 2012 at 1:14 PM, Bruno Rocha rochacbr...@gmail.com wrote: the login is by default in defautl/user/login not in index. you can set your own controller and function. Create a new controller with a function to expose dict(form=auth()) and in models set: auth.settings.controller = myothercontroller auth.settings.function = myfunction I am not sure if navbar will be automatically updated but you can create your own links using URL(controller, function, args=login) http://zerp.ly/rochacbruno Em 05/03/2012 04:13, Sanjeet Kumar sanjeet@gmail.com escreveu: I am using the index as my home page and i want to call the another controller for login when the user click on the login link
[web2py] Cron Set up
Can anyone explain me how i set up the background task in web2py
Re: [web2py] Cron Set up
Thanks Bruno On Mon, Mar 5, 2012 at 10:16 AM, Bruno Rocha rochacbr...@gmail.com wrote: On Mon, Mar 5, 2012 at 1:39 AM, Sanjeet Kumar sanjeet@gmail.comwrote: Can anyone explain me how i set up the background task in web2py http://movu.ca/demo/article/show/31/web2py-cron-task Also in the book there is a topic talking about it. -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Cron Set up
I am using the following model for test the cron : db.define_table(('emp'), Field('name')) and in crontab file inside the welcome app i am using the : */1 * * * * root *applications/welcome/modules/background_updater.py and makes the file inside the modules folder background_updater.py and used the code : db.emp.insert(name = 'Alex') this code is inserting the Alex in the table emp within 1 minutes interval this code is working in the version of web2py 1.99.4 perfectly but when i try this same code in the version 1.99.7 i got the following error :- RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last): File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 5955, in __init__ self._adapter = ADAPTERS[self._dbname](*args) File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 1732, in __init__ self.pool_connection(connect) File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 465, in pool_connection self.connection = f() File /home/tls-sanjeet/Desktop/web2py/gluon/dal.py, line 1731, in connect return self.driver.Connection(dbpath, **driver_args) OperationalError: unable to open database file
[web2py] Use the other login page instead of index
I am using the index as my home page and i want to call the another controller for login when the user click on the login link
Re: [web2py] Re: web2py 1.99.5 is OUT
when i am going to database administration i will be redirected to the site and i am using the instant_admin in my application but in that version all the layout for instant admin are breaked. On Fri, Mar 2, 2012 at 9:35 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: what specifically breaks? On Friday, 2 March 2012 00:46:28 UTC-6, Sanjeet Kumar wrote: i am very excited to use the new version of web2py 1.99.5 . when i downloaded it and use than i face the to many problems i am not be able to go the database administration when i click on the database administration it is redirecting to the site view and i also copied the my application which i developed in the previous version it is breaking the backward compatibility with plugin_instant_admin .
Re: [web2py] Re: web2py 1.99.5 is OUT
In the new version 1.99.6 database administration problem are fixed but it is also breaking the plugin_instant_admin backward compatibility actually i am using the plugin_instant_admin in my application and when i copied the application in new version and run it than plugin_instant_admin layout is not working. On Fri, Mar 2, 2012 at 9:35 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: what specifically breaks? On Friday, 2 March 2012 00:46:28 UTC-6, Sanjeet Kumar wrote: i am very excited to use the new version of web2py 1.99.5 . when i downloaded it and use than i face the to many problems i am not be able to go the database administration when i click on the database administration it is redirecting to the site view and i also copied the my application which i developed in the previous version it is breaking the backward compatibility with plugin_instant_admin .
Re: [web2py] Re: New web2py stable 1.99.5 creating problems and breaking the backward compatibility
Thanks pbreit In the new version 1.99.6 database administration problem are fixed but it is also breaking the plugin_instant_admin backward compatibility actually i am using the plugin_instant_admin in my application and when i copied the application in new version and run it than plugin_instant_admin layout is not working. On Fri, Mar 2, 2012 at 11:32 PM, pbreit pbreitenb...@gmail.com wrote: This has been fixed in 1.99.6
Re: [web2py] Re: New web2py stable 1.99.5 creating problems and breaking the backward compatibility
OK thanks Anthony On Sat, Mar 3, 2012 at 9:25 AM, Anthony abasta...@gmail.com wrote: In the new version 1.99.6 database administration problem are fixed but it is also breaking the plugin_instant_admin backward compatibility actually i am using the plugin_instant_admin in my application and when i copied the application in new version and run it than plugin_instant_admin layout is not working. What exactly is wrong with plugin_instant_admin? If it is just a CSS issue, then it's not a backward compatibility problem, as you're not required to use the new welcome app CSS upon web2py upgrade. Anthony
Re: [web2py] Re: web2py 1.99.5 is OUT
Sorry Massimo its my mistake it was the layout problem On Sat, Mar 3, 2012 at 11:19 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: How does it break it? Can you post a traceback? On Friday, 2 March 2012 21:28:38 UTC-6, Sanjeet Kumar wrote: In the new version 1.99.6 database administration problem are fixed but it is also breaking the plugin_instant_admin backward compatibility actually i am using the plugin_instant_admin in my application and when i copied the application in new version and run it than plugin_instant_admin layout is not working. On Fri, Mar 2, 2012 at 9:35 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: what specifically breaks? On Friday, 2 March 2012 00:46:28 UTC-6, Sanjeet Kumar wrote: i am very excited to use the new version of web2py 1.99.5 . when i downloaded it and use than i face the to many problems i am not be able to go the database administration when i click on the database administration it is redirecting to the site view and i also copied the my application which i developed in the previous version it is breaking the backward compatibility with plugin_instant_admin .
[web2py] New web2py stable 1.99.5 creating problems and breaking the backward compatibility
i am very excited to use the new version of web2py 1.99.5 . when i downloaded it and use than i face the to many problems i am not be able to go the database administration when i click on the database administration it is redirecting to the site view and i also copied the my application which i developed in the previous version it is breaking the backward compatibility with plugin_instant_admin .
[web2py] Re: web2py 1.99.5 is OUT
i am very excited to use the new version of web2py 1.99.5 . when i downloaded it and use than i face the to many problems i am not be able to go the database administration when i click on the database administration it is redirecting to the site view and i also copied the my application which i developed in the previous version it is breaking the backward compatibility with plugin_instant_admin . On Friday, March 2, 2012 3:02:09 AM UTC+5:30, Massimo Di Pierro wrote: Many changes and improvements. Please check it asap and report your findings here. Attention: We slightly changed the behavior of auth.archive because version 1.99.* behaved differently than documented. If you are using auth.archive make sure to test your code. ## 1.99.5 - admin in Russian (Bulat), Japanese (Omi) and Slovenian (Robert Valentak) - included web-based debugger (experimental, thanks Mariano) - def index(): return dict(a=gluon.tools.Expose(folder)) - db.table.field.like(...,case_sensitive=False) (thanks Floyd) - db.table.field.regexp(...) for sqlite and postgres - db(...,ignore_common_filters=True) - db(db.dog_id.belongs(db.dogs.owner=='james')).select() - db(...).select().group_by_value(db.table.field) (thanks Yair) - db = DAL('imap://user:password@server:port') support (thanks Alan Etkin) - db = DAL('teradata://DSN=dsn;UID=user;PWD=pass; DATABASE=database') (thanks Adrew \ Willmott) - db = DAL('mongodb://127.0.0.1:5984/db') (experimental, thanks Mark Breedveld) - db = DAL('cubrid') (experimental) - db = DAL('postgres:pg8000:...') and DAL('postgres:psycopg2:...') - pg8000 now ships with web2py )thanks Mariano) - reponse.delimiters = ('\\[','\\]') (thanks Denes) - auth.user_groups stores user groups - auth.is_impersonating() - populate can now deal with computed fields (thanks Tsvi Mostovicz) - new rediscache (thanks niphold) - sync languages capability (thanks Yair) - improved markmin auto-links - improved ldap support (thanks Omi) - added TimeCollector (thanks Caleb) - better cpdb.py (thanks pasxidis) - conditional menu items (reponse.menu=[(title,bool,link,[],condition)] - scripts/services/service.py (thanks Ross) - gluon/contrib/login_methods/browserid_account.py (thanks Pai) - gluon/contrib/htmlmin.py for html minimization (thanks kerncece) - web2py_component has timeout parameter, thanks Alan - 100's of small bug fixes and small improvements
[web2py] Re: web2py 1.99.5 is OUT
i am very excited to use the new version of web2py 1.99.5 . when i downloaded it and use than i face the to many problems i am not be able to go the database administration when i click on the database administration it is redirecting to the site view and i also copied the my application which i developed in the previous version it is breaking the backward compatibility with plugin_instant_admin .
Re: [web2py] Get the IP of the System
Thanks Anthony i solved it by taking the IP by using the request.env.remote_addr remote address will be there but by using the list i get it properly On Wed, Feb 29, 2012 at 9:19 AM, Anthony abasta...@gmail.com wrote: I've seen recommendations to check request.env.http_client_ip, request.env.http_x_forwarded_for, and request.env.remote_addr, in that order (remote_addr should always be there, but you want one of the other two if available because the client may be behind a proxy). Anthony On Tuesday, February 28, 2012 10:33:32 PM UTC-5, Sanjeet Kumar wrote: I want to insert the client system IP address in my database through the controller can you explain how i get the client IP address of the system when they login. On Tue, Feb 28, 2012 at 7:29 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote: Which system? On 2/28/12, Sanjeet Kumar sanjeet@gmail.com wrote: How we can get the IP address of the system
Re: [web2py] Re: cron setup
I have the following code in my crontab :- 0-59/1****root **applications/welcome/cron/test.py and the following code in my test.py which are inside the cron folder in my application :- db.person.insert(name=Alex) and i want to insert this into the table person which are defined in the model db.py :- db.define_table('person', Field('name')) so please help me through this example how automatically insert/update the data in database by using cron job. On Tue, Feb 28, 2012 at 5:10 PM, Sanjeet Kumar sanjeet@gmail.comwrote: Thanks Luciano i will try. On Tue, Feb 28, 2012 at 5:06 PM, Luciano Pacheco lucm...@gmail.comwrote: I have written to you how to do that. Copy and paste: , but, in the example file, do this changes: # file: applications/instore/modules/background_updater.py from applications.instore.controllers.default import index # instead of time.sleep(5), inside the function main() index() On Tue, Feb 28, 2012 at 10:33 PM, Sanjeet Kumar sanjeet@gmail.comwrote: Yes I want to run the index function of my default controller in a cron is this possible or not ? On Tue, Feb 28, 2012 at 4:58 PM, Luciano Pacheco lucm...@gmail.comwrote: You want to run the index function of your controller in a cron ? Usually it doesn't make sense, but, in the example file # file: applications/instore/modules/background_updater.py from applications.instore.controllers.default import index # instead of time.sleep(5), inside the function main() index() I alson didn't understand what you want, if this doesn't solve your question, try explain your use case. Regards, On Tue, Feb 28, 2012 at 10:00 PM, Sanjeet Kumar sanjeet@gmail.comwrote: I am not be able to get you properly can you give me the better clarification i have the default controller and the index function can you tell me how can i run the index function by using crontab which are in my application folder. On Tue, Feb 28, 2012 at 4:12 PM, Luciano Pacheco lucm...@gmail.comwrote: Following the same example. In you controller: from applications.instore.modules.background_updater main def force_background_updater(): ret = main() return 'The result was: %s' % ret But, the cron is run time based tasks, usually those tasks won't be used in controller.One exception is when you want to force a task to run. Regards, On Tue, Feb 28, 2012 at 9:11 PM, Sanjeet Kumar sanjeet@gmail.com wrote: i tried this but i am not be able to run my controller Can you give me the simple example through which i can run the function written under the controller inside my application On Mon, Feb 27, 2012 at 5:39 PM, Luciano Pacheco lucm...@gmail.comwrote: Example: http://movu.ca/demo/article/show/31/web2py-cron-task My first try in movu.ca :-) On Mon, Feb 27, 2012 at 2:32 PM, Sanjeet Kumar sanjeet@gmail.com wrote: Exactly I need the examples On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco lucm...@gmail.com wrote: I think Sanjeet means, I example of the task. What is a good practice in the task, or what kind of variables are present in the local namespace automagically, etc. A task should be a class a function, a python module? I had the same question last week when I was reading this chapter. :-) Regards, -- Luciano Pacheco blog.lucmult.com.br On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin spame...@gmail.comwrote: It's all in the book (if you haven't seen yet) http://web2py.com/books/default/chapter/29/4#Cron By the way, The link in web2py to cron (http://web2py.com/books/ default/reference/29/cronhttp://web2py.com/books/default/reference/29/cron) is broken (returns an invalid function message) On 26 feb, 13:09, Sanjeet Kumar sanjeet@gmail.com wrote: Can anyone give me the brief description to how I set the cron to run the task in background with example. -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br
Re: [web2py] Re: cron setup
Luciano i removed the one * before the applications and tryed than i got the following error :- OperationalError: unable to open database file Traceback (most recent call last): File /home/tls-sanjeet/Desktop/test/web2py/gluon/restricted.py, line 204, in restricted exec ccode in environment File applications/welcome/models/db.py, line 14, in module db = DAL('sqlite://storage.sqlite') File /home/tls-sanjeet/Desktop/test/web2py/gluon/dal.py, line 4749, in __init__ raise RuntimeError, Failure to connect, tried %d times:\n%s % (attempts, tb) RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last): File /home/tls-sanjeet/Desktop/test/web2py/gluon/dal.py, line 4736, in __init__ self._adapter = ADAPTERS[self._dbname](*args) File /home/tls-sanjeet/Desktop/test/web2py/gluon/dal.py, line 1655, in __init__ self.pool_connection(connect) File /home/tls-sanjeet/Desktop/test/web2py/gluon/dal.py, line 444, in pool_connection self.connection = f() File /home/tls-sanjeet/Desktop/test/web2py/gluon/dal.py, line 1654, in connect return self.driver.Connection(dbpath, **driver_args) OperationalError: unable to open database file On Wednesday, February 29, 2012 6:39:22 PM UTC+5:30, lucmult wrote: On Wed, Feb 29, 2012 at 11:10 PM, Sanjeet Kumar sanjeet@gmail.comwrote: I have the following code in my crontab :- 0-59/1****root **applications/welcome/cron/test.py put just 1 * before applications/ [], -- Luciano Pacheco blog.lucmult.com.br
[web2py] Add the drop-down in plugin_instant_admin for best searching
How can i implement the drop-down in plugin_instant_admin for best searching
Re: [web2py] Re: cron setup
i tried this but i am not be able to run my controller Can you give me the simple example through which i can run the function written under the controller inside my application On Mon, Feb 27, 2012 at 5:39 PM, Luciano Pacheco lucm...@gmail.com wrote: Example: http://movu.ca/demo/article/show/31/web2py-cron-task My first try in movu.ca :-) On Mon, Feb 27, 2012 at 2:32 PM, Sanjeet Kumar sanjeet@gmail.comwrote: Exactly I need the examples On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco lucm...@gmail.comwrote: I think Sanjeet means, I example of the task. What is a good practice in the task, or what kind of variables are present in the local namespace automagically, etc. A task should be a class a function, a python module? I had the same question last week when I was reading this chapter. :-) Regards, -- Luciano Pacheco blog.lucmult.com.br On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin spame...@gmail.com wrote: It's all in the book (if you haven't seen yet) http://web2py.com/books/default/chapter/29/4#Cron By the way, The link in web2py to cron (http://web2py.com/books/ default/reference/29/cronhttp://web2py.com/books/default/reference/29/cron) is broken (returns an invalid function message) On 26 feb, 13:09, Sanjeet Kumar sanjeet@gmail.com wrote: Can anyone give me the brief description to how I set the cron to run the task in background with example. -- Luciano Pacheco blog.lucmult.com.br
[web2py] Get the IP of the System
How we can get the IP address of the system
[web2py] Capture the system shut down and browser close event
I am going to develop the time sheet app so for that i captured the login and logout event through this :- auth.settings.login_onaccept = lambda form: lgin(form) auth.settings.logout_onlogout = lambda usr: lgout(usr) and one more question in my mind when the browser will be closed by some reasons and the system will be shut-down due to power loss that time how we capture the event and will show it logout and update our database following is my database and the controller :- database:- db.define_table('employee_login_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date'), Field('employee_login_time'), Field('employee_logout_date',default='Logged in'), Field('employee_logout_time',default='Logged in'), Field('total_minutes',default='Logged in')) Controller:- def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) starttime = datetime.datetime.now() session.starttime = starttime currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_login_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) endtime=datetime.datetime.now() starttime = session.starttime delta = (endtime - starttime) totalminutes = str(delta.seconds / 60) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_login_detail.employee_id == auth.user.email) (db.employee_login_detail.employee_login_date == currentdate) (db.employee_login_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_minutes=totalminutes) return ''
Re: [web2py] Re: cron setup
I am not be able to get you properly can you give me the better clarification i have the default controller and the index function can you tell me how can i run the index function by using crontab which are in my application folder. On Tue, Feb 28, 2012 at 4:12 PM, Luciano Pacheco lucm...@gmail.com wrote: Following the same example. In you controller: from applications.instore.modules.background_updater main def force_background_updater(): ret = main() return 'The result was: %s' % ret But, the cron is run time based tasks, usually those tasks won't be used in controller.One exception is when you want to force a task to run. Regards, On Tue, Feb 28, 2012 at 9:11 PM, Sanjeet Kumar sanjeet@gmail.comwrote: i tried this but i am not be able to run my controller Can you give me the simple example through which i can run the function written under the controller inside my application On Mon, Feb 27, 2012 at 5:39 PM, Luciano Pacheco lucm...@gmail.comwrote: Example: http://movu.ca/demo/article/show/31/web2py-cron-task My first try in movu.ca :-) On Mon, Feb 27, 2012 at 2:32 PM, Sanjeet Kumar sanjeet@gmail.comwrote: Exactly I need the examples On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco lucm...@gmail.comwrote: I think Sanjeet means, I example of the task. What is a good practice in the task, or what kind of variables are present in the local namespace automagically, etc. A task should be a class a function, a python module? I had the same question last week when I was reading this chapter. :-) Regards, -- Luciano Pacheco blog.lucmult.com.br On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin spame...@gmail.comwrote: It's all in the book (if you haven't seen yet) http://web2py.com/books/default/chapter/29/4#Cron By the way, The link in web2py to cron (http://web2py.com/books/ default/reference/29/cronhttp://web2py.com/books/default/reference/29/cron) is broken (returns an invalid function message) On 26 feb, 13:09, Sanjeet Kumar sanjeet@gmail.com wrote: Can anyone give me the brief description to how I set the cron to run the task in background with example. -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br
Re: [web2py] Re: cron setup
Yes I want to run the index function of my default controller in a cron is this possible or not ? On Tue, Feb 28, 2012 at 4:58 PM, Luciano Pacheco lucm...@gmail.com wrote: You want to run the index function of your controller in a cron ? Usually it doesn't make sense, but, in the example file # file: applications/instore/modules/background_updater.py from applications.instore.controllers.default import index # instead of time.sleep(5), inside the function main() index() I alson didn't understand what you want, if this doesn't solve your question, try explain your use case. Regards, On Tue, Feb 28, 2012 at 10:00 PM, Sanjeet Kumar sanjeet@gmail.comwrote: I am not be able to get you properly can you give me the better clarification i have the default controller and the index function can you tell me how can i run the index function by using crontab which are in my application folder. On Tue, Feb 28, 2012 at 4:12 PM, Luciano Pacheco lucm...@gmail.comwrote: Following the same example. In you controller: from applications.instore.modules.background_updater main def force_background_updater(): ret = main() return 'The result was: %s' % ret But, the cron is run time based tasks, usually those tasks won't be used in controller.One exception is when you want to force a task to run. Regards, On Tue, Feb 28, 2012 at 9:11 PM, Sanjeet Kumar sanjeet@gmail.comwrote: i tried this but i am not be able to run my controller Can you give me the simple example through which i can run the function written under the controller inside my application On Mon, Feb 27, 2012 at 5:39 PM, Luciano Pacheco lucm...@gmail.comwrote: Example: http://movu.ca/demo/article/show/31/web2py-cron-task My first try in movu.ca :-) On Mon, Feb 27, 2012 at 2:32 PM, Sanjeet Kumar sanjeet@gmail.comwrote: Exactly I need the examples On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco lucm...@gmail.comwrote: I think Sanjeet means, I example of the task. What is a good practice in the task, or what kind of variables are present in the local namespace automagically, etc. A task should be a class a function, a python module? I had the same question last week when I was reading this chapter. :-) Regards, -- Luciano Pacheco blog.lucmult.com.br On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin spame...@gmail.comwrote: It's all in the book (if you haven't seen yet) http://web2py.com/books/default/chapter/29/4#Cron By the way, The link in web2py to cron (http://web2py.com/books/ default/reference/29/cronhttp://web2py.com/books/default/reference/29/cron) is broken (returns an invalid function message) On 26 feb, 13:09, Sanjeet Kumar sanjeet@gmail.com wrote: Can anyone give me the brief description to how I set the cron to run the task in background with example. -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br
Re: [web2py] Re: cron setup
Thanks Luciano i will try. On Tue, Feb 28, 2012 at 5:06 PM, Luciano Pacheco lucm...@gmail.com wrote: I have written to you how to do that. Copy and paste: , but, in the example file, do this changes: # file: applications/instore/modules/background_updater.py from applications.instore.controllers.default import index # instead of time.sleep(5), inside the function main() index() On Tue, Feb 28, 2012 at 10:33 PM, Sanjeet Kumar sanjeet@gmail.comwrote: Yes I want to run the index function of my default controller in a cron is this possible or not ? On Tue, Feb 28, 2012 at 4:58 PM, Luciano Pacheco lucm...@gmail.comwrote: You want to run the index function of your controller in a cron ? Usually it doesn't make sense, but, in the example file # file: applications/instore/modules/background_updater.py from applications.instore.controllers.default import index # instead of time.sleep(5), inside the function main() index() I alson didn't understand what you want, if this doesn't solve your question, try explain your use case. Regards, On Tue, Feb 28, 2012 at 10:00 PM, Sanjeet Kumar sanjeet@gmail.comwrote: I am not be able to get you properly can you give me the better clarification i have the default controller and the index function can you tell me how can i run the index function by using crontab which are in my application folder. On Tue, Feb 28, 2012 at 4:12 PM, Luciano Pacheco lucm...@gmail.comwrote: Following the same example. In you controller: from applications.instore.modules.background_updater main def force_background_updater(): ret = main() return 'The result was: %s' % ret But, the cron is run time based tasks, usually those tasks won't be used in controller.One exception is when you want to force a task to run. Regards, On Tue, Feb 28, 2012 at 9:11 PM, Sanjeet Kumar sanjeet@gmail.comwrote: i tried this but i am not be able to run my controller Can you give me the simple example through which i can run the function written under the controller inside my application On Mon, Feb 27, 2012 at 5:39 PM, Luciano Pacheco lucm...@gmail.comwrote: Example: http://movu.ca/demo/article/show/31/web2py-cron-task My first try in movu.ca :-) On Mon, Feb 27, 2012 at 2:32 PM, Sanjeet Kumar sanjeet@gmail.com wrote: Exactly I need the examples On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco lucm...@gmail.com wrote: I think Sanjeet means, I example of the task. What is a good practice in the task, or what kind of variables are present in the local namespace automagically, etc. A task should be a class a function, a python module? I had the same question last week when I was reading this chapter. :-) Regards, -- Luciano Pacheco blog.lucmult.com.br On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin spame...@gmail.comwrote: It's all in the book (if you haven't seen yet) http://web2py.com/books/default/chapter/29/4#Cron By the way, The link in web2py to cron (http://web2py.com/books/ default/reference/29/cronhttp://web2py.com/books/default/reference/29/cron) is broken (returns an invalid function message) On 26 feb, 13:09, Sanjeet Kumar sanjeet@gmail.com wrote: Can anyone give me the brief description to how I set the cron to run the task in background with example. -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br -- Luciano Pacheco blog.lucmult.com.br
Re: [web2py] Get the IP of the System
i want to insert the system ip address in the database so how i get the ip of the system through web2py controller On Tue, Feb 28, 2012 at 7:29 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote: Which system? On 2/28/12, Sanjeet Kumar sanjeet@gmail.com wrote: How we can get the IP address of the system
Re: [web2py] Get the IP of the System
I want to insert the client system IP address in my database through the controller can you explain how i get the client IP address of the system when they login. On Tue, Feb 28, 2012 at 7:29 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote: Which system? On 2/28/12, Sanjeet Kumar sanjeet@gmail.com wrote: How we can get the IP address of the system
Re: [web2py] Re: Capture the system shut down and browser close event
Alan can you explain in detail On Tue, Feb 28, 2012 at 7:58 PM, Alan Etkin spame...@gmail.com wrote: For checking if the server is up from the client browser (without refreshing the page) you can use jQuery .ajax() and a simple function at the controller to return the server state. I have submitted a LOAD helper enhancement to perform a ajax loop at the client side. It could be used for this purpose also (by defining an iterative javascript routine in a .load view) The inverse case is more difficult. Your operating system should write a sentry file before turning off for the web2py app to check it in a cron task or you could examine the system environment for checking the status from the web2py app also. Another way would be to have an operating system script to fire on shut down with a web request to the web2py application. The web2py app should implement a listener to perform the required actions before system shut down. On Feb 28, 7:55 am, Sanjeet Kumar sanjeet@gmail.com wrote: I am going to develop the time sheet app so for that i captured the login and logout event through this :- auth.settings.login_onaccept = lambda form: lgin(form) auth.settings.logout_onlogout = lambda usr: lgout(usr) and one more question in my mind when the browser will be closed by some reasons and the system will be shut-down due to power loss that time how we capture the event and will show it logout and update our database following is my database and the controller :- database:- db.define_table('employee_login_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date'), Field('employee_login_time'), Field('employee_logout_date',default='Logged in'), Field('employee_logout_time',default='Logged in'), Field('total_minutes',default='Logged in')) Controller:- def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) starttime = datetime.datetime.now() session.starttime = starttime currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_login_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) endtime=datetime.datetime.now() starttime = session.starttime delta = (endtime - starttime) totalminutes = str(delta.seconds / 60) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_login_detail.employee_id == auth.user.email) (db.employee_login_detail.employee_login_date == currentdate) (db.employee_login_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_minutes=totalminutes) return ''
Re: [web2py] Re: Capture the system shut down and browser close event
Massimo how can i use this On Tue, Feb 28, 2012 at 7:41 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: you need do use websockets (gluon/contrib/comet_messaging.py) On Feb 28, 4:55 am, Sanjeet Kumar sanjeet@gmail.com wrote: I am going to develop the time sheet app so for that i captured the login and logout event through this :- auth.settings.login_onaccept = lambda form: lgin(form) auth.settings.logout_onlogout = lambda usr: lgout(usr) and one more question in my mind when the browser will be closed by some reasons and the system will be shut-down due to power loss that time how we capture the event and will show it logout and update our database following is my database and the controller :- database:- db.define_table('employee_login_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date'), Field('employee_login_time'), Field('employee_logout_date',default='Logged in'), Field('employee_logout_time',default='Logged in'), Field('total_minutes',default='Logged in')) Controller:- def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) starttime = datetime.datetime.now() session.starttime = starttime currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_login_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) endtime=datetime.datetime.now() starttime = session.starttime delta = (endtime - starttime) totalminutes = str(delta.seconds / 60) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_login_detail.employee_id == auth.user.email) (db.employee_login_detail.employee_login_date == currentdate) (db.employee_login_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_minutes=totalminutes) return ''
[web2py] Time Substraction
I am going to develop the time management sheet for that i have the one table name employee table and i am allready taken the login and logout time and i want to substract the time when i substract the time it show me in nanoseconds when i convert this nanosecond to the minute it totally confused me so if any one have solution please help me following is my controller and database :- * Table:-* db.define_table('employee_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date','date'), Field('employee_logout_date','date'), Field('employee_login_time'), Field('employee_logout_time'), Field('total_time'))* Controller:-* def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) session.sttime=time.time() currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime #response.flash=currentdate for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) ettime=time.time() duration = ettime-session.sttime du = str(duration / 600) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_detail.employee_id == auth.user.email) (db.employee_detail.employee_login_date == currentdate) (db.employee_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_time=du) return ''
[web2py] Re: Time Substraction
showing AttributeError: 'datetime.timedelta' object has no attribute 'minutes' On Tuesday, February 28, 2012 1:47:40 AM UTC+5:30, Ross Peoples wrote: Well, one of the issues is going to be that you are using 'date' for your fields instead of 'datetime'. When using 'datetime', it becomes easy to do something like this: delta = row.employee_logout_date - row.employee_login_date minutes = delta.minutes + (delta.hours * 60) On Monday, February 27, 2012 11:54:56 AM UTC-5, Sanjeet Kumar wrote: I am going to develop the time management sheet for that i have the one table name employee table and i am allready taken the login and logout time and i want to substract the time when i substract the time it show me in nanoseconds when i convert this nanosecond to the minute it totally confused me so if any one have solution please help me following is my controller and database :- * Table:-* db.define_table('employee_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date','date'), Field('employee_logout_date','date'), Field('employee_login_time'), Field('employee_logout_time'), Field('total_time'))* Controller:-* def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) session.sttime=time.time() currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime #response.flash=currentdate for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) ettime=time.time() duration = ettime-session.sttime du = str(duration / 600) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_detail.employee_id == auth.user.email) (db.employee_detail.employee_login_date == currentdate) (db.employee_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_time=du) return '' On Monday, February 27, 2012 11:54:56 AM UTC-5, Sanjeet Kumar wrote: I am going to develop the time management sheet for that i have the one table name employee table and i am allready taken the login and logout time and i want to substract the time when i substract the time it show me in nanoseconds when i convert this nanosecond to the minute it totally confused me so if any one have solution please help me following is my controller and database :- * Table:-* db.define_table('employee_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date','date'), Field('employee_logout_date','date'), Field('employee_login_time'), Field('employee_logout_time'), Field('total_time'))* Controller:-* def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) session.sttime=time.time() currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime #response.flash=currentdate for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) ettime=time.time() duration = ettime-session.sttime du = str(duration / 600) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_detail.employee_id == auth.user.email) (db.employee_detail.employee_login_date == currentdate) (db.employee_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_time=du) return '' On Monday, February 27, 2012 11:54:56 AM UTC-5, Sanjeet Kumar wrote: I am going to develop the time management sheet for that i have the one table name employee table and i am allready taken the login and logout time and i want to substract the time when i substract the time it show me in nanoseconds when i convert this nanosecond to the minute it totally confused me so if any one have solution please help me following is my controller and database :- * Table:-* db.define_table
Re: [web2py] Re: Time Substraction
Thanks Massimo On Tue, Feb 28, 2012 at 10:33 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Delta has only days and seconds. On Feb 27, 9:55 pm, Sanjeet Kumar sanjeet@gmail.com wrote: showing AttributeError: 'datetime.timedelta' object has no attribute 'minutes' On Tuesday, February 28, 2012 1:47:40 AM UTC+5:30, Ross Peoples wrote: Well, one of the issues is going to be that you are using 'date' for your fields instead of 'datetime'. When using 'datetime', it becomes easy to do something like this: delta = row.employee_logout_date - row.employee_login_date minutes = delta.minutes + (delta.hours * 60) On Monday, February 27, 2012 11:54:56 AM UTC-5, Sanjeet Kumar wrote: I am going to develop the time management sheet for that i have the one table name employee table and i am allready taken the login and logout time and i want to substract the time when i substract the time it show me in nanoseconds when i convert this nanosecond to the minute it totally confused me so if any one have solution please help me following is my controller and database :- * Table:-* db.define_table('employee_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date','date'), Field('employee_logout_date','date'), Field('employee_login_time'), Field('employee_logout_time'), Field('total_time'))* Controller:-* def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) session.sttime=time.time() currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime #response.flash=currentdate for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) ettime=time.time() duration = ettime-session.sttime du = str(duration / 600) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_detail.employee_id == auth.user.email) (db.employee_detail.employee_login_date == currentdate) (db.employee_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_time=du) return '' On Monday, February 27, 2012 11:54:56 AM UTC-5, Sanjeet Kumar wrote: I am going to develop the time management sheet for that i have the one table name employee table and i am allready taken the login and logout time and i want to substract the time when i substract the time it show me in nanoseconds when i convert this nanosecond to the minute it totally confused me so if any one have solution please help me following is my controller and database :- * Table:-* db.define_table('employee_detail', Field('employee_id'), Field('employee_name'), Field('employee_login_date','date'), Field('employee_logout_date','date'), Field('employee_login_time'), Field('employee_logout_time'), Field('total_time'))* Controller:-* def lgin(form): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) session.sttime=time.time() currenttime = time.strftime(%H:%M:%S, now) session.time = currenttime #response.flash=currentdate for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_date=currentdate, employee_login_time=currenttime) return '' def lgout(usr): import datetime import time currentdate=datetime.date.today() now = time.localtime(time.time()) ettime=time.time() duration = ettime-session.sttime du = str(duration / 600) currenttime = time.strftime(%H:%M:%S, now) db((db.employee_detail.employee_id == auth.user.email) (db.employee_detail.employee_login_date == currentdate) (db.employee_detail.employee_login_time == session.time)).update(employee_logout_date=currentdate, employee_logout_time=currenttime, total_time=du) return '' On Monday, February 27, 2012 11:54:56 AM UTC-5, Sanjeet Kumar wrote: I am going to develop the time management
[web2py] cron setup
Can anyone give me the brief description to how I set the cron to run the task in background with example.
Re: [web2py] Re: cron setup
Exactly I need the examples On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco lucm...@gmail.com wrote: I think Sanjeet means, I example of the task. What is a good practice in the task, or what kind of variables are present in the local namespace automagically, etc. A task should be a class a function, a python module? I had the same question last week when I was reading this chapter. :-) Regards, -- Luciano Pacheco blog.lucmult.com.br On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin spame...@gmail.com wrote: It's all in the book (if you haven't seen yet) http://web2py.com/books/default/chapter/29/4#Cron By the way, The link in web2py to cron (http://web2py.com/books/ default/reference/29/cronhttp://web2py.com/books/default/reference/29/cron) is broken (returns an invalid function message) On 26 feb, 13:09, Sanjeet Kumar sanjeet@gmail.com wrote: Can anyone give me the brief description to how I set the cron to run the task in background with example.
Re: [web2py] Re: want to insert the data in database when the user will log-in first time
Thanks Massimo On Fri, Feb 24, 2012 at 9:23 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: How about adding this at the bottom of your model: def do_something(form): auth.settings.login_onaccept = do_something On Feb 24, 3:47 am, Sanjeet Kumar sanjeet@gmail.com wrote: I want to insert the data in database when the user will log-in first time . if the user refresh the index page after login it will again insert the date and time I have the following sample code i know this code is wrong but i want to insert the data only first time when the user will log-in. @auth.requires_login() def index(): #response.flash = c if auth.is_logged_in(): response.flash='You are logged in' else: import datetime c=datetime.datetime.now() for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_time=c) return dict(message=T('Hello World'))
[web2py] want to insert the data in database when the user will log-in first time
I want to insert the data in database when the user will log-in first time . if the user refresh the index page after login it will again insert the date and time I have the following sample code i know this code is wrong but i want to insert the data only first time when the user will log-in. @auth.requires_login() def index(): #response.flash = c if auth.is_logged_in(): response.flash='You are logged in' else: import datetime c=datetime.datetime.now() for row in db(db.auth_user.email == auth.user.email).select(db.auth_user.first_name): firstname=row.first_name db.employee_detail.insert(employee_id = auth.user.email, employee_name=firstname, employee_login_time=c) return dict(message=T('Hello World'))
[web2py] Hide the Extra added fields from auth table during the registrations
I am added the some extra fields in the auth_user table and i want to hide those fields when the user will go for the registration user can only see the following fields during the registration: - First name - Last name - email-id - Password - verify password
Re: [web2py] Re: Hide the Links based on Permission
Thanks Annet On Wed, Feb 22, 2012 at 2:51 PM, Annet anneve...@googlemail.com wrote: Hi Sanjeet, If Admin and Client are groups you could also do: {{if auth.has_membership('Admin'):}} Admin links {{elif auth.has_membership('Client'}} Client links {{pass}} Regards, Annet
Re: [web2py] Re: Validate the Checkbox
I got it but you are putted here the same name of the check box through which we can validate the multiple checkbox eaisly but here i want the value of the different check box in different variables for checking the multiple conditions. such as qury=db((db.employee.name==a ) | (db.employee.name==b ) | (db.employee.name==b )).select() On Tue, Feb 21, 2012 at 1:36 PM, whowhywhat mads...@gmail.com wrote: also TR(Type:,TD(INPUT(_type=checkbox,_name=options,_value=a,_size=0,requires = IS_NOT_EMPTY(error_message=Please select at least one check-box)), A ... to have your required error message Please check out the excellent web2py documentation for forms and validators http://web2py.com/books/default/chapter/29/7#Validators On Feb 21, 12:51 pm, whowhywhat mads...@gmail.com wrote: You can also just write a jquery validator for the same.. On Feb 21, 12:49 pm, whowhywhat mads...@gmail.com wrote: This should work. Although it is ugly (it gives a error message under all the checkboxes :P ).. but does validate as you require. Please check and let me know. def multi_check_box(): form = FORM(TABLE( TR(Type:,TD(INPUT(_type=checkbox,_name=options,_value=a,_size=0,requires = IS_NOT_EMPTY()), A, INPUT(_type=checkbox,_name=options,_value=b,_size=0), B, INPUT(_type=checkbox,_name=options,_value=c,_size=0), C)), TR(,INPUT(_type=submit,_value=SUBMIT if form.accepts(request.vars,session): return dict(form=form) On Feb 21, 11:09 am, Sanjeet Kumar sanjeet@gmail.com wrote: TR(Type:,(TD(INPUT(_type=checkbox,_name=a,_value=a,_size=0),A))), (TD(INPUT(_type=checkbox,_name=b,_value=b,_size=0),B)), (TD(INPUT(_type=checkbox,_name=c,_value=c,_size=0),C))), TR(,INPUT(_type=submit,_value=SUBMIT )) On Tue, Feb 21, 2012 at 11:28 AM, whowhywhat mads...@gmail.com wrote: please could post your controller code.. On Feb 21, 10:32 am, Sanjeet Kumar sanjeet@gmail.com wrote: I have the multiple check-box in one row in Controller I want to validate it form controller when the user submit his request without selecting any of the check-box than it should be shown the error message Please select at least one check-box
[web2py] Hide the Links based on Permission
I am using the same layout for the Admin and Client but i want to hide some links for the clients in my page based on the permissions
[web2py] Re: Validate the Checkbox
Thanks My problems are solved
[web2py] Re: Requesting Feedback for Web2py Instant Admin
Can I add the dropdown for searching in Plugin_instant_admin
[web2py] Validate the Checkbox
I have the multiple check-box in one row in Controller I want to validate it form controller when the user submit his request without selecting any of the check-box than it should be shown the error message Please select at least one check-box
Re: [web2py] Re: Validate the Checkbox
TR(Type:,(TD(INPUT(_type=checkbox,_name=a,_value=a,_size=0),A))), (TD(INPUT(_type=checkbox,_name=b,_value=b,_size=0),B)), (TD(INPUT(_type=checkbox,_name=c,_value=c,_size=0),C))), TR(,INPUT(_type=submit,_value=SUBMIT )) On Tue, Feb 21, 2012 at 11:28 AM, whowhywhat mads...@gmail.com wrote: please could post your controller code.. On Feb 21, 10:32 am, Sanjeet Kumar sanjeet@gmail.com wrote: I have the multiple check-box in one row in Controller I want to validate it form controller when the user submit his request without selecting any of the check-box than it should be shown the error message Please select at least one check-box
Re: [web2py] Re: How to Generate the effective report by using web2py
Thanks Ross On Fri, Feb 17, 2012 at 6:23 PM, Ross Peoples ross.peop...@gmail.comwrote: Sanjeet. I sent some code to Mariano last night. So we will have to wait and see if it works for him.
Re: [web2py] Re: How to Generate the effective report by using web2py
Ross Can you send me the CODE for that thanks in advance because i want to generate the report properly through FPDF. On Thu, Feb 16, 2012 at 6:31 PM, Ross Peoples ross.peop...@gmail.comwrote: I had to write a lot of code to get FPDF to do proper headers, footers, and page numbers. Then about another 100 lines of code to get it to wrap long lines of text inside of a table. I'm also not using HTML to PDF conversion. I am using FPDF's methods to create PDFs. If I recall correctly, I tried to use paragraphs and even new line characters to force the line to break, but ended up having to use absolute positioning for the lines. It sounds terrible, I know, but I have been using this successfully for a little while. I basically wrote a module that takes a query (just like SQLFORM.grid) and generates a PDF with headers, footers, a logo, and can even group data into multiple tables, all while wrapping long text and repeating column headers on each new page. It was a lot of work, but the reports look pretty good. Mariano, what about FPDF are you planning on updating? And are you planning to break backwards-compatibility?
Re: [web2py] Re: How to Generate the effective report by using web2py
Ross i am new in web2py and python so please what are you planning put in the repository because i want to generate the report by using FPDF and i also generated the report but now in the rows i have the large text so Problems are arising on the view On Fri, Feb 17, 2012 at 12:02 AM, Mariano Reingart reing...@gmail.comwrote: Ross: I'm planning a unicode patch and a better support to html rendering using web2py helpers They will not break compatibility. If you want, you can sent me your changes, I could add it somewhere or using as a base of a new reporting functions. It would be great if you can fill an issue: http://code.google.com/p/pyfpdf/ BTW, if you want, I can give you commit access. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Thu, Feb 16, 2012 at 10:01 AM, Ross Peoples ross.peop...@gmail.com wrote: I had to write a lot of code to get FPDF to do proper headers, footers, and page numbers. Then about another 100 lines of code to get it to wrap long lines of text inside of a table. I'm also not using HTML to PDF conversion. I am using FPDF's methods to create PDFs. If I recall correctly, I tried to use paragraphs and even new line characters to force the line to break, but ended up having to use absolute positioning for the lines. It sounds terrible, I know, but I have been using this successfully for a little while. I basically wrote a module that takes a query (just like SQLFORM.grid) and generates a PDF with headers, footers, a logo, and can even group data into multiple tables, all while wrapping long text and repeating column headers on each new page. It was a lot of work, but the reports look pretty good. Mariano, what about FPDF are you planning on updating? And are you planning to break backwards-compatibility?
[web2py] How to Generate the effective report by using web2py
Following is my code but i don't get the report in proper format and when we got the pdf than the column is collapse with each other so please kindly help me :- def listing(): response.title = abc # define header and footers: head = THEAD(TR(TH(Activity,_width=20%), TH(Due Date,_width=10%), TH(Company,_width=10%), TH(city,_width=10%), TH(Area of Law,_width=10%), TH(legislation,_width=10%), TH(Rules and Regulations,_width=20%), TH(Status,_width=10%), _bgcolor=#A0A0A0)) foot = TFOOT(TR(TH(LCM+,_width=100%, _align=center), _bgcolor=#E0E0E0)) # create several rows: rows = [] for row in db((db.compliance_tracker.company == session.company) (db.compliance_tracker.time_line = session.strtdate) (db.compliance_tracker.time_line = session.enddate)).select(): col = row.id % 2 and #F0F0F0 or #FF rows.append(TR(TD('%s'%row.compliance_activity,_width=20%), TD(%s%row.time_line,_width=10%), TD(%s%row.company,_width=10%), TD(%s%row.city,_width=10%), TD(%s%row.area_of_law,_width=10%), TD(%s%row.legislation,_width=10%), TD(%s%row.rules_and_regulations,_width=20%), TD(%s%row.status,_width=10%), _bgcolor=col)) # make the table object body = TBODY(*rows) table = TABLE(*[head,foot, body], _border=1, _align=center, _width=100%) if request.extension==pdf: from gluon.contrib.pyfpdf import FPDF, HTMLMixin # define our FPDF class (move to modules if it is reused frequently) class MyFPDF(FPDF, HTMLMixin): def header(self): self.set_font('Arial','B',12) self.cell(0,10, response.title ,1,0,'C') self.ln(20) def footer(self): self.set_y(-15) self.set_font('Arial','I',8) txt = 'Page %s of %s' % (self.page_no(), self.alias_nb_pages()) self.cell(0,10,txt,0,0,'C') pdf=MyFPDF() # first page: pdf.add_page() pdf.write_html(str(XML(table, sanitize=False))) response.headers['Content-Type']='application/pdf' return pdf.output(dest='S') else: # normal html view: return dict(table=table)
Re: [web2py] Re: How to Generate the effective report by using web2py
no Actually we have problem in the fields if we take the lage data from database than it is creating the problem
Re: [web2py] How to Change the date format
Thanks
Re: [web2py] How to Change the date format
Thanks
[web2py] How to Change the date format
Hi to all, I want to change the date format during the insertion in database default is YYY-MM-DD but i want to insert in database by using the DD- MM- and Month should be in the 'jan' format . Please help me
[web2py] How to upload the file through the controller in uploads folder and insert them into database
def create(): import os filepath = os.path.join(request.folder,'uploads') form = FORM(TABLE(TR(Compliance Activity:,INPUT(_type=text,_name=activity,requires=IS_NOT_EMPTY(error_message='Please Enter the Activity'))), TR(Document:,INPUT(_type=file,_name=fileupload,requires=IS_NOT_EMPTY(error_message='Please Select the file you want to Upload'))), TR(,INPUT(_type=submit,_value=SUBMIT if form.accepts(request.vars, session): session.activity = form.vars.activity session.fileupload = form.vars.fileupload.filename db.submit_compliance_detail.insert(compliance_activity=session.activity,compliance_manager='themisde...@gmail.com',compliance_owner=auth.user.email,document=session.fileupload) response.flash = 'uploaded' return dict(form=form)
[web2py] Calling Controller Function from javascript
How to call the Controller function from javascript