[web2py] Customize grid ondelete warning message

2017-04-07 Thread Manuele Pesenti
Hi!

Is there an easy way to customize the warning message that pops up when
I try to delete a record from a table using gird?

Both from grid and from edit interface, hopefully from the same place ;)

Thanks a lot

M.

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


[web2py] Re: how to get the id of the first row in sqlform.grid when it is loaded?

2017-04-07 Thread A3

>
> I made following changes to make it work: 
>
- When the fields rendered the first row is marked as topfield and stored 
in session.topfield
- First time load or reload returns row.id = 0 and forces to row.id stored 
in session.topfield 

 

 def view_report():
qry.reportnr.represent = render_FIELD(qry.reportnr)
fields = (qry.id,qry.detail, qry.reportnr,)
grid = SQLFORM.grid(qr,fields =fields,
orderby= qry.reportnr,
groupby = qry.reportnr,
create = False,
deletable = False,
editable = False,
showbuttontext=False,
csv=False,
maxtextlength = 64,
paginate = 10)
details = DIV("Details",_id="details")
return dict(grid=grid, details=details, dummynr="0")

The View:
view_report.html
 {{=grid}}
 
 {{=LOAD('default','report_details.load',ajax=True, target='details', 
user_signature=True ,vars={"Rnr_id":dummynr})}}

def render_FIELD():
def __init__(self):
  self.topfield = True
def __call__(self,ids,row,col=None):
... 
span.append(A(ids,callback=URL('default','report_details.load', 
vars=dict(id=ids, Rnr_id=row.id)),target='details'))
if self.topfield:
   session.topfield = row.id
self.topfield = False



The loaded  view:
report_details.load
 {{=report.detail}}

The function 
def report_details()
row_id = request.vars['Rnr_id']
if row_id == '0': 
   row_id = session.topfield
table = "tbl_reports"
field = "id"
q =(db[table][field]==row_id) 
s = db(q)
row = s.select().first()
return dict(report=row)

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


[web2py] Re: Customize grid ondelete warning message

2017-04-07 Thread Leonel Câmara
You can change it in the web2py_ajax.html view it's the 
w2p_ajax_confirm_message var.

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


[web2py] Re: appconfig.ini versus models/0.py

2017-04-07 Thread Anthony
On Friday, April 7, 2017 at 2:40:47 PM UTC-4, Marlysson Silva wrote:
>
> But current welcome aplication already have the appconfig.ini file in 
> wizard ..
>
> https://github.com/web2py/web2py/tree/master/applications/welcome/private
>
> Or do you want to say in create application in admin application..
>

The wizard copies the welcome application, which now includes 
appconfig.ini, but it didn't back when the wizard was originally created.

Anthony

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


[web2py] Re: Password Recovery Not Sending (lazyT object being passed to GAE?)

2017-04-07 Thread webmaster
Thanks for bringing this issue back up and posting a workaround.  

The worst part is the way to fix this is probably about as easy as wrapping 
something in "str()", just need to know how the web2py internals all link 
together.

