[web2py] docker for web2py with conda running on nginx

2019-11-04 Thread rāma
Dear web2py community,

I am sharing my docker container that has pandas, numpy and scikit-learn 
preinstalled via docker running on nginx.

https://hub.docker.com/r/rnjv/conda-web2py

docker pull rnjv/conda-web2py

Best,
rāma

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e6fd8c31-f533-468d-b9ec-56a833616862%40googlegroups.com.


[web2py] Re: validators

2019-11-04 Thread Scott Hunter
You could write one to do this & use it where you need to.

On Monday, November 4, 2019 at 12:00:47 AM UTC-5, T.R.Rajkumar wrote:
>
> sqlform filed validators do not check for the precision of decimal fields. 
> It would be nice it web2py validates the precision of fields.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6e181e57-ecf2-4d3f-9ba3-f6d6b2fde1d6%40googlegroups.com.


[web2py] Re: SQLFORM.grid search with fields readable = False

2019-11-04 Thread cdbaron
It works,

but the solution is db.table.field.listable = False to hide fields in the 
gridand search, db.table.field.readable = False to hide fields and not 
search and db.table.field.searchable = False to show Fields in grid and not 
search.

El viernes, 1 de noviembre de 2019, 16:52:04 (UTC+1), Paul Ellis escribió:
>
> If you want the fields to be searchable. Then instead of setting readable 
> = false. 
>
> Hide the fields with:
>
> db.table.field.represent = lambda value, row: DIV(value, _class='hidden')
>
> and the column heading with:
>
> grid = SQLFORM.grid(
> headers = {
>  'table.field' : DIV(_style = "display:None"),
> }
> )
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0a6b5dc0-767f-4ca5-9832-8c4cba55abc0%40googlegroups.com.


[web2py] Re: Redis session error - latest web2py master

2019-11-04 Thread Jose C
So it appears to be a bug... adding () after the decode on line 185 of 
redis_session.py appears to resolve the cause of this traceback.

However another issue has cropped up...  every page hit results in a new 
session key being created which means they're unusable.  Changing sessions 
from redis to the default disk based sessions works as expected so it 
appears to be something related to the redis implementation.

Can anyone confirm whether they are using redis for sessions successfully 
in a configuration similar to the above?

Thx,

Jose

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/351997fc-76ca-4fbc-9290-61f2e84c4222%40googlegroups.com.


[web2py] Re: Tempfile not found when uploading images with the Add function in a Grid

2019-11-04 Thread Paul Ellis
Actually I was looking at the wrong controller function. I have a utility 
function which returns part of the UI. Somehow when the form is submitted 
and this is run the tempfile for the image is closed. So by doing this at 
the end, after the form processing is complete, the problem is solved.

@auth.requires_login()
def add_custom():

#check if there is an offer selected
# if not session.quote or not session.quote.number:
# session.flash = T('Please select an offer first')
# redirect(URL('default', 'offer_landing'))

try:
offerId = request.args[0]
except IndexError:
offerId = 0
offerDetails = offer.authorise(offerId)

pagetitle = H3(T('Custom Product'))
buttongroup = [btn.back()]

try:
record = db.custom_product[request.args[1]] or None
except [IndexError, KeyError, TypeError]:
record = None

if session.custom_copy:
db.custom_product.productname.default = session.custom_copy.
productname
db.custom_product.description.default = session.custom_copy.
description
db.custom_product.purchasecost.default = session.custom_copy.
purchasecost
db.custom_product.monthlycost.default = session.custom_copy.
monthlycost
#db.custom_product.smallimage.default = 
session.custom_copy.smallimage
session.custom_copy = None

db.custom_product.created_on.readable = False
db.custom_product.updated_on.readable = False

form = SQLFORM(db.custom_product, record, showid = False)

if form.process().accepted:
#do this for insert but not update
if not record:
# need to get the max priorites from the offer table
pp = mp = None
# offerDetails = db.offer[session.quote.number]

# increment whichever needs to be used and save it to the offer 
table
if form.vars.purchasecost:
if offerDetails.offer.maxpurchasepriority:
offerDetails.offer.maxpurchasepriority += 1
else:
offerDetails.offer.maxpurchasepriority = 1
pp = offerDetails.offer.maxpurchasepriority
if form.vars.monthlycost or (not form.vars.purchasecost and not 
form.vars.monthlycost):
if offerDetails.offer.maxmonthlypriority:
offerDetails.offer.maxmonthlypriority += 1
else:
offerDetails.offer.maxmonthlypriority = 1
mp = offerDetails.offer.maxmonthlypriority
offerDetails.offer.update_record()

# insert record into product_offer_item
db.product_offer_item.insert(
offer_id = offerDetails.offer.id,
custom_pid = form.vars.id,
quantity = 1,
purchasepriority = pp,
monthlypriority = mp,
)
else:
# only do this for updates
# check if a price change also needs a priority change
poiRecord = record.product_offer_item.select().first()
pp = copy.copy(poiRecord.purchasepriority)
mp = copy.copy(poiRecord.monthlypriority)
#poi_set = db(db.product_offer_item.custom_pid == poiRecord.id)
if pp and (not form.vars.purchasecost > 0):
poiRecord.update_record(purchasepriority = 0)
if not pp and (form.vars.purchasecost > 0):
poiRecord.update_record(purchasepriority = 99.5)
if mp and (form.vars.purchasecost > 0 and not form.vars.monthlycost 
> 0):
poiRecord.update_record(monthlypriority = 0)
if not mp and\
((not form.vars.purchasecost > 0 and not 
form.vars.monthlycost 
> 0) or\
not form.vars.purchasecost > 0 and form.vars.monthlycost 
> 0):
poiRecord.update_record(monthlypriority = 99.5)
offer.position_check(offerDetails.offer.id)
session.flash = T('Success')
redirect(btn.EditOffer(offerDetails.offer.id,
dict(custId = offerDetails.customer.id)).url)

elif form.errors:
response.flash = T('Errors in form')
else:
pass
status = roo.status(offerDetails) # <- Moved this line from the top to 
down here
response.view = 'core.html'
return dict(
pagetitle = pagetitle,
pagecontent = form,
buttongroup = buttongroup,
status = status,
)


-- 
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.
To view this discussion on the web visit