On Tuesday, December 4, 2018 at 9:34:44 PM UTC-8, Dave S wrote:
>
>
>
> On Tuesday, December 4, 2018 at 12:17:52 AM UTC-8, Gaël Princivalle wrote:
>>
>> Hello.
>>
>> Is there a way to delete automatically the sessions?
>> I mean the folders/files inside this folder:
>> web2py/applications/my_app/
On Tuesday, December 4, 2018 at 12:17:52 AM UTC-8, Gaël Princivalle wrote:
>
> Hello.
>
> Is there a way to delete automatically the sessions?
> I mean the folders/files inside this folder:
> web2py/applications/my_app/sessions
>
> For example deleting the sessions oldest than 1 week.
>
> Thanks!
I use the sessions2trash.py script very successfully as an hourly task on
PythonAnywhere.
I copied the code from the web2py scripts folder to a scripts folder under
my app as I've modified the original code slightly to print totals of
trashed sessions. I use the "delete after 60 minutes" settin
think there is a web2py script for that session2trash.py
ref:
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Cleaning-up-sessions
another alternative you can use shell or python subprocess then make a
scheduler for it (cron) or even with configuration management like ansible
bes
Yes, it's work:
def user():
if request.post_vars.email:
request.post_vars.email = request.post_vars.email.strip()
return dict(form=auth())
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.go
1. Oops, instead of request.vars it should be request.post_vars
2. As 1st validator try CLEANUP('\s')
--
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
Today I tried both of variant:
first in default.py
def user():
if request.vars.email:
request.vars.email = request.vars.email.lower().strip()
return dict(form=auth())
don't work - "incorrect email"
second, I don't sure that all right here in db.py
def emailStrip():
form.vars.
Thank you, I try to change it )
--
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
`onvalidation` is what happens *after *form validation is passed.
You can add your validators to auth_user.email.requires (they should be
first on the validators list )
or you can insert your formatters in user() controller, I mean:
def user():
if request.vars.email:
request.vars.
I do like that:
def email_to_lower(form):
form.vars.email = form.vars.email.lower()
form.vars.email = form.vars.email.strip()
auth.settings.login_onvalidation = email_to_lower
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (So
You can use auth.settings.login_onvalidation to strip the email string.
--
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
At the moment is not possible to change it directly in grid or smartgrid.
This is because the javascript variable is fixed, assigned
in
https://github.com/web2py/web2py/blob/master/applications/welcome/views/web2py_ajax.html
and then used
in
https://github.com/web2py/web2py/blob/master/applicat
No.
This
http://web2py.com/books/default/chapter/29/11/jquery-and-ajax#The-ajax-function
More especifically this example
:
http://web2py.com/books/default/chapter/29/11/jquery-and-ajax#Ajax-form-submission
I suggest you put a attribute "data-id" in your delete button and when you
click them
You mean the onclick: function() ?
El martes, 28 de marzo de 2017, 10:09:04 (UTC-3), Marlysson Silva escribió:
>
> Have you tried the ajax function() from web2py ?
>
> It use the callback function on controller and the data( id by example ) ,
> and the callback receive this data and process them
Have you tried the ajax function() from web2py ?
It use the callback function on controller and the data( id by example ) ,
and the callback receive this data and process them ( make search and
delete it ) .
Em segunda-feira, 27 de março de 2017 20:49:59 UTC-3, Winter Kryz escreveu:
>
> Hello E
Actually that solution was not quite correct. The one below is.
if form.process(formname='form').accepted:
rows = db(db.auth_user.location_id ==
auth.user.location_id).select(db.auth_user.id)
db(db.shift_availability.created_by.belongs(rows)).delete()
On Thu, Feb 23, 2017 at 12:57 PM, M
Thanks that worked. I have a shift_availability table and the auth_user
table. The auth_user table contains a location. I want to clear all the
rows in the shift_availability table but by location. Below is the solution:
if form.process(formname='form').accepted:
rows = db((db.shift_availabili
On Wednesday, February 22, 2017 at 4:03:00 PM UTC-8, Mat Miles wrote:
>
> I need to create a join to limit the rows to be deleted. Is it possible to
> delete a row from one table when a query joins two tables?
>
Not sure about the full answer, but a partial answer would be to use the
join in a S
use text.string.
On Monday, April 11, 2016 at 8:52:56 AM UTC-4, rajjm...@gmail.com wrote:
>
> If I use the helper function it works. Ran into one issue though.
>
> {{=SPAN(A( IMG(_src=URL('static','images/delete.png')), _href =
> URL('delete',args=id), _title = 'Delete', _onclick = "javascrip
If I use the helper function it works. Ran into one issue though.
{{=SPAN(A( IMG(_src=URL('static','images/delete.png')), _href =
URL('delete',args=id), _title = 'Delete', _onclick = "javascript:return
confirm('Are you sure you want to process?')", _class = 'Delete') ) }}
Now, if I want to st
please try
{{=SPAN(A(T('Delete'), _href = URL('delete', args = [id] ), _title =
'Delete',
_onclick = "javascript:return confirm('Are you sure you want to
process?')",
_class = 'to-delete') ) }}
best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
thanks guys, good insight as always
--
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 Gro
Presumably the logout and delete are happening in the same request, so just
put the id in a variable. Hard to say exactly how you should handle it
without seeing your code.
On Tuesday, November 24, 2015 at 2:05:35 PM UTC-5, Alex Glaros wrote:
>
> Anthony,
>
> am using custom deletion workflow.
Anthony,
am using custom deletion workflow.
Where is best place to store the user_id so logout doesn't erase it?
session? temp table?
thanks
Alex
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.goog
On Tuesday, November 24, 2015 at 12:28:13 PM UTC-5, Leonel Câmara wrote:
>
> Anthony shouldn't Auth.profile do that by default?
>
Yes. I assume he was using some custom user account deletion workflow.
Alex, if you set auth.settings.allow_delete_accounts=True, you can let
users delete their accou
Anthony shouldn't Auth.profile do that by default?
--
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
Sure, grab the ID first, then logout, then delete.
On Tuesday, November 24, 2015 at 11:44:24 AM UTC-5, Alex Glaros wrote:
>
> If a user deletes their account, my controller deletes their db.auth_user
> record but their login session is still active. If I try to auth.logout()
> then, I get integ
Oops, good catch.
--
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
It returns Rows object with only one record in it. I want to delete only
one record from the Rows object.
On Saturday, 13 September 2014 22:24:08 UTC+5:30, Anthony wrote:
>
> You can try:
>
> session.exrows = session.exrows.find(lambda r: r.id == session.exrows[
> session.counter].id)
>
> Keep in
You can try:
session.exrows = session.exrows.find(lambda r: r.id == session.exrows[
session.counter].id)
Keep in mind that will not delete the record from the database -- only from
the Rows object itself.
Anthony
On Saturday, September 13, 2014 12:12:39 PM UTC-4, Gliese 581 g wrote:
>
> I have
It should be:
d = request.args(0)
--
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 Group
Yes. Please open a ticket so we'll remember to fix it.
On Saturday, 5 April 2014 18:21:35 UTC-5, horridohobbyist wrote:
>
> If I delete records in SQLFORM.grid, the number of records does not
> change. Only if I explicitly refresh the browser page does the number of
> records change.
>
> Have I
Thanks :P awesome thats really simple hahaha :D
On Tue, Jul 23, 2013 at 5:06 PM, Niphlod wrote:
> use Field('image', 'upload', autodelete=True)
>
>
> On Tuesday, July 23, 2013 10:18:24 PM UTC+2, nicor...@gmail.com wrote:
>>
>> i am making a product app in web2py everything is working really wel
use Field('image', 'upload', autodelete=True)
On Tuesday, July 23, 2013 10:18:24 PM UTC+2, nicor...@gmail.com wrote:
>
> i am making a product app in web2py everything is working really well
> exept one thing.
>
> i upload the images like this:
>
> the_image = db.product_images.image.stor
hi anthony,
here is the trace back :
TRACEBACK
1.
2.
3.
4.
5.
6.
Traceback (most recent call last):
File "/host/Downloads/web2py/gluon/restricted.py", line 212, in restricted
exec ccode in environment
File "/host/Downloads/web2py/applications/retail/views/default/bill.html",
line 83, in
Difficult to help without knowing what the error is. Do you have a
traceback?
When you return a dict from a controller function, web2py looks for the
associated view and then executes the view. If the view is expecting some
variable to be in the returned dict but that variable happens not to be
hi anthony,
sorry, i'm not sure what do you mean 'the view is expecting a particular
variable to be returned but that variable is not in locals()'
here is the code that return an error:
for k, v in session.order.items():
if v==0:
del session.order[k]
*redirec
What error occurs if you return locals()? If the view is expecting a
particular variable to be returned but that variable is not in locals(),
that would cause an error -- is that the issue?
Anthony
On Friday, February 15, 2013 7:39:17 PM UTC-5, 黄祥 wrote:
>
> thank you so much for your explainat
thank you so much for your explaination, antony, i thought it was an
illegal operation in web2py work flow or programming logic. but some times
it's wise to decide it whether use redirect or return locals(), or is there
any other options to do this except using redirect or return locals()?
here
Yes, you can have multiple return statements in different logic branches of
a function.
Anthony
On Friday, February 15, 2013 11:44:02 AM UTC-5, 黄祥 wrote:
>
> thank you so much for your detail explaination about the differnce logic,
> anthony.
> according to your explaination about return so tha
thank you so much for your detail explaination about the differnce logic,
anthony.
according to your explaination about return so that i've modified into :
*#controllers/default.py*
def order_callback():
id=int(request.vars.id)
if request.vars.action=='add':
session.order[id]=sess
In the second and third cases, you delete session.order[id] but then try to
return it, which will generate an error (so the response to the Ajax call
will be a 500 error). This doesn't happen in the first case because the
redirect happens before the return.
Anthony
On Thursday, February 14, 20
Hi Anthony,
Thanks for your reply.
It should just return 0 (indicating that 0 records were deleted).
In that case I don't have to check db(db.eventList.nodeID==id) on emptyness
before calling .delete()
Best regards,
Annet
--
---
You received this message because you are subscribed to the
It should just return 0 (indicating that 0 records were deleted).
Anthony
On Thursday, February 7, 2013 1:38:34 PM UTC-5, Annet wrote:
>
> If db(db.eventList.nodeID==id) is empty will
> db(db.eventList.nodeID==id).delete()
> result in an error?
>
> Best regards,
>
> Annet
>
--
---
You receiv
It should. Please open a ticket and we will add it.
On Monday, 14 January 2013 07:34:51 UTC-6, dederocks wrote:
>
> Hello,
>
> How do you translate the following in dal?
>
> delete tableA from tableA where TableA.field1='x'
> join TableB on TableB.field2=TableA.field3
> WHERE (TableB.field3 = y) ?
Change the == on the field tests to single =
db((tableA.field1='x') & (tableA.field3==TableB.field2) &
(TableB.field3=y)).delete()
Ron
if you do db((tableA.field1=='x') & (tableA.field3==TableB.field2) &
> (TableB.field3==y)).delete() it doesn't work -- too many tables selected.
> I also trie
Hi, I had a look at sqlform.py, the error comes from the fact that if a
default value is set for the field upload, web2py tries to read it and
store it as the new value for the upload field. As a result it is not
possible to me to edit forms and remove uploads by setting the default
value, this tri
Hi Massimo, thank for the answer, I updated the code but the problem is
still there, I made several tests, no one figured out what is wrong. So
that I tried to simplify the code as follows:
db.define_table('test_img',
Field("picture", "upload",
uploadfolder=os.path.join(request.fol
perhaps not the cause of the problem but
request.folder+'uploads/pictures'
should be
os.path.join(request.folder,'uploads','pictures')
On Thursday, 27 December 2012 00:30:00 UTC-6, Paolo wrote:
>
> Hi Massimo,
> I've just tried to post and then edit with both SQLFORM.factory having
> uploads
Hi, I thought about the option requires, right now I have:
requires=[IS_IMAGE(), IS_UPLOAD_FILENAME(extension='jpg|jpeg|png'), IS_IMAGE
(extensions=('jpeg', 'png'))
I thought that as defined, the field could not be empty, so, I tried to
remove any constrain
requires=None
but then the delete butt
Hi Massimo,
I've just tried to post and then edit with both SQLFORM.factory having
uploadseparate but nothing has changed. The problem is still there,
actually I am making explicitly inserts and edits.
The whole SQLFORM.factory to edit a field is this:
for field in ['title','descr
Did you upload the file first and then add uploadseparate/uploadfolder?
On Wednesday, 26 December 2012 12:49:01 UTC-6, Paolo wrote:
>
> Hi all,
> it seems to me that SQLFORM.factory doesn't honor the uploadseparate
> option because I'am not able to delete the uploaded file with
> SQLFORM.fact
so it turns out that GAE itself fails when i pass an iterator over a large
list to gae.delete(). so i've tweaked the implementation to not call
count, but to still count the number of entries deleted and it seems to be
working.
suggested patch included
in http://code.google.com/p/web2py/issue
sure. i'll make a patch soon...
thanks for the input!
cfh
On 10/20/12 13:29 , Massimo Di Pierro wrote:
I meant to skip count.
On Saturday, 20 October 2012 15:28:56 UTC-5, Massimo Di Pierro wrote:
How about adding a gae only parameter to the gae adapter_args that tells
it to skip fetch?
On
I meant to skip count.
On Saturday, 20 October 2012 15:28:56 UTC-5, Massimo Di Pierro wrote:
>
> How about adding a gae only parameter to the gae adapter_args that tells
> it to skip fetch?
>
> On Saturday, 20 October 2012 11:25:51 UTC-5, howesc wrote:
>>
>> It appears that the most efficient way
How about adding a gae only parameter to the gae adapter_args that tells it
to skip fetch?
On Saturday, 20 October 2012 11:25:51 UTC-5, howesc wrote:
>
> It appears that the most efficient way to delete on app engine is to:
> - build a query object, like we are doing now
> - call run with keys_
It appears that the most efficient way to delete on app engine is to:
- build a query object, like we are doing now
- call run with keys_only=True
(https://developers.google.com/appengine/docs/python/datastore/queryclass#Query_run)
which returns an iterator.
- pass that iterator to the datast
Delete should return the number of deleted records. What is your proposal?
On Wednesday, 17 October 2012 17:30:22 UTC-5, howesc wrote:
>
> Hi all,
>
> I'm trying to clean up old expired sessions.but i waited a long time
> to get to this and now my GAE delete is just timing out. Reading the G
Sometimes the message was deleted, if I forgot to wrap the code through
apposite tool (button with braces symbol) . Maybe for security reasons.
Il giorno giovedì 11 ottobre 2012 13:45:31 UTC+2, curiouslearn ha scritto:
>
> This is perhaps a problem with google groups. Only reasons I am saying
This is perhaps a problem with google groups. Only reasons I am saying this
is because this happened to me on d3.js google groups.
I had to repost in the chain and then it worked.
On Wednesday, October 10, 2012 10:04:50 PM UTC-4, Massimo Di Pierro wrote:
>
> I have seen some delete posts. We do
_after_delete.append is a great improvement.
I really like to run a function after the user press the default
delete button from a smartgrid, I can hide this button and add a
custom delete button, but whit _after_delete.append(function) is a
best solution.
Thanks.
2012/5/25 Anthony :
> Not in cu
Not in current stable, but in trunk, you can do:
db.mytable._after_delete.append(myfunction)
The _after_delete attribute of the table is a list of functions that take
the table as an argument and are run after any delete is performed. There's
also _before_delete as well as similar lists for bef
that is is precisely...
The current recommended way of creating layout plugins works fine when
installing plugins but does leave you "naked" if you decide to uninstall all
layout plugins or uninstall the last layout plugin installed.
To get a better understanding of why this is true you can se
Thank you, I found the problem.
views/layout.html is REPLACED when the layout plugin installed and
stay as is even you uninstall the plugin, which means the original one
is not restored.
I tried the following but others cause the same problem.
http://web2py.com/layouts/static/plugin_layouts/plug
Which layout plugin did you install?
On Thursday, October 6, 2011 6:27:27 PM UTC-4, Omi Chiba wrote:
>
> >Have you confirmed the default theme files have actually been deleted?
> Not sure where it's located...
>
It would be /views/layout.html and /static/css/base.css.
>
> > When using the la
>Have you confirmed the default theme files have actually been deleted?
Not sure where it's located...
> When using the layout plugin, had you modified your layout.html to extend the
> plugin layout.html
No. It's a brand new app. I think you can also re-produce it very
easily. By the way, web2py
Have you confirmed the default theme files have actually been deleted? When
using the layout plugin, had you modified your layout.html to extend the
plugin layout.html, and if so, did you change it back after deleting the
plugin?
Anthony
On Thursday, October 6, 2011 4:34:17 PM UTC-4, Omi Chiba
I can't, I have to work with the html table because I do this before
creating the SQLTQBLE :
db[request.args(0)].sample_id.represent=\
lambda sample_id, record: A("%(sample)s"
%db.v_sample_num_all[sample_id],\
_href=URL(r=request,f='read',args=request.args(0)+'/'+st
I do not think this qualifies for addition but it is useful.
I would have done:
rows = db().select(db.table.ALL)
db.table.fieldtodelete.writable=False
table = SQLTABLE(rows)
or
rows = db().select(*[field for field in db.table if not
field.name=='fieldtodelete'])
table = SQLTABLE(rows)
On Aug
do you refer to web2py.com/demo_admin and web2py.com/demo_app ? Yes,
they are in readonly mode.
On Jul 31, 4:23 pm, peter wrote:
> I now see that the delete buttons do not work in your live demos, and
> that this is maybe deliberate as you do not want people emptying the
> demo databases. So mayb
I am a bit lost about the context. Is this about a previous thread?
massimo
On Jul 31, 4:12 pm, peter wrote:
> Bruno
>
> Thanks a lot for this, it is a very useful tool just as I needed it.
>
> I am using the latest version of web2py, and python 2.5, so I had the
> same problems as Tomt had. I c
You have to id the user session and delete it
On Mar 24, 6:30 am, Neveen Adel wrote:
> Hello,
>
> Is there a way to when a user delete another online user , the deleted
> user logged out ?
>
> Thanks in Advance
I added your suggested solution to trunk because the fact that
form.elements(...) does not work in this case should be considered a
bug. I wish there was a better solution but I could not think of one.
On 4 Lug, 11:06, Bob_in_Comox wrote:
> Using web2py version 1.79.2
>
> In building a form using
On 1 Lug, 15:34, Lennon wrote:
> In my application I have a form that removes the relationship between
> two data types without deleting each piece of data.
>
> To do this I run a delete on the many to many relation lookup table
> that stores the relationships.
>
> For each of the relationships
You are right. We can do this better but the only improvement would be
speed.
On May 27, 2:06 pm, Iceberg wrote:
> > > > On May 11, 1:08 pm,Iceberg wrote:
>
> > > > > Hi Massimo,
>
> > > > > Right now validators are triggered even when a record is successfully
> > > > > being deleted. This can be
> > > On May 11, 1:08 pm,Iceberg wrote:
>
> > > > Hi Massimo,
>
> > > > Right now validators are triggered even when a record is successfully
> > > > being deleted. This can be annoying in case I am deleting old records
> > > > as below:
>
> > > > db.define_table('my_table',
> > > > Field('toda
Posting a possible solution in trunk now.
in gluon/sqlhtml.py replace
if requested_delete:
return True
with
if requested_delete:
self.errors.clear()
return True
let me know if it works for you.
On May 27, 6:0
> On May 11, 1:08 pm,Iceberg wrote:
>
> > Hi Massimo,
>
> > Right now validators are triggered even when a record is successfully
> > being deleted. This can be annoying in case I am deleting old records
> > as below:
>
> > db.define_table('my_table',
> > Field('today', 'date',
> > requ
Good point! Will do.
Massimo
On May 11, 1:08 pm, Iceberg wrote:
> Hi Massimo,
>
> Right now validators are triggered even when a record is successfully
> being deleted. This can be annoying in case I am deleting old records
> as below:
>
> db.define_table('my_table',
> Field('today', 'date',
SQLFORM has an argument called "deletable" if you set it to True when
you initialize it, you will have an option like "delete this record".
and when you submit the form with that option checked then the record
will be deleted.
On 20 Nisan, 03:12, claudio wrote:
> I have a newbie question: How can
This would delete all posts by current user for example:
db(db.posts.author==auth.user_id).delete()
On Apr 19, 7:12 pm, claudio wrote:
> I have a newbie question: How can I create a form to delete selected
> entries from a database? Can I use SQLFORM for this?
>
> I have tables roughly like this
a projectfile should reference a project, but a project can have many
projectfiles
On 14 Jun., 23:37, mdipierro wrote:
> shouldn't there be a file in projectfile that references a project? Or
> can a projectfile belong to multiple projects?
>
> On Jun 14, 4:13 pm, pk wrote:
>
> > yeah,
> > sor
82 matches
Mail list logo