On Thursday, April 6, 2017 at 4:51:17 AM UTC-7, Karoly Kantor wrote:
>
> Thanks, this helped, i am now using my own function to send the password 
> reset email.
>
> On Friday, March 31, 2017 at 2:51:03 PM UTC+2, Jacinto Parga wrote:
>>
>> Yes, still unresolved.
>>
>> I did a workaround for the request_reset_password: 
>>
>> def user(): 
>> if request.args(0)=='request_reset_password':
>> redirect(URL('default','myrequestpass'))
>> return dict(form=auth())
>>
>> def myrequestpass():
>> form = SQLFORM.factory(
>> Field('u_email', requires =[IS_EMAIL(error_message='Wrong 
>> email'), IS_IN_DB(db, 'auth_user.email', error_message='Address not in 
>> DB')]),
>>   table_name='solicitar_pass')
>> if form.process().accepted:
>> user = db(db.auth_user.email==form.vars.u_email).select().first()
>> session.flash = 'Comprueba tu correo '+str(user.first_name)
>> u_passwd = str(hex(int(time.time([2:]
>> user.update_record(password=CRYPT()(u_passwd.encode('utf8'))[0])
>> mensaje=' Retrieve your password Temporal password 
>> :  '+ u_passwd   +'   Login with the temporal password 
>> and set your new password in this link :https://yoursite.com/user/login?_next=/user/change_password;>Change 
>> Password''
>> mail.send(to=[form.vars.u_email],
>> subject='Change your password, follow this link',
>> message=mensaje)
>> redirect(URL('default','index'))
>> elif form.errors:
>> response.flash = 'Wrong Email address'
>> return dict(form=form)
>>
>>
>> But anyway the lazyT found is an annoying error width, for instance: auth
>> .settings.auth_two_factor_enabled = True
>>
>>
>> El jueves, 30 de marzo de 2017, 8:13:06 (UTC+2), Karoly Kantor escribió:
>>>
>>> As the issue is still unresolved, i have unchecked the "no action 
>>> needed" flag on this topic. Any help would be appreciated. Thank you.
>>>
>>> On Thursday, March 30, 2017 at 6:33:07 AM UTC+2, Karoly Kantor wrote:

 This issue still seems to be unsolved. I have a fresh installation on 
 GAE, reset password emails fail due to "need string or buffer, lazyT 
 found"

 Is there something I can do?

 Thanks.

 On Friday, July 29, 2016 at 7:49:14 AM UTC+2, webm...@trytha.com wrote:
>
> I just uploaded an updated version of web2py to my server, replacing a 
> much older version (likely 2.12.2), and now it won't send password 
> recovery 
> emails.  The error in the logs is: 
>
> Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
> found
>
> This suggests to me that somehow a string is not properly being 
> passed.  I gather that lazyT has something to do with the built-in 
> translation capabilities of web2py?  Probably don't need to be 
> translating 
> email addresses (though I guess it could be trying to translate the 
> recovery message).  Either way, GAE wants nothing to do with it.
>
> How can I fix this?
>


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


[web2py] DAL select inner join to straight field list instead of multiple dicts per table

2017-04-07 Thread lucas
hello one and all,

as it is, web2py DAL select inner join separates the fields by a dict for 
each table, and it makes sense to do that.

however, is there a way under the select to merge the field:value list, 
without the per table dict split out, in the case that the selected field 
names do not duplicate themselves?

thanx in advance, lucas

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


Re: [web2py] SQLFORM.GRID Change Header and labels too?

2017-04-07 Thread Javier Pepe
Hi

You can use de label atribute in Field definition, this used in all forms.


   - label is a string (or a helper or something that can be serialized to
   a string) that contains the label to be used for this field in
   auto-generated forms.

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor


2017-04-07 13:38 GMT-03:00 r :

> So I have changed the header for my sqlform grid:
>
> grid = SQLFORM.grid(db.adminis,headers={'adminis.Name':'Name'
> ,'adminis.Description':'Description','adminis.Rating':'Average Rating'})
>
> and when I click on view/edit I would like the same labels to be used. How
> is it possible ?
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: TABLE and TBODY helpers add TR innapropriately

2017-04-07 Thread Brian M
Leonel thanks for your help. I did need to put everything in the XML the 
way I was doing it because otherwise it all gets escaped. But that is 
because I was basically converting everything to a string first which is 
not what I wanted so you were right and I was confused. 

As far as why not put it in the view, there is no way to re-use those code 
snipets. I am trying to build code that makes building a table that has 
control over my little linux based device. The table is the way it makes 
available to the user to configure and control things. So for example, I 
will need links in most tables and I need to do it all in controller to 
have functions defined so that I can use the bit of code that makes the 
links work from any web page that has a table of stuff to control. 

Again thanks for your help.

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


[web2py] Re: web2py behind IIS - 404 File or Directory Not Found. - RESOLVED

2017-04-07 Thread weheh
Hallelujah! Praise to Remco Boerma for his excellent youtube video 
 on how to make web2py work 
behind IIS. I am beginning to believe my suspicion that there is a version 
compatibility problem with wfastcgi.py and/or python 2.7.X 32 vs. 64 bit 
that one encounters in the doc version of instructions. Remco's approach 
worked perfectly the first time and I was up and running in about 10 
minutes. Thank you Remco!

On Thursday, April 6, 2017 at 11:40:15 PM UTC-6, weheh wrote:
>
> Now I'm wondering if the wfastcgi.py 3.0.0 that I downloaded is somehow 
> not compatible with some of the python2.7 modules in the flow.
>
> On Thursday, April 6, 2017 at 7:48:44 PM UTC-6, weheh wrote:
>>
>> I've now compared my installation against a known good installation. All 
>> the various parameters and installed routines are the same, but still 
>> getting the 404 message. Anybody have any thoughts about what it might be 
>> or what I should be looking at?
>>
>> On Thursday, April 6, 2017 at 3:12:51 PM UTC-6, weheh wrote:
>>>
>>> Have been struggling with web2py behind IIS installation on AWS for a 
>>> couple of days now and getting nowhere. The best I am able to produce is a 
>>> 404 error message. I've tried two completely clean installations from 
>>> scratch, followed the web2py book documentation to the letter, and still no 
>>> go. Any ideas what I should be checking?
>>>
>>

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


[web2py] Re: appconfig.ini versus models/0.py

2017-04-07 Thread Marlysson Silva
But current welcome aplication already have the appconfig.ini file in 
wizard ..

https://github.com/web2py/web2py/tree/master/applications/welcome/private

Or do you want to say in create application in admin application..


Em quinta-feira, 30 de março de 2017 11:20:58 UTC-3, Anthony escreveu:
>
> The wizard was created before appconfig existed, and it looks like it was 
> never updated. Feel free to open a Github issue and link back to this 
> thread.
>
> Anthony
>
> On Thursday, March 30, 2017 at 12:33:07 AM UTC-4, Jared Priddle wrote:
>>
>> Hi guys,
>>
>> I created a new application with the wizard and noticed a lot of settings 
>> in models/0.py that I hadn't seen before.
>>
>> What is the purpose of this file versus appconfig.ini?  I'd rather have 
>> all the private settings in once place if possible and there seems like 
>> significant duplication between these two locations. For example:
>>
>> private/appconfig.ini
>>
>> [smtp]server = smtp.gmail.com:587sender = y...@gmail.com login  
>> = username:password
>>
>>
>> models/0.py
>>
>> settings.email_server = 'logging'
>> settings.email_sender = 'y...@example.com '
>> settings.email_login = ''
>>
>>
>> What am I missing?
>>
>

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


[web2py] SQLFORM.GRID Change Header and labels too?

2017-04-07 Thread r
So I have changed the header for my sqlform grid:

grid = 
SQLFORM.grid(db.adminis,headers={'adminis.Name':'Name','adminis.Description':'Description','adminis.Rating':'Average
 
Rating'})

and when I click on view/edit I would like the same labels to be used. How 
is it possible ?


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


[web2py] Re: TABLE and TBODY helpers add TR innapropriately

2017-04-07 Thread Brian M
Anthony, this is what I was looking for. Thanks! I am trying not to build 
the html myself and use the helpers instead. I am going for readability and 
ease of use for others to modify later. In all the examples in the book 
nowhere did it show the append and insert for the HTML helpers I looked at. 

The gist of it was that I needed to was to not convert everything to 
strings, but make them the various helper objects so when passed to the 
TBODY and TABLE they don't add 


tbody=TBODY()
headerrow=TR()


###
#big fancy query loop and processing to accomplish the following#
headerrow.append('column 1') 
tbody.append(TR(TD('db data processed and gussied up')))
###


thead=THEAD(headerrow)
table=TABLE(_class='pure-table pure-table-bordered')
table.append(thead)
table.append(tbody)
htmltable=XML(table)

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


[web2py] Re: TABLE and TBODY helpers add TR innapropriately

2017-04-07 Thread Anthony
On Friday, April 7, 2017 at 9:48:37 AM UTC-4, Brian M wrote:
>
> Anthony, this is what I was looking for. Thanks! I am trying not to build 
> the html myself and use the helpers instead. I am going for readability and 
> ease of use for others to modify later. In all the examples in the book 
> nowhere did it show the append and insert for the HTML helpers I looked at. 
>
> The gist of it was that I needed to was to not convert everything to 
> strings, but make them the various helper objects so when passed to the 
> TBODY and TABLE they don't add 
>
>
> tbody=TBODY()
> headerrow=TR()
>
>
> ###
> #big fancy query loop and processing to accomplish the following#
> headerrow.append('column 1') 
> tbody.append(TR(TD('db data processed and gussied up')))
> ###
>
>
> thead=THEAD(headerrow)
> table=TABLE(_class='pure-table pure-table-bordered')
> table.append(thead)
> table.append(tbody)
> htmltable=XML(table)
>
>
Note, some of this is covered here: 
http://web2py.com/books/default/chapter/29/05/the-views#HTML-helpers

You can do as you have above and directly .append() to a helper object such 
as a TBODY. But you can also simply build a Python list of helpers and then 
pass the entire list to the parent. For example:

table_rows = [TR(TD(record.name)) for record in records]
table_body = TBODY(*table_rows)

The above uses *table_rows argument unpacking, but you can in fact simply 
pass a list to TBODY rather than using the unpacking syntax:

table_body = TBODY(table_rows)

Now let's say you have some complicated code to produce a row of the table. 
You can abstract that into a separate function and then build the whole 
table body in a simple one-liner:

def build_complicated_row(record):
cells = []
cells.append(TD(some_function(record)))
... # more code to add TDs
return TR(cells, _class='some_class')

table_body = TBODY([build_complicated_row(record) for record in records])

Anthony

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


[web2py] [Contribution] Generate Map using google maps sql and web2py

2017-04-07 Thread Juan Carlos Quesada



function initMap() {
var myLatLng = {lat: 40.4636670001, lng: -3.74922366};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 5,
center: myLatLng
});

var markers = [];
{{

associa = db.associacions.with_alias("a")
poblacio = db.poblaciones.with_alias("p")
rows= 
db(associa).select(associa.nom,poblacio.poblacion,poblacio.latitud,poblacio.longitud,left=[poblacio.on(poblacio.poblacion
 == associa.poblacio)])
i=1
for r in rows:
}}

var marker{{=i}} = new google.maps.Marker({
position: new google.maps.LatLng(parseFloat({{=r.p.latitud}}), 
parseFloat({{=r.p.longitud}})),
map: map,
title: "{{=r.a.nom.replace("\n","")}}",
});
markers.push(marker{{=i}});

{{

i+=1
pass
}}
var markerCluster = new MarkerClusterer(map, markers);
}


https://maps.googleapis.com/maps/api/js?key=YOUR_KEY";>








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


[web2py] Re: web2py behind IIS - 404 File or Directory Not Found.

2017-04-07 Thread Brian M
I cannot truly help, but I do use IIS and have found that it can be 
cantankerous. I would suggest simply trying to get a static file from 
web2py then you can work on the IIS settings to allow certain types of 
files that it might be blocking. The 404 on a new IIS installation simply 
means you haven't got the plumbing right yet. I recently added an ashx file 
type and found that there were two locations (because we were following 
best security practices list we had gotten a hold of) that I had to find 
and modify to allow this new extension type. This of course took hours. 

Hopefully I spark something in your brain that makes you check and find the 
answer. Good luck.

On Thursday, April 6, 2017 at 6:48:44 PM UTC-7, weheh wrote:
>
> I've now compared my installation against a known good installation. All 
> the various parameters and installed routines are the same, but still 
> getting the 404 message. Anybody have any thoughts about what it might be 
> or what I should be looking at?
>
> On Thursday, April 6, 2017 at 3:12:51 PM UTC-6, weheh wrote:
>>
>> Have been struggling with web2py behind IIS installation on AWS for a 
>> couple of days now and getting nowhere. The best I am able to produce is a 
>> 404 error message. I've tried two completely clean installations from 
>> scratch, followed the web2py book documentation to the letter, and still no 
>> go. Any ideas what I should be checking?
>>
>

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