[web2py] Secure view {{code}} - disabling import and dangerous commands

2015-03-20 Thread Robin Manoli
Hey!
I'm wondering if it is possible to use {{code}} in a more secure way, like 
disabling some basic python commands such as import. If I want some users 
to be able to write their own python code, and then the python code is 
stored in the db, but I don't want them to be able to access the file 
system on the server, or other security issues.

In fact what I really need is some if-else conditions and some local 
variables.

Any ideas?

- Robin

-- 
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: SQLFORM with IS_IN_SET(..., multiple=True) not SELECTED in FORM

2015-03-20 Thread Robin Manoli
Hey Val!
Yes I'm sure. All the other values are loaded correctly, and it works if I 
remove multiple=True.

Den lördag 21 mars 2015 kl. 00:48:30 UTC+1 skrev Val K:
>
> Hi Robin!
> Are you sure that your record is not None? (If it's None you just get 
> insert-mode, no error) 
> Check field's type, it must be  list:string/list:integer
>
>
> On Friday, March 20, 2015 at 11:52:29 AM UTC+2, Robin Manoli wrote:
>>
>> Hi!
>> Using an SQLFORM with a Field that has IS_IN_SET(..., multiple=True), 
>> works for saving the values in the database. When I try to load the Field 
>> however, using SQLFORM(..., record=myRecord), I cannot see the saved values 
>> in the form. No OPTIONs are SELECTED.
>>
>> Is there any way to SELECT them?
>>
>> - Robin
>>
>

-- 
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] Where do upload files get stored?

2015-03-20 Thread pumplerod

I've just gotten uploading an image file with SQLFORM.factory to work 
(thanks to the posts here in this forum), but I have to admit I'm totally 
confused.

I specified the uploads directory in which to store the image 

SQLFORM.factory(db.auth_user,db.brands,  Field('brand_logo', 'upload', 
uploadfolder=os.path.join(request.folder, 'uploads/')))



The upload works, when I check the database, and select the file link, the 
image file downloads.  However, I can't find it anywhere in the framework.  
There's nothing in the uploads directory.  So is the image being stored in 
the SQLite database?


-- 
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: SQLFORM.factory and inserting records...

2015-03-20 Thread pumplerod
Thank you.  So is there a way to run a post process after SQLFORM.factory 
or do I simply keep the code within the original function because this 
seems to work...

def brand():
  if request.args(0) == 'register':

form = SQLFORM.factory(db.auth_user,db.brands,
fields=['brand_name', 'brand_logo', 'first_name','last_name','email'
,'password'], onaccept=_register_brand)

if form.process(keepvalues=True).accepted:
  db.auth_user.update_or_insert(**db.auth_user._filter_fields(form.vars
))
  brandID = db.brands.update_or_insert(**db.brands._filter_fields(form.
vars))
  form.vars.brandID=brandID
  response.flash = 'form accepted'
elif form.errors:
  response.flash = 'form has errors'

return dict(form=form)


On Friday, March 20, 2015 at 5:50:13 PM UTC-5, Niphlod wrote:
>
> There are a few errors in the code, and in the assumptions you are doing:
>
> - SQLFORM.factory doesn't do any db I/O, so process() doesn't actually 
> store anything
> - either you use form.process().accepted or form.accepts(request, session)
> - you're hacking auth.forms, which is undocumented and unpredictable. I'm 
> not sure auth.settings.register_onaccept is firing inside a custom 
> SQLFORM.factory
>
>

-- 
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: Row string representantion

2015-03-20 Thread Massimo Di Pierro
No. Sorry.

On Friday, 20 March 2015 18:48:28 UTC-5, Ramón Carrillo wrote:
>
> Hi, Is there any web2py-way to change the string representation of a row? I 
> want my custom representation when doing 'print row' or {{=row}} in views.
>
> I have a list of rows from different tables, and it'd be nice to take 
> advantage of something polymorphic like __str__ or __unicode__
>
> controller.py
> =
> def action():
> rows = list(db(db.table1).select()) + list(db(db.table2).select())
> return dict(rows=rw=ows)
>
> view.html
> =
> {{for row in rows}}
> {{=row}}
> {{pass}}
>
> I know I could use db.table._format but I'd prefer not to exponse db.table to 
> the view.
>
> Thanks,
> Ramón
>
>

-- 
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: several vars in page

2015-03-20 Thread 黄祥
pardon me (for long code), i know that the inproper way to use a dict like 
that.
what i want to achieve is i want to assign a vars yet, include the others 
vars that already stored before.
for example : 
1st user search 'a' (vars search_product = a)
2nd time user click next (vars search_product =a & page = 1)
3rd time user click sort by highest price (vars search_product =a & page = 
1 & sort=highest_price)

how can i achieve it using web2py way?

thanks n best regards,
stifan

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


[web2py] Re: several vars in page

2015-03-20 Thread Niphlod
ohhh my.

how can you even suppose someone is going to read throughout all the code 
to find the culprit ? That's the most unpythonic, repeating template page 
I've ever seen. Remember that that code will be read more than written, and 
that's going to be a problem to your eyes mostly.

BTW: Fastest and dumbest method to track all kinds of issues (AKA "bisect 
to the rescue"):
1) cut down the page to the half, see if you get your traceback
2) if yes, you didn't cut the piece raising the issue. return to 1) 
3) if no, readd the cutted half, cut the half of the half you reinserted 
(i.e. the "last quarter"). Does it still raise a traceback ? return to 3)
4) if no, you found the code raising the issue

Scientifically proven, in about 10 iterations you'll cover even hundreds of 
lines of hurting code.

Anyway..the error is quite simple, and if you took care of actually 
reading it, you would have spotted right away

{{=SPAN(A(I(_class = 'icon-chevron-left'), T('Previous'), _title = 
T('Previous Page'), 
  _href = URL(vars = dict(request.vars, page = [page - 1]) ) ) ) }}

you can't instantiate a dict like that.  

tl;dr: this is the last time I'll help on more than 50 lines of code to 
inspect.

-- 
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: Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Niphlod
they'll loose session data. if they are logged in, they would be asked to 
login again.
To alleviate the issues, you could delete all records that have a 
modified_datetime older than some value in the past, e.g. 2 days ago. 
Currently logged in users (that are probably storing/changing something in 
their own session) wouldn't spot anything, and you'll get your table - 
hopefully - down to a manageable size.

BTW, if you didn't purge sessions regularly (i.e. you just started 
recently), and your script is failing to fetch the data - because it's not 
printing anything - it's probably accumulating.
Unfortunately, sessions2trash.py isn't very keen to a very large table, and 
much depends on how much data you store per session. If that table is 
holding 1GB of data, it gets stored in memory by the select that is 
fetching the records to inspect them.


On Saturday, March 21, 2015 at 1:05:31 AM UTC+1, Lisandro wrote:
>
> I've already tried with -v option for verbose output, but nothing special 
> is shown.
>
> I've just ran the script for one of the sites, and the output was ok:
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2015
> Version 2.9.12-stable+timestamp.2015.01.17.06.11.03
> Database drivers available: sqlite3, pymysql, psycopg2, pg8000, imaplib
> e4b39c2b-f6c4-442a-b352-211c2fcc3474 trashed
> a6166534-cc6e-49ef-9900-30f8ad299cc6 trashed
> bdbc3d14-ff5e-49c6-a2d6-7f2e7ea83fd7 trashed
> c169ee4b-dc48-410c-9342-a85571d41d36 OK
> 78182dcf-0738-4534-a394-98cdb320ecba OK
> b209819e-c5d7-4ba0-a922-0546a4d34bdc OK
>
> Then, I ran the script for other site, and there was no session trashed or 
> "ok", however, the execution time was around 30 seconds or more, and during 
> that time, I could see how the swap started increasing and also CPU.
>
> I read a little more about sessions, and I noticed that, when storing them 
> in the db, there is a table called, in this case, "web2py_session_init", so 
> I checked the count of records, and I found out that one of the websites 
> has **a lot** of records in that table, specifically, 1712710 records :P
>
> So I guess that's the problem, I don't know how much would web2py take to 
> clear all that sessions, but I guess that's a lot of records to handle.
>
> Question: can I just delete all records on that table? Would that cause 
> any trouble to users? Or would they just be asked to login again?
>
> El viernes, 20 de marzo de 2015, 20:18:57 (UTC-3), Niphlod escribió:
>>
>> you can check with the verbose option the things you could be interested 
>> in (and helping me/us understand the possible issues):
>> - if cleaning on "panel" right after cleaning "init" actually cleans up 
>> something --> it shouldn't if your masterapp is always "init"
>> - how many sessions are you inspecting
>> - how many sessions are you clearing
>>
>>

-- 
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: several vars in page

2015-03-20 Thread 黄祥
the error when i put the request.vars in back is :

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 223, in restricted
ccode = compile2(code, layer)
  File "C:\web2py\gluon\restricted.py", line 206, in compile2
return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
  File "C:\web2py\applications\lgc\views\transaction/invoice_cart.html", line 
135
{{pass}}
SyntaxError: non-keyword arg after keyword arg

Error snapshot [image: help] 


(non-keyword arg after keyword arg 
(transaction/invoice_cart.html, line 135))

pardon, for my bad cutting the code, my full code are :
*controllers/transaction.py*
selling_price = db.product.selling_price

# invoice_cart
def invoice_cart():
return test_transaction.cart_0(selling_price)

*modules/test_transaction.py*
def cart_0(price):
view = current.request.vars.view
sort = current.request.vars.sort
brand = current.request.vars.brand
search_product = current.request.vars.search_product
if current.request.vars.page: 
page = int(current.request.vars.page)
else: 
page = 0
items_per_page = 10
limitby = (page * items_per_page, (page + 1) * items_per_page + 1)
if brand:
rows = current.db((current.db.product.brand == brand) & 
  (current.db.product.quantity > 0) ).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = ~current.db.product.id)
elif search_product:
rows = current.db((current.db.model.id == current.db.product.model) & 
  (current.db.product.quantity > 0) 
)((current.db.product.serial_no.contains(search_product) ) | 
  (current.db.product.product_no.contains(search_product) ) | 
  (current.db.model.name.contains(search_product) ) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = ~current.db.product.id)
elif sort == 'newest':
rows = current.db((current.db.product.quantity > 0) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = ~current.db.product.id)
elif sort == 'a_z':
rows = current.db((current.db.product.quantity > 0) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = current.db.product.model)
elif sort == 'z_a':
rows = current.db((current.db.product.quantity > 0) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = ~current.db.product.model)
elif sort == 'highest_price':
rows = current.db((current.db.product.quantity > 0) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = ~price)
elif sort == 'lowest_price':
rows = current.db((current.db.product.quantity > 0) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = price)
else:
rows = current.db((current.db.product.quantity > 0) 
).select(current.db.product.ALL, 
 limitby = limitby, 
 cache = (current.cache.ram, 10), 
 orderby = ~current.db.product.id)
return dict(rows = rows, page = page, items_per_page = items_per_page, view 
= view, sort = sort, 
brand = brand, search_product = search_product)

*views/transaction/invoice_sidebar.html*
{{=DIV(B(T('Search') ) ) }}




Search



{{=DIV(B(T('Brand') ) ) }}

{{brands = db().select(orderby = db.brand.name, cache = (cache.ram, 10) ) }}




{{for i, brand in enumerate(brands):}}
{{=brand.name}}
{{pass}}



*views/transaction/invoice_cart.html*
{{left_sidebar_enabled = True}}

{{block left_sidebar}}
{{include 'transaction/invoice_sidebar.html'}}
{{end}}

{{extend 'layout.html'}}

{{=CENTER(DIV(A(T('Checkout'), _href = URL('invoice_checkout'), _title = 
T('Checkout'), 
_onclick = "javascript:return confirm('Are you sure you want to 
process?')", 
_class = 'btn btn-success') ) ) }}


*{{if page & (len(rows) > items_per_page):}}*
*{{=SPAN(A(I(_class = 'icon-chevron-left'), T('Previous'), _title = 
T('Previous Page'), *
*  _href = URL(vars = dict(page = [page - 1], request.vars) ) ) ) }}*
* |*
*{{=SPAN(A(T('Next'), I(_class = 'icon-chevron-right'), _title = 
T('Next Page'), *
*  _href = URL(vars = dict(page = [page + 1], request.vars) ) ) ) }}*
*{{elif page:}}*
*{{=SPAN(A(I(_class = 'icon-chevron-left'), T('Previous'), _title = 
T('Previous Page'), *
*  _href = URL(vars = dict(page = [page - 1], request.vars) ) ) ) }}*
*{{elif len(rows) > items_per_page:}}*
*{{=SPAN(A(T('Next'), I(_class = 'icon-chevron-right'), _title = 
T('Next Page'), *
*  _href = URL(vars = dict(page = [page + 1], request.vars) ) ) ) }}*
*{{pass}}*




Sort By 



{{if sort == 'a_z':}}

{{=A(T('Newest'), _title = T('Newest'), 
 _href = URL(vars = dict(request.vars, sort = 'newest') ) ) }}


{{=A(B(T('A-Z') ), _title = T('A-Z') ) }}


{{=A(T('Z-A'), _title = T('Z-A'), 
 _href = URL(vars = dict(request.vars, sort = 'z_a') ) ) }}



[web2py] Re: Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Lisandro
I've already tried with -v option for verbose output, but nothing special 
is shown.

I've just ran the script for one of the sites, and the output was ok:
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2015
Version 2.9.12-stable+timestamp.2015.01.17.06.11.03
Database drivers available: sqlite3, pymysql, psycopg2, pg8000, imaplib
e4b39c2b-f6c4-442a-b352-211c2fcc3474 trashed
a6166534-cc6e-49ef-9900-30f8ad299cc6 trashed
bdbc3d14-ff5e-49c6-a2d6-7f2e7ea83fd7 trashed
c169ee4b-dc48-410c-9342-a85571d41d36 OK
78182dcf-0738-4534-a394-98cdb320ecba OK
b209819e-c5d7-4ba0-a922-0546a4d34bdc OK

Then, I ran the script for other site, and there was no session trashed or 
"ok", however, the execution time was around 30 seconds or more, and during 
that time, I could see how the swap started increasing and also CPU.

I read a little more about sessions, and I noticed that, when storing them 
in the db, there is a table called, in this case, "web2py_session_init", so 
I checked the count of records, and I found out that one of the websites 
has **a lot** of records in that table, specifically, 1712710 records :P

So I guess that's the problem, I don't know how much would web2py take to 
clear all that sessions, but I guess that's a lot of records to handle.

Question: can I just delete all records on that table? Would that cause any 
trouble to users? Or would they just be asked to login again?

El viernes, 20 de marzo de 2015, 20:18:57 (UTC-3), Niphlod escribió:
>
> you can check with the verbose option the things you could be interested 
> in (and helping me/us understand the possible issues):
> - if cleaning on "panel" right after cleaning "init" actually cleans up 
> something --> it shouldn't if your masterapp is always "init"
> - how many sessions are you inspecting
> - how many sessions are you clearing
>
>

-- 
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: SQLFORM with IS_IN_SET(..., multiple=True) not SELECTED in FORM

2015-03-20 Thread Val K
Hi Robin!
Are you sure that your record is not None? (If it's None you just get 
insert-mode, no error) 
Check field's type, it must be  list:string/list:integer


On Friday, March 20, 2015 at 11:52:29 AM UTC+2, Robin Manoli wrote:
>
> Hi!
> Using an SQLFORM with a Field that has IS_IN_SET(..., multiple=True), 
> works for saving the values in the database. When I try to load the Field 
> however, using SQLFORM(..., record=myRecord), I cannot see the saved values 
> in the form. No OPTIONs are SELECTED.
>
> Is there any way to SELECT them?
>
> - Robin
>

-- 
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] Row string representantion

2015-03-20 Thread Ramón Carrillo


Hi, Is there any web2py-way to change the string representation of a row? I 
want my custom representation when doing 'print row' or {{=row}} in views.

I have a list of rows from different tables, and it'd be nice to take advantage 
of something polymorphic like __str__ or __unicode__

controller.py
=
def action():
rows = list(db(db.table1).select()) + list(db(db.table2).select())
return dict(rows=rw=ows)

view.html
=
{{for row in rows}}
{{=row}}
{{pass}}

I know I could use db.table._format but I'd prefer not to exponse db.table to 
the view.

Thanks,
Ramón

-- 
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: condition models with function => IMG(_src='default', 'download', r=r.image)

2015-03-20 Thread Ariya Owam-aram
Hi Massimo,

Thank you for everything you & team contribute to society.

I  just found the problem,  I have to include condition models in the 
models/default folder (controller folder) instate of in the 
models/default/test folder (function folder). Because it call def 
download() which is outside test function.

##
# in models/default/test/01.py
##
pd_product_sku= Pd_product_sku(db)
pd_product_sku.define_table()

move above 01.py to modals/default

It working now.


Ariya


เมื่อ วันศุกร์ที่ 20 มีนาคม ค.ศ. 2015 22 นาฬิกา 43 นาที 59 วินาที UTC+7, 
Massimo Di Pierro เขียนว่า:
>
> What does it mean "not working". Do you get a traceback? What does it say?
>
> On Friday, 20 March 2015 10:02:57 UTC-5, Ariya Owam-aram wrote:
>>
>> Dear all,
>>
>> I implement conditions models but it seem to broken function download for 
>> display image from upload fields.
>> let say:
>>
>> ##
>> # in models/01_defind_table.py
>> ##
>> class Pd_product_sku(BaseModel):
>> def __init__(self, db):
>> self.db = db
>> self.tablename  = "pd_product_sku"
>> 
>> self.fields = [
>> Field('code',
>>   length= '50',
>>   label = T('SKU Code'),
>>   notnull   = True,
>>   requires = IS_NOT_IN_DB(db, 'pd_product_sku.code')),
>> Field('image', 'upload',
>>   label = T('Image'),
>>   uploadfolder = 
>> os.path.join(request.folder,'static/pd_product_sku'),
>>   requires  = IS_EMPTY_OR(
>> IS_IMAGE(maxsize = (1200, 1200),error_message = 'The 
>> maximum image dimension allowed for upload is 1200 x 1200px!')) ),
>> ]
>>
>> self.params = dict(
>> migrate = True,
>> #fake_migrate= True,
>> singular= T('SKU'),
>> plural  = T('SKU'),  
>> format  = '%(code)s : %(name)s'
>> )  
>>
>> ##
>> # in models/default/test/01.py
>> ##
>> pd_product_sku= Pd_product_sku(db)
>> pd_product_sku.define_table()
>>
>> ##
>> # in controller/default.py
>> ##
>> def test():
>> # pd_product_sku
>> db.pd_product_sku.image.represent = lambda v, r: 
>> IMG(_src=URL('default', 'download', args=v) )
>> grid= SQLFORM.grid(db.pd_product_sku)
>> return dict(grid=grid)
>>
>> ||
>> ||
>> ||
>> v
>>
>> IMG(_src=URL('default', 'download', args=v) not working 
>> but if I define pd_product_sku in the normal environment (model/db.py) is 
>> work as narmal.
>>
>>
>> Please advise, and thank you in advance
>>
>> Ariya
>>
>>

-- 
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: last minute web2py hackaton

2015-03-20 Thread Massimo Di Pierro
https://github.com/web2py/web2py/issues

On Friday, 20 March 2015 18:25:28 UTC-5, Ron Chatterjee wrote:
>
> Where are the list of issues?
>
> On Friday, March 20, 2015 at 11:41:16 AM UTC-4, Massimo Di Pierro wrote:
>>
>> We want to release 2.10.1 next week. We will try closing as many issue as 
>> possible in the next three days.
>>
>> You can close an issue by submitting a pull-request.
>>
>> The person who submits the largest number of accepted pull requests by 
>> Monday 5am UTC wins $100 paid for by experts4solutions. (The requests have 
>> to be submitted by the deadline but they will count even if accepted after. 
>> In case of ties the prize is split.)
>>
>> Massimo
>>
>>
>>
>>
>>
>>

-- 
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 creating subfolders

2015-03-20 Thread Val K
Hi 
I hope this will  help you:  calling custom_store and custom_retrieve using 
parameters  

On Friday, March 20, 2015 at 5:02:57 PM UTC+2, Vikash Sharma wrote:
>
> Hi
> I would like to create subfolders for uploading documents as per name 
> provided by user. Example
>
> dict_doc_type = ["Java", "J2EE", "Python"]
> db.define_table('document',
> Field('document_type', type='string', label=T('Document 
> Type'), default="M", requires=IS_IN_SET(dict_doc_type)),
> Field('doc_filename', type='string', readable=False, 
> writable=False),
> Field('doc', type='upload', label=T('Upload File'), 
> uploadseparate=True))
>
> Now 'doc' field value should be same as what was selected in 'doc_type' 
> fieled while submitting the form. That is when user fills online form, he 
> will select a category and that value will be used as parent for storing 
> uploaded file.
>
> Thanks in advance
>
>
>

-- 
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: Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Massimo Di Pierro
You say "I'm using we2py in production to serve about 15 websites, each one 
of them is served by it's own web2py installation." Why? Why not a single 
web2py running? Do the difference instances run on the same server and 
different ports?

On Friday, 20 March 2015 17:33:15 UTC-5, Lisandro wrote:
>
> I'm using we2py in production to serve about 15 websites, each one of them 
> is served by it's own web2py installation.
>
> I want to clean up expired sessions every certain amount of time. To do 
> that, I create a file under /etc/cron.d/ for every website. The file has 
> the following content:
>
> MAILTO=root
> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S init   -M 
> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S panel  -M 
> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
>
> As you can see, the cleaning is executed one per hour. I'm using two lines 
> for each websites, because each website has two web2py applications 
> running: "init" and "panel", so I clean up sessions of both of them. 
>
> The problem is that, if I activate those lines in cron configuration, 
> every time they are executed I can see that memory usage of my sever goes 
> "to the sky" (memory is all used and the server starts to swap), also the 
> CPU load increases considerably, and during about 5 o 10 minutes, all the 
> websites throw errors.
>
> If I execute those lines manually, they execute and finish instantly. I 
> mean, there aren't too much sessions to cleanup, so the cleaning takes no 
> more than a few seconds.  So I don't understand why the same process isn't 
> working when called from cron. Any tip on this? Thanks in advance!
>

-- 
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: last minute web2py hackaton

2015-03-20 Thread Ron Chatterjee
Where are the list of issues?

On Friday, March 20, 2015 at 11:41:16 AM UTC-4, Massimo Di Pierro wrote:
>
> We want to release 2.10.1 next week. We will try closing as many issue as 
> possible in the next three days.
>
> You can close an issue by submitting a pull-request.
>
> The person who submits the largest number of accepted pull requests by 
> Monday 5am UTC wins $100 paid for by experts4solutions. (The requests have 
> to be submitted by the deadline but they will count even if accepted after. 
> In case of ties the prize is split.)
>
> Massimo
>
>
>
>
>
>

-- 
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: Global search form example

2015-03-20 Thread Ron Chatterjee
you can put this in layout.html above the NAV section. Thats how Leonel 
taught me.

form = FORM(INPUT(_name='Search', 
requires=IS_NOT_EMPTY()),INPUT(_type='submit'))



On Friday, March 20, 2015 at 9:21:58 AM UTC-4, Gael Princivalle wrote:
>
> Hi Ron.
>
> For the moment I've not done this function, I'll do it asap.
> Thank you for this suggestion, but using response.title the search 
> function will search only in title pages, right?
>
> Il giorno venerdì 20 marzo 2015 01:44:00 UTC+1, Ron Chatterjee ha scritto:
>>
>> Were you able to find a way around for the global search option. I 
>> believe one way you can do this is to create a form and call that form in 
>> menu.py using response.title. 
>>
>> I am sure there are lot of other ways. Any thoughts?
>>
>> On Wednesday, March 11, 2015 at 4:43:29 AM UTC-4, Gael Princivalle wrote:
>>>
>>> Thanks Ron but I've don't understand your answer, and I've don't find 
>>> anything about this question page 84 of the web2py_manual_5th.pdf book.
>>>
>>> Anyway I can imagine the solution is crawling all searchable fields in 
>>> all tables, saving in the for loop all rows references (function/args), and 
>>> displaying a link list.
>>>  
>>>
>>> Il giorno lunedì 9 marzo 2015 19:08:32 UTC+1, Ron Chatterjee ha scritto:

 SQLFORM.build_query[(db.table.field)]

 Passing a list ([]) into that will give you a text in that field. and 
 then you can use a form input to do the display like the book on page 84 
 on 
 the book. Damn I am getting good at this!

 On Monday, March 9, 2015 at 1:44:23 PM UTC-4, Gael Princivalle wrote:
>
> Sure.
>
> The search field at the top:
> http://www.chainreactioncycles.com/us/en
>
>
> Il giorno lunedì 9 marzo 2015 17:47:09 UTC+1, Ron Chatterjee ha 
> scritto:
>>
>> Can you give an example of "global Search". Any reference site?
>>
>> On Monday, March 9, 2015 at 12:18:54 PM UTC-4, Gael Princivalle wrote:
>>>
>>> Hello all.
>>>
>>> I would like to add a global search form in a website, the classical 
>>> one with one field and a search button.
>>> I've got some idea's about how doing it, but I would like to know if 
>>> there's an example on line, or if someone have some suggestions.
>>>
>>> Thanks.
>>>
>>

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


[web2py] Re: Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Niphlod
you can check with the verbose option the things you could be interested in 
(and helping me/us understand the possible issues):
- if cleaning on "panel" right after cleaning "init" actually cleans up 
something --> it shouldn't if your masterapp is always "init"
- how many sessions are you inspecting
- how many sessions are you clearing

-- 
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: Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Lisandro
Sessions are stored on the db.
I'm using postgresql, and this is part of my code on db.py model:

db = DAL('postgres://%s:%s@%s/%s' %(DB_USER, DB_USER_PASSWORD, DB_HOST, 
DB_NAME), lazy_tables=True)
session.connect(request, response, db=db, masterapp='init')

As you can see, I'm using masterapp parameter of the session.connect() 
method, because every one of my sites have two web2py applications that 
share sessions.
Having noticed that, I'm not shure if I have to run the sessions2trash.py 
script for both applications or just one of them. However I **think** this 
isn't relevant to the preformance problem. 



El viernes, 20 de marzo de 2015, 19:44:57 (UTC-3), Niphlod escribió:
>
> are sessions stored on files, db, memcache or redis ?
>
> On Friday, March 20, 2015 at 11:33:15 PM UTC+1, Lisandro wrote:
>>
>> I'm using we2py in production to serve about 15 websites, each one of 
>> them is served by it's own web2py installation.
>>
>> I want to clean up expired sessions every certain amount of time. To do 
>> that, I create a file under /etc/cron.d/ for every website. The file has 
>> the following content:
>>
>> MAILTO=root
>> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S init   -M 
>> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
>> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S panel  -M 
>> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
>>
>> As you can see, the cleaning is executed one per hour. I'm using two 
>> lines for each websites, because each website has two web2py applications 
>> running: "init" and "panel", so I clean up sessions of both of them. 
>>
>> The problem is that, if I activate those lines in cron configuration, 
>> every time they are executed I can see that memory usage of my sever goes 
>> "to the sky" (memory is all used and the server starts to swap), also the 
>> CPU load increases considerably, and during about 5 o 10 minutes, all the 
>> websites throw errors.
>>
>> If I execute those lines manually, they execute and finish instantly. I 
>> mean, there aren't too much sessions to cleanup, so the cleaning takes no 
>> more than a few seconds.  So I don't understand why the same process isn't 
>> working when called from cron. Any tip on this? Thanks in advance!
>>
>

-- 
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: SQLFORM.factory and inserting records...

2015-03-20 Thread Niphlod
There are a few errors in the code, and in the assumptions you are doing:

- SQLFORM.factory doesn't do any db I/O, so process() doesn't actually 
store anything
- either you use form.process().accepted or form.accepts(request, session)
- you're hacking auth.forms, which is undocumented and unpredictable. I'm 
not sure auth.settings.register_onaccept is firing inside a custom 
SQLFORM.factory

-- 
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: Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Niphlod
are sessions stored on files, db, memcache or redis ?

On Friday, March 20, 2015 at 11:33:15 PM UTC+1, Lisandro wrote:
>
> I'm using we2py in production to serve about 15 websites, each one of them 
> is served by it's own web2py installation.
>
> I want to clean up expired sessions every certain amount of time. To do 
> that, I create a file under /etc/cron.d/ for every website. The file has 
> the following content:
>
> MAILTO=root
> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S init   -M 
> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S panel  -M 
> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
>
> As you can see, the cleaning is executed one per hour. I'm using two lines 
> for each websites, because each website has two web2py applications 
> running: "init" and "panel", so I clean up sessions of both of them. 
>
> The problem is that, if I activate those lines in cron configuration, 
> every time they are executed I can see that memory usage of my sever goes 
> "to the sky" (memory is all used and the server starts to swap), also the 
> CPU load increases considerably, and during about 5 o 10 minutes, all the 
> websites throw errors.
>
> If I execute those lines manually, they execute and finish instantly. I 
> mean, there aren't too much sessions to cleanup, so the cleaning takes no 
> more than a few seconds.  So I don't understand why the same process isn't 
> working when called from cron. Any tip on this? Thanks in advance!
>

-- 
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: Image upload, translate, crop, resize options?

2015-03-20 Thread pumplerod
I think I'd like to accomplish this on the client side.  Meaning I'd like 
the user to interact with the image before submitting the form such that 
they see the crop as it will be applied.

On Friday, March 20, 2015 at 3:44:00 PM UTC-5, Dave S wrote:
>
>
>
> On Friday, March 20, 2015 at 12:54:49 PM UTC-7, pumplerod wrote:
>>
>> I'm trying to find an easy to implement, UI friendly method for allowing 
>> users to upload an image at the time of creating their account which will 
>> provide translation, resize, and crop options for their profile pic.
>>
>> I've read through a number of separate jQuery options and have tried to 
>> implement a couple without success (this, most likely, due to my 
>> perfunctory coding skills).  I'm wondering how many others may have already 
>> implemented this sort of functionality and if there is a recommended 
>> methodology or existing library.
>>
>
> Do you want to do the edting at the client or the server?  Interactively 
> or  scrpted?
>
> If on the server and scripted, I'd take a look at the image browser 
> example in the book, and just use a simple form with checkboxes for the 
> options.
>
> /dps
>
>

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


[web2py] Re: is there recommended order to name fields in select statement to quicken search results?

2015-03-20 Thread Leonel Câmara
Usually not because the modern query optimizers do it for you. It's 
probably more important that you have indexes for country and ssn.

-- 
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] Performance problems when executing the sessions2trash.py script

2015-03-20 Thread Lisandro
I'm using we2py in production to serve about 15 websites, each one of them 
is served by it's own web2py installation.

I want to clean up expired sessions every certain amount of time. To do 
that, I create a file under /etc/cron.d/ for every website. The file has 
the following content:

MAILTO=root
*/60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S init   -M -R 
/var/www/mywebsite/scripts/sessions2trash.py -A -o
*/60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S panel  -M -R 
/var/www/mywebsite/scripts/sessions2trash.py -A -o

As you can see, the cleaning is executed one per hour. I'm using two lines 
for each websites, because each website has two web2py applications 
running: "init" and "panel", so I clean up sessions of both of them. 

The problem is that, if I activate those lines in cron configuration, every 
time they are executed I can see that memory usage of my sever goes "to the 
sky" (memory is all used and the server starts to swap), also the CPU load 
increases considerably, and during about 5 o 10 minutes, all the websites 
throw errors.

If I execute those lines manually, they execute and finish instantly. I 
mean, there aren't too much sessions to cleanup, so the cleaning takes no 
more than a few seconds.  So I don't understand why the same process isn't 
working when called from cron. Any tip on this? Thanks in advance!

-- 
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.factory and inserting records...

2015-03-20 Thread pumplerod
I'm using SQLFORM.factory to generate my form which, upon submit, is 
passing validation and I see that the expected variables are returned 
correctly, however no insert is made to the database.

def brand():
  auth.settings.register_onaccept = _register_brand
  if request.args(0) == 'register':
form = SQLFORM.factory(db.auth_user,db.brands,
fields=['brand_name', 'brand_logo', 'first_name','last_name','email'
,'password'])

if form.process(keepvalues=True).accepts(request,session):
  response.flash = 'form accepted'
elif form.errors:
  response.flash = 'form has errors'

return dict(form=form)

def _register_brand(form):
  db.auth_user.update_or_insert(**db.auth_user._filter_fields(form.vars))
  brandID = db.brands.update_or_insert(**db.brands._filter_fields(form.vars
))


I'm not sure what I'm missing.  If I go through the normal user 
registration then the user is created, however with this custom form 
neither the user or the brand tables are updated with a new record.

-- 
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] is there recommended order to name fields in select statement to quicken search results?

2015-03-20 Thread Alex Glaros
is there recommended order to name fields in select statement to quicken 
search results?

for example when searching through the population of the US

searching_people = db((db.country==US) & (ssn=='111-11-'))..select(
limitby=(0,1)).first()

the second field, ssn is a narrower search than the the first. The first is 
the whole country.

does it make any difference if I put country field first or ssn field when 
building select statements?  

thanks

Alex Glaros

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


Re: [web2py] Re: Remember me with custom or alternate login?

2015-03-20 Thread Lisandro Rostagno
Thank you very much Mark for your comments!
I digged in a little more, I opened the gluon/tools.py file, and did a
search of "expiration" and "remember" to see where the code makes use
of that variables. And I found out that I was reffering to
session.auth.remember but the correct way was
session.auth.remember_me, so, changing that did the trick for me.

Thanks again!


2015-03-20 16:31 GMT-03:00 Mark Li :
> Alrighty just figured out my problem, hopefully it will apply to your case,
> Lisandro!
>
> The "name" attribute of the "remember_me" checkbox input is actually "keep
> me logged in" on my local site (not sure if this changed with web2py
> versions, or I just made this change and forgot it). Thus,
> request.vars.remember_me was None every time, even if the checkbox was
> actually checked. I changed my javascript and python code to use
> "keep_me_logged_in" instead of "remember_me", and now it's working,
>
> I would suggest using "print request.vars" in your login code, so you can
> see what vars are actually getting passed in from the form. If there is no
> "remember_me" variable, then that's most likely your main problem.
>
>
>
> On Fri, Mar 20, 2015 at 12:11 PM, Mark Li  wrote:
>>
>> I'm not quite sure, all the relevant parts of your code match mine. I did
>> just test this on my local site, and it doesn't work. However, it does work
>> for the live site, so I'm going to take a look and see what's going on.
>>
>>
>>
>> On Fri, Mar 20, 2015 at 6:22 AM, Lisandro 
>> wrote:
>>>
>>> I'm having trouble to get this to work.
>>> I've already implemented my own login through ajax, but I can't get to
>>> work the "remember me" part.
>>>
>>> This is my code:
>>>
>>> def _login():
>>> email = request.post_vars.email
>>> password = request.post_vars.password
>>> remember = request.post_vars.remember
>>> user = auth.login_bare(email, password)
>>> if not user:
>>> return response.json({'success':False})
>>> else:
>>> if remember:
>>> session.auth.expiration = 3600 * 24 * 30 # one month
>>> session.auth.remember = True
>>> response.cookies[response.session_id_name]["expires"] =
>>> session.auth.expiration
>>> return response.json({'success':True})
>>>
>>> However, I login, close the browser, reopen it, and I'm asked to login
>>> again. What am I missing?
>>>
>>>
>>>
>>> El jueves, 6 de junio de 2013, 19:07:31 (UTC-3), Anthony escribió:

 Yes, sorry, there's one more thing you have to do -- you have to convert
 the session cookie to a non-session cookie:

 response.cookies[response.session_id_name]["expires"] =
 session.auth.expiration

 That will happen the next time Auth is initialized (which would happen
 on the next request), but it won't happen if you simply close the browser.

 Anthony

 On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote:
>
> Here's the relevant part of the code I'm using. I make an ajax call to
> the function below
>
> def ajax_login():
> email = request.vars.email
> password = request.vars.password
> remember_me = request.vars.remember_me
>
> user = auth.login_bare(email, password)
> if user:
> if remember_me:
> session.auth.expiration = auth.settings.long_expiration
> session.auth.remember = True
>
>
>
>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/HdoErSDw-z8/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/HdoErSDw-z8/unsubscribe.
> To unsubscribe from this group and all its topics, 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 recei

Re: [web2py] Re: Ckeditor plugin - Update ckeditor

2015-03-20 Thread Gael Princivalle
Hello all.

Someone have an experience about how applying css files to CKeditor 
contents?

I've tried to understand this document without success:
http://docs.ckeditor.com/#!/api/CKEDITOR.dom.document

Thanks.

Il giorno giovedì 5 marzo 2015 20:09:48 UTC+1, Alex Glaros ha scritto:
>
> sanitize=True doesn't work on all styles/sizes/fonts.  sanitize=False 
> works consistently
>

-- 
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: Image upload, translate, crop, resize options?

2015-03-20 Thread Dave S


On Friday, March 20, 2015 at 12:54:49 PM UTC-7, pumplerod wrote:
>
> I'm trying to find an easy to implement, UI friendly method for allowing 
> users to upload an image at the time of creating their account which will 
> provide translation, resize, and crop options for their profile pic.
>
> I've read through a number of separate jQuery options and have tried to 
> implement a couple without success (this, most likely, due to my 
> perfunctory coding skills).  I'm wondering how many others may have already 
> implemented this sort of functionality and if there is a recommended 
> methodology or existing library.
>

Do you want to do the edting at the client or the server?  Interactively 
or  scrpted?

If on the server and scripted, I'd take a look at the image browser example 
in the book, and just use a simple form with checkboxes for the options.

/dps

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


[web2py] Re: Menu helper and controller

2015-03-20 Thread LoveWeb2py
Try this:

routers = dict( BASE = 
   dict( default_application = 'application', 
   default_controller = 'default', 
   default_function = 'index', 
),
)



On Friday, March 20, 2015 at 2:54:01 PM UTC-4, Gael Princivalle wrote:
>
> Hello all.
>
> With an app my URL is my_domain.com/my_function . Perfect, I don't have 
> the application name.
>
> Website administration is made with another controller called admin.
>
> When I call an admin function, there's the application name and controller 
> in the url. my_domain.com/my_app/admin/my_function
> Who cares.
> In my admin menu where I call admin controller functions, I have also a 
> voice for turning back to the default controller home page.
> ('Edit news', False, URL('admin', 'edit_news'), []),
> ('Turn back to website', False, URL('default', 'index'), []),
>
> Turning back to the website URL is mydomain.com/my_name_application
>
> How could I have only mydomain.com?
>
> Here is my router:
> routers = dict(
> BASE = dict(
> domains = {
> "www.mydomain.com" : "my_app", 
> }
> ),
> my_app = dict(languages=['en', 'it'], default_language='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 
"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] Image upload, translate, crop, resize options?

2015-03-20 Thread pumplerod
I'm trying to find an easy to implement, UI friendly method for allowing 
users to upload an image at the time of creating their account which will 
provide translation, resize, and crop options for their profile pic.

I've read through a number of separate jQuery options and have tried to 
implement a couple without success (this, most likely, due to my 
perfunctory coding skills).  I'm wondering how many others may have already 
implemented this sort of functionality and if there is a recommended 
methodology or existing library.

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


Re: [web2py] Re: Remember me with custom or alternate login?

2015-03-20 Thread Mark Li
Alrighty just figured out my problem, hopefully it will apply to your case,
Lisandro!

The "name" attribute of the "remember_me" checkbox input is actually "keep
me logged in" on my local site (not sure if this changed with web2py
versions, or I just made this change and forgot it). Thus,
request.vars.remember_me was None every time, even if the checkbox was
actually checked. I changed my javascript and python code to use
"keep_me_logged_in" instead of "remember_me", and now it's working,

I would suggest using "print request.vars" in your login code, so you can
see what vars are actually getting passed in from the form. If there is no
"remember_me" variable, then that's most likely your main problem.



On Fri, Mar 20, 2015 at 12:11 PM, Mark Li  wrote:

> I'm not quite sure, all the relevant parts of your code match mine. I did
> just test this on my local site, and it doesn't work. However, it does work
> for the live site, so I'm going to take a look and see what's going on.
>
>
>
> On Fri, Mar 20, 2015 at 6:22 AM, Lisandro 
> wrote:
>
>> I'm having trouble to get this to work.
>> I've already implemented my own login through ajax, but I can't get to
>> work the "remember me" part.
>>
>> This is my code:
>>
>> def _login():
>> email = request.post_vars.email
>> password = request.post_vars.password
>> remember = request.post_vars.remember
>> user = auth.login_bare(email, password)
>> if not user:
>> return response.json({'success':False})
>> else:
>> if remember:
>> session.auth.expiration = 3600 * 24 * 30 # one month
>> session.auth.remember = True
>> response.cookies[response.session_id_name]["expires"] =
>> session.auth.expiration
>> return response.json({'success':True})
>>
>> However, I login, close the browser, reopen it, and I'm asked to login
>> again. What am I missing?
>>
>>
>>
>> El jueves, 6 de junio de 2013, 19:07:31 (UTC-3), Anthony escribió:
>>>
>>> Yes, sorry, there's one more thing you have to do -- you have to convert
>>> the session cookie to a non-session cookie:
>>>
>>> response.cookies[response.session_id_name]["expires"] = session.auth.
>>> expiration
>>>
>>> That will happen the next time Auth is initialized (which would happen
>>> on the next request), but it won't happen if you simply close the browser.
>>>
>>> Anthony
>>>
>>> On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote:

 Here's the relevant part of the code I'm using. I make an ajax call to
 the function below

 def ajax_login():
 email = request.vars.email
 password = request.vars.password
 remember_me = request.vars.remember_me

 user = auth.login_bare(email, password)
 if user:
 if remember_me:
 session.auth.expiration = auth.settings.long_expiration
 session.auth.remember = True



  --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/HdoErSDw-z8/unsubscribe.
>> To unsubscribe from this group and all its topics, 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: Multi language site

2015-03-20 Thread Gael Princivalle
And if you add at the end of the db.py file:
if request.uri_language: T.force(request.uri_language)

it will set the good language.

Il giorno venerdì 20 marzo 2015 20:04:24 UTC+1, Gael Princivalle ha scritto:
>
> Salut Olivier.
>
> I use that router and for me it works fine:
> routers = dict(
> BASE = dict(
> domains = {
> "www.mydomain.com" : "my_app", 
> }
> ),
> my_app = dict(languages=['en', 'fr'], default_language='fr'),
> )
>
> The original website (words in the .html files) have to be in english.
>
> After you must edit fr language file for applying translations.
> For example:
> T('A beautiful journey')
> Load one time the .html page.
> Search for 'A beautiful journey' in the fr language file.
> Translate and save.
>
> For bigger contents make double fields in tables:
> product_description_en
> product_description_fr
>
> And in the .html file test which is the request.uri_language for 
> displaying one or the other field.
>
> Hopes it could help, bye. 
>
> Il giorno mercoledì 18 marzo 2015 17:50:22 UTC+1, olivier hubert ha 
> scritto:
>>
>> I try to made a simple multi language site with routes, but I can't.
>> The routing are correct because I can use the url like this 
>> http://127.0.0.1:8000/*testme*/en/ and *translate* application are serve.
>> But translate application is always in french!
>>
>> translate application is a copy of welcome application with the 
>> modifications below.
>>
>> Web2Py version : 2.9.12-stable+timestamp.2015.01.17.06.11.03 (Running on 
>> Rocket 1.2.6, Python 2.7.8)
>>
>> /web2py/routes.py
>> --
>>
>> routes_in = (
>>   
>> ('/testme/$language/(?P.*)','/translate/default/$any?_language=$language'),
>>  
>> )
>>
>> /translate/models/0.py
>> -
>>
>> print request.vars
>> if request.vars._language: 
>> T.force(request.vars._language)
>>
>> Terminal window return:
>> --
>> 
>>
>>

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


Re: [web2py] Re: Remember me with custom or alternate login?

2015-03-20 Thread Mark Li
I'm not quite sure, all the relevant parts of your code match mine. I did
just test this on my local site, and it doesn't work. However, it does work
for the live site, so I'm going to take a look and see what's going on.



On Fri, Mar 20, 2015 at 6:22 AM, Lisandro 
wrote:

> I'm having trouble to get this to work.
> I've already implemented my own login through ajax, but I can't get to
> work the "remember me" part.
>
> This is my code:
>
> def _login():
> email = request.post_vars.email
> password = request.post_vars.password
> remember = request.post_vars.remember
> user = auth.login_bare(email, password)
> if not user:
> return response.json({'success':False})
> else:
> if remember:
> session.auth.expiration = 3600 * 24 * 30 # one month
> session.auth.remember = True
> response.cookies[response.session_id_name]["expires"] =
> session.auth.expiration
> return response.json({'success':True})
>
> However, I login, close the browser, reopen it, and I'm asked to login
> again. What am I missing?
>
>
>
> El jueves, 6 de junio de 2013, 19:07:31 (UTC-3), Anthony escribió:
>>
>> Yes, sorry, there's one more thing you have to do -- you have to convert
>> the session cookie to a non-session cookie:
>>
>> response.cookies[response.session_id_name]["expires"] = session.auth.
>> expiration
>>
>> That will happen the next time Auth is initialized (which would happen on
>> the next request), but it won't happen if you simply close the browser.
>>
>> Anthony
>>
>> On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote:
>>>
>>> Here's the relevant part of the code I'm using. I make an ajax call to
>>> the function below
>>>
>>> def ajax_login():
>>> email = request.vars.email
>>> password = request.vars.password
>>> remember_me = request.vars.remember_me
>>>
>>> user = auth.login_bare(email, password)
>>> if user:
>>> if remember_me:
>>> session.auth.expiration = auth.settings.long_expiration
>>> session.auth.remember = True
>>>
>>>
>>>
>>>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/HdoErSDw-z8/unsubscribe.
> To unsubscribe from this group and all its topics, 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: request.function .load father file

2015-03-20 Thread Gael Princivalle
Sure.

In a products.html file I call the .load file:
{{=LOAD('hp','hp.load', ajax=True, target='div_hp')}}

At the beginning of the hp.load file I would like to put a test:
{{if hp.load has not been load in products.html:}}
...
{{pass}}

The Leonel suggestion is a good solution, passing caller like a var.

 

Il giorno venerdì 20 marzo 2015 14:54:49 UTC+1, JorgeH ha scritto:
>
> Could you post the code for you are trying to achieve?
>
>
> On Friday, March 20, 2015 at 8:18:34 AM UTC-5, Gael Princivalle wrote:
>>
>> Hello all.
>>
>> Is there a way to test inside a .load file if it have been loaded inside 
>> a .html file?
>> 'request.function' return always the .load file.
>>
>> Thanks, regards.
>>
>

-- 
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: Multi language site

2015-03-20 Thread Gael Princivalle
Salut Olivier.

I use that router and for me it works fine:
routers = dict(
BASE = dict(
domains = {
"www.mydomain.com" : "my_app", 
}
),
my_app = dict(languages=['en', 'fr'], default_language='fr'),
)

The original website (words in the .html files) have to be in english.

After you must edit fr language file for applying translations.
For example:
T('A beautiful journey')
Load one time the .html page.
Search for 'A beautiful journey' in the fr language file.
Translate and save.

For bigger contents make double fields in tables:
product_description_en
product_description_fr

And in the .html file test which is the request.uri_language for displaying 
one or the other field.

Hopes it could help, bye. 

Il giorno mercoledì 18 marzo 2015 17:50:22 UTC+1, olivier hubert ha scritto:
>
> I try to made a simple multi language site with routes, but I can't.
> The routing are correct because I can use the url like this 
> http://127.0.0.1:8000/*testme*/en/ and *translate* application are serve.
> But translate application is always in french!
>
> translate application is a copy of welcome application with the 
> modifications below.
>
> Web2Py version : 2.9.12-stable+timestamp.2015.01.17.06.11.03 (Running on 
> Rocket 1.2.6, Python 2.7.8)
>
> /web2py/routes.py
> --
>
> routes_in = (
>   
> ('/testme/$language/(?P.*)','/translate/default/$any?_language=$language'),
>  
> )
>
> /translate/models/0.py
> -
>
> print request.vars
> if request.vars._language: 
> T.force(request.vars._language)
>
> Terminal window return:
> --
> 
>
>

-- 
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] Menu helper and controller

2015-03-20 Thread Gael Princivalle
Hello all.

With an app my URL is my_domain.com/my_function . Perfect, I don't have the 
application name.

Website administration is made with another controller called admin.

When I call an admin function, there's the application name and controller 
in the url. my_domain.com/my_app/admin/my_function
Who cares.
In my admin menu where I call admin controller functions, I have also a 
voice for turning back to the default controller home page.
('Edit news', False, URL('admin', 'edit_news'), []),
('Turn back to website', False, URL('default', 'index'), []),

Turning back to the website URL is mydomain.com/my_name_application

How could I have only mydomain.com?

Here is my router:
routers = dict(
BASE = dict(
domains = {
"www.mydomain.com" : "my_app", 
}
),
my_app = dict(languages=['en', 'it'], default_language='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 
"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: last minute web2py hackaton

2015-03-20 Thread Massimo Di Pierro
You deserve a special prize independently on this. :-)

On Friday, 20 March 2015 11:57:37 UTC-5, Niphlod wrote:
>
> damn. I should have waited all those months. 
>
> muhahahaha!
>
> let's see if money speed up things.
>
> BTW; I'd have included that with the fix should be included a regression 
> test to make it never happen again, but that's just me
>
>
>

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


Re: [web2py] Re: foreign key constraint failed

2015-03-20 Thread António Ramos
yep.
you are right.
I was using amostra.n but should be amostra.id

Thank u for your time as usual Leonel.

Regards

2015-03-20 16:50 GMT+00:00 Leonel Câmara :

> In that case amostra.n is not pointing to a valid amostra.
>
> --
> 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.


Re: [web2py] Re: No module named objects / 2.9.12-stable+timestamp.2015.03.17.18.03.34 / Windows

2015-03-20 Thread Kiran Subbaraman
Works. Tested it on: 
http://www.web2py.com/examples/static/nightly/web2py_win.zip
I did notice that the web2py response seemed slower than what I normally 
expect. I'll get back with numbers; will be easier to figure out if 
there is any issue to be addressed then.



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Fri, 20-03-2015 8:32 PM, Massimo Di Pierro wrote:

@Kiran,

Can you download the latest "for testers" version and confirm this is 
fixed for you?



On Friday, 20 March 2015 02:20:23 UTC-5, Niphlod wrote:

it's the one that was already fixed 8 hours ago.

On Friday, March 20, 2015 at 7:38:05 AM UTC+1, Massimo Di Pierro
wrote:

Can anybody else reproduce this issue?

On Friday, 20 March 2015 00:04:12 UTC-5, Kiran Subbaraman wrote:

Windows 8.1 64 bit
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500
32 bit (Intel)] on win32
Just the plain rocket server - have not installed /
configured a web server.


Kiran Subbaraman
http://subbaraman.wordpress.com/about/  


On Thu, 19-03-2015 10:34 PM, Massimo Di Pierro wrote:

which windows version? what Python version? are you
behind Apache or other web server?

On Thursday, 19 March 2015 03:24:45 UTC-5, Kiran
Subbaraman wrote:

Tried with the latest (for testers):
I saw the same "no module named objects" error.

Went back to admin, and selected the "clean" option.
I don't see the previous error.

Now I see this issue:
Version
web2py™ Version
2.9.12-stable+timestamp.2015.03.19.06.51.11
Python Python 2.7.9:
C:\Users\subbaraman\Downloads\web2py_win_002\web2py\web2py.exe
(prefix: D:\programs\open\python27)
Traceback


Traceback (most recent call last):
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\restricted.py",
line 226, in restricted
exec ccode in environment
  File

"C:/Users/subbaraman/Downloads/web2py_win_002/web2py/applications/my_app/controllers/default.py",
line 1107, in 
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\globals.py",
line 393, in 
self._caller = lambda f: f()
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\tools.py",
line 3455, in f
return action(*a, **b)
  File

"C:/Users/subbaraman/Downloads/web2py_win_002/web2py/applications/my_app/controllers/default.py",
line 304, in index
orderby=_construct_orderby(), limitby=limitby,
**cache_settings)
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\packages\dal\pydal\objects.py",
line 2085, in select
return adapter.select(self.query,fields,attributes)
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\packages\dal\pydal\adapters\base.py",
line 1228, in select
time_expire)
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\cache.py",
line 428, in __call__
self.storage[key] = (now, value)
  File

"C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\cache.py",
line 328, in __setitem__
pickle.dump((time.time(), value), tmp,
pickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle :
attribute lookup


Have attached a sample app that will help recreate
this problem. The backend is postgres. The password
needs to be updated, before you test it.


Kiran Subbaraman
http://subbaraman.wordpress.com/about/  


On Thu, 19-03-2015 12:58 PM, Niphlod wrote:

nope, can't replicate. Try downloading the latest.

On Thursday, March 19, 2015 at 5:46:43 AM UTC+1,
Kiran Subbaraman wrote:

Downloaded it from
http://www.web2py.com/examples/static/nightly/web2py_win.zip

.
   

[web2py] Re: Dal cache key name

2015-03-20 Thread Massimo Di Pierro
cache prefix would not work in this case since the user has no knowledge of 
what the key is and has no way to set the a prefix.

On Friday, 20 March 2015 11:55:40 UTC-5, Niphlod wrote:
>
> why cache_prefix has been thrown under the bus ? Let's stick to what we 
> have instead of supplying yet another method!
>
> On Friday, March 20, 2015 at 5:53:20 PM UTC+1, Massimo Di Pierro wrote:
>>
>> OK in pydal now:
>>
>> select(, cache=dict(model=cache.ram, expiration=10, key='mykey'))
>>
>> lease give it a try.
>>
>> On Friday, 20 March 2015 11:15:39 UTC-5, Rod Watkins wrote:
>>>
>>> Hi all,
>>>
>>> Would it be possible to alter the DAL code for caching to allow the 
>>> cache key name to be passed as part of the call for selects? I ask because 
>>> it would make it much easier to invalidate cache entries in a finer grained 
>>> way,
>>>
>>> Thanks
>>> Rod
>>>
>>

-- 
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: another table ref table ref table

2015-03-20 Thread Oliver Holloway
Got it! Gosh, this is cool. From re-reading those related posts, I got the 
idea that maybe I could keep drilling into the row object, so I tried that 
and it worked. In the format clause in the statement below, you can see 
that the r.program_name object contains the field name/object from the 
programs table, as well as the age_group stuff from the program_types 
table. 

db.define_table('sessions',
Field('program_name', 'reference programs'),
Field('session_type', 'string', 
requires=IS_IN_SET(['practice', 'evaluation'], zero=None)),
Field('coach', 'reference auth_user'),
Field('assistant', 'reference auth_user'),
Field('session_date_time', 'datetime'),
format = lambda r: '%s %s %s at %s on %s' % (
  
r.program_name.program_type.name,
  
r.program_name.age_group.age,
  
r.program_name.age_group.gender,
  
datetime.time(r.session_date_time),
  
datetime.date(r.session_date_time)
 )
   )

And it works perfectly! I'm testing locally in a default view built off a 
simple SQLFORM.grid controller, and the *sessions_players* view is now 
showing what I want in the dropdown. 

I might not be using correct terminology in describing how these row 
objects contain items from referenced tables multiple levels up, but in the 
code you can see what I mean.

Here's the table defs I have now, in case it's useful to anyone to see how 
they inter-connect.


db.define_table('age_gender_groups',
Field('age', 'string'), # eg: U10s, U12s, high school, 
junior high, U16s, et c.
Field('gender', 'string', 
requires=IS_IN_SET(['girls','boys', 'mixed'], zero=None)),
format = lambda r: '%s %s' % (r.age, r.gender)
   )

db.define_table('program_types',
Field('name', 'string'),
Field('stratum', 'integer'),
format = lambda r: '%s' % (r.name)
   )

db.define_table('programs',
Field('program_type', 'reference program_types'),
Field('age_group', 'reference age_gender_groups'),
Field('date_start', 'date'),
Field('date_end', 'date'),
Field('coach', 'reference auth_user'),
Field('assistant', 'reference auth_user'),
Field('squad', 'integer', default=1),#  to be able 
to sub-divide programs so as to manage size
format = lambda r: '%s %s %s' % (r.program_type.name, 
r.age_group.age, r.age_group.gender)#  squad# %(squad)s'
   )

query_programs = (
  (db.auth_user.id == db.auth_membership.user_id) &
  (db.auth_membership.group_id == db.auth_group.id) &
  (db.auth_group.role.like('coach'))
)

db.programs.coach.requires = IS_IN_DB(db(query_programs), db.auth_user.id, 
 '%(first_name)s %(last_name)s')
db.programs.assistant.requires = IS_IN_DB(db(query_programs), 
db.auth_user.id,  '%(first_name)s %(last_name)s')

db.define_table('sessions',
Field('program_name', 'reference programs'),
Field('session_type', 'string', 
requires=IS_IN_SET(['practice', 'evaluation'], zero=None)),
Field('coach', 'reference auth_user'),
Field('assistant', 'reference auth_user'),
Field('session_date_time', 'datetime'),
format = lambda r: '%s %s %s at %s on %s' % (
  
r.program_name.program_type.name,
  
r.program_name.age_group.age,
  
r.program_name.age_group.gender,
  
datetime.time(r.session_date_time),
  
datetime.date(r.session_date_time)
 )
   )

#db.sessions.session_name.represent = lambda session_name, row: 
A(session_name, _href=URL('demo', 'tests_for_this_eval', args=row.id))
#db.sessions.id.represent = lambda format, r: A(r.id, _href=URL('demo', 
'tests_for_this_eval', vars=dict(i=r.id)))

query_sessions = (
  (db.auth_user.id == db.auth_membership.user_id) &
  (db.auth_membership.group_id == db.auth_group.id) &
  (db.auth_group.role.like('coach'))
)

db.sessions.coach.requires = IS_IN_DB(db(query_sessions), db.auth_user.id, 
 '%(first_name)s %(last_name)s')
db.sessions.assistant.requires = IS_IN_DB(db(query_sessions), 
db.auth_user.id,  '%(first_name)s %(last_name)s')

db.de

[web2py] Re: Minor tweak for book? Pluralization

2015-03-20 Thread Dave S


On Thursday, March 19, 2015 at 2:33:11 PM UTC-7, Massimo Di Pierro wrote:
>
> You are right. Fixed in trunk, will be pushed live asap.
>


Thanks.  As you can guess, I encountered it while looking up pluralization,
and I'm happy to report that the PS handled my needs very well,
even though I'm not making any effort to do language support
(this is a lab tool, so the audience doesn't require it).

/dps
 

>
> On Thursday, 19 March 2015 14:52:38 UTC-5, Dave S wrote:
>>
>> In > http://www.web2py.com/books/default/chapter/29/04/the-core#Pluralization-engine
>> >
>>
>> Should 
>>
>> It knows, for example, that Slovenian has one singular form and 3 plural 
>>> forms (for x==1, x==3 or x==4 and x>4).
>>
>>
>> be instead
>>
>> It knows, for example, that Slovenian has one singular form and 3 plural 
>>> forms (for x==2, x==3 or x==4 and x>4). 
>>>
>>
>> /dps
>>
>>

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


[web2py] Re: Dal cache key name

2015-03-20 Thread Rod Watkins
Wow, that was fast!! I will test it out right away.
Thanks!!

Rod

On Friday, March 20, 2015 at 9:53:20 AM UTC-7, Massimo Di Pierro wrote:
>
> OK in pydal now:
>
> select(, cache=dict(model=cache.ram, expiration=10, key='mykey'))
>
> lease give it a try.
>
> On Friday, 20 March 2015 11:15:39 UTC-5, Rod Watkins wrote:
>>
>> Hi all,
>>
>> Would it be possible to alter the DAL code for caching to allow the cache 
>> key name to be passed as part of the call for selects? I ask because it 
>> would make it much easier to invalidate cache entries in a finer grained 
>> way,
>>
>> Thanks
>> Rod
>>
>

-- 
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: last minute web2py hackaton

2015-03-20 Thread Niphlod
damn. I should have waited all those months. 

muhahahaha!

let's see if money speed up things.

BTW; I'd have included that with the fix should be included a regression 
test to make it never happen again, but that's just me


-- 
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: Dal cache key name

2015-03-20 Thread Niphlod
why cache_prefix has been thrown under the bus ? Let's stick to what we 
have instead of supplying yet another method!

On Friday, March 20, 2015 at 5:53:20 PM UTC+1, Massimo Di Pierro wrote:
>
> OK in pydal now:
>
> select(, cache=dict(model=cache.ram, expiration=10, key='mykey'))
>
> lease give it a try.
>
> On Friday, 20 March 2015 11:15:39 UTC-5, Rod Watkins wrote:
>>
>> Hi all,
>>
>> Would it be possible to alter the DAL code for caching to allow the cache 
>> key name to be passed as part of the call for selects? I ask because it 
>> would make it much easier to invalidate cache entries in a finer grained 
>> way,
>>
>> Thanks
>> Rod
>>
>

-- 
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: Dal cache key name

2015-03-20 Thread Massimo Di Pierro
OK in pydal now:

select(, cache=dict(model=cache.ram, expiration=10, key='mykey'))

lease give it a try.

On Friday, 20 March 2015 11:15:39 UTC-5, Rod Watkins wrote:
>
> Hi all,
>
> Would it be possible to alter the DAL code for caching to allow the cache 
> key name to be passed as part of the call for selects? I ask because it 
> would make it much easier to invalidate cache entries in a finer grained 
> way,
>
> Thanks
> Rod
>

-- 
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: foreign key constraint failed

2015-03-20 Thread Leonel Câmara
In that case amostra.n is not pointing to a valid amostra.

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


Re: [web2py] Re: foreign key constraint failed

2015-03-20 Thread António Ramos
Nop,
i´m user number 6.


2015-03-20 13:06 GMT+00:00 Leonel Câmara :

> I'm guessing there's no user with the id 6
>
> --
> 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: another table ref table ref table

2015-03-20 Thread Oliver Holloway
Thanks, stifan, that got me half the way there. Now, tables *sessions* and 
*programs_players* are both showing program in desired format, rather than 
IDs. 

The only trouble I'm having now is with the table named *sessions_players*. 
It is still showing the program ID rather than the program "name", which is 
formatted as a concatenation of the program_type and the age_gender_group. 
In other posts, Anthony has pointed out that format doesn't propagate 
beyond the first referenced table, but that one can use a requires 
statement instead (and he's also pointed out that that's inefficient and 
costly for larger data sets, recommending the use of a query to generate 
options for IS_IN_SET). 

I'm going to try the requires approach for now, since my data is tiny.


db.define_table('age_gender_groups',
Field('age', 'string'), # eg: U10s, U12s, high school, 
junior high, U16s, et c.
Field('gender', 'string', 
requires=IS_IN_SET(['girls','boys', 'mixed'], zero=None)),
format = lambda r: '%s %s' % (r.age, r.gender)
   )

db.define_table('program_types',
Field('name', 'string'),
Field('stratum', 'integer'),
format = lambda r: '%s' % (r.name)
   )

db.define_table('programs',
Field('program_type', 'reference program_types'),
Field('age_group', 'reference age_gender_groups'),
Field('date_start', 'date'),
Field('date_end', 'date'),
Field('coach', 'reference auth_user'),
Field('assistant', 'reference auth_user'),
Field('squad', 'integer', default=1),#  to be able 
to sub-divide programs so as to manage size
format = lambda r: '%s %s %s' % (r.program_type.name, 
r.age_group.age, r.age_group.gender)#  squad# %(squad)s'
   )

db.programs._format = lambda r: '%s %s %s' % (r.program_type.name, 
r.age_group.age, r.age_group.gender)

query_programs = (
  (db.auth_user.id == db.auth_membership.user_id) &
  (db.auth_membership.group_id == db.auth_group.id) &
  (db.auth_group.role.like('coach'))
)

db.programs.coach.requires = IS_IN_DB(db(query_programs), db.auth_user.id, 
 '%(first_name)s %(last_name)s')
db.programs.assistant.requires = IS_IN_DB(db(query_programs), 
db.auth_user.id,  '%(first_name)s %(last_name)s')

db.define_table('sessions',
Field('program_name', 'reference programs'),
Field('session_type', 'string', 
requires=IS_IN_SET(['practice', 'evaluation'], zero=None)),
Field('coach', 'reference auth_user'),
Field('assistant', 'reference auth_user'),
Field('session_date_time', 'datetime'),
format = lambda r: '%s at %s on %s' % (r.program_name, 
datetime.time(r.session_date_time), datetime.date(r.session_date_time))
   )

query_sessions = (
  (db.auth_user.id == db.auth_membership.user_id) &
  (db.auth_membership.group_id == db.auth_group.id) &
  (db.auth_group.role.like('coach'))
)

db.sessions.coach.requires = IS_IN_DB(db(query_sessions), db.auth_user.id, 
 '%(first_name)s %(last_name)s')
db.sessions.assistant.requires = IS_IN_DB(db(query_sessions), 
db.auth_user.id,  '%(first_name)s %(last_name)s')

db.define_table('programs_players', # lists players attached to various 
programs
Field('program_name', 'reference programs'),
Field('player', 'reference auth_user')
   )

query_programs_players = (
  (db.auth_user.id == db.auth_membership.user_id) &
  (db.auth_membership.group_id == db.auth_group.id) &
  (db.auth_group.role.like('player'))
)

db.programs_players.player.requires = IS_IN_DB(db(query_programs_players), 
db.auth_user.id,  '%(first_name)s %(last_name)s')

db.programs_players.player.represent = lambda id, row: 
(db.auth_user(id).first_name + ' ' + db.auth_user(id).last_name) if 
id!=None else 'N/A'

db.define_table('sessions_players', # record player attendance at a 
session, whether it is a practice or an evaluation
Field('session_name', 'reference sessions'),
Field('player', 'reference auth_user'),
Field('presence', 'string', default='present', 
requires=IS_IN_SET(['expected','present','absent'], zero=None))
   )

query_sessions_players = (
  (db.auth_user.id == db.auth_membership.user_id) &
  (db.auth_membership.group_id == db.auth_group.id) &
  (db.auth_group.role.like('player'))
)

db.sessions_players.player.requires = IS_IN_DB(db(query_sessions_players), 
db.auth_user.id,  '%(first_name)s %(last_name)s')

db.sessions_players.player.represent = lambda id, row: 
(db.auth_user(id).first_name + ' ' + db.auth_user(id).last_name) if 
id!=None else 'N/A'



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

[web2py] Dal cache key name

2015-03-20 Thread Rod Watkins
Hi all,

Would it be possible to alter the DAL code for caching to allow the cache 
key name to be passed as part of the call for selects? I ask because it 
would make it much easier to invalidate cache entries in a finer grained 
way,

Thanks
Rod

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


[web2py] Re: Best way to rearrange sqlgrid columns?

2015-03-20 Thread LoveWeb2py
Hi Massimo,

I did try using fields= [db.field.a, db.field.c, db.field.b]

Ahhh it's working now... (just tried again). I had to take out my links 
reference. It was referencing a field that wasn't in  my fields list and I 
kept getting an error. Thank you!

On Friday, March 20, 2015 at 11:44:15 AM UTC-4, Massimo Di Pierro wrote:
>
> You can pass a list of fields to the grid.
>
> On Friday, 20 March 2015 10:25:03 UTC-5, LoveWeb2py wrote:
>>
>> Is there an easier way to change the column order without re-arranging 
>> the model defined in db.py?
>>
>> Here is what I'd like to do:
>>
>> Col A, Col B, Col C
>>
>> How could I have
>>
>> Col C, Col A, Col B
>>
>> or whatever order I want. I have the same table I'd like to present in 
>> different ways.
>>
>> Thanks!
>>
>

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


[web2py] Re: last minute web2py hackaton

2015-03-20 Thread Massimo Di Pierro
More rules. I am not participating but everybody else is. 
If somebody else (including me) closes an issue before you, yours does not 
count.



On Friday, 20 March 2015 10:41:16 UTC-5, Massimo Di Pierro wrote:
>
> We want to release 2.10.1 next week. We will try closing as many issue as 
> possible in the next three days.
>
> You can close an issue by submitting a pull-request.
>
> The person who submits the largest number of accepted pull requests by 
> Monday 5am UTC wins $100 paid for by experts4solutions. (The requests have 
> to be submitted by the deadline but they will count even if accepted after. 
> In case of ties the prize is split.)
>
> Massimo
>
>
>
>
>
>

-- 
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: last minute web2py hackaton

2015-03-20 Thread Massimo Di Pierro
More rules. I am not participating but everybody else is. 
If somebody else (including me) closes an issue before you, yours does not 
count.

On Friday, 20 March 2015 10:41:16 UTC-5, Massimo Di Pierro wrote:
>
> We want to release 2.10.1 next week. We will try closing as many issue as 
> possible in the next three days.
>
> You can close an issue by submitting a pull-request.
>
> The person who submits the largest number of accepted pull requests by 
> Monday 5am UTC wins $100 paid for by experts4solutions. (The requests have 
> to be submitted by the deadline but they will count even if accepted after. 
> In case of ties the prize is split.)
>
> Massimo
>
>
>
>
>
>

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


[web2py] Re: Best way to rearrange sqlgrid columns?

2015-03-20 Thread Massimo Di Pierro
You can pass a list of fields to the grid.

On Friday, 20 March 2015 10:25:03 UTC-5, LoveWeb2py wrote:
>
> Is there an easier way to change the column order without re-arranging the 
> model defined in db.py?
>
> Here is what I'd like to do:
>
> Col A, Col B, Col C
>
> How could I have
>
> Col C, Col A, Col B
>
> or whatever order I want. I have the same table I'd like to present in 
> different ways.
>
> Thanks!
>

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


[web2py] Re: condition models with function => IMG(_src='default', 'download', r=r.image)

2015-03-20 Thread Massimo Di Pierro
What does it mean "not working". Do you get a traceback? What does it say?

On Friday, 20 March 2015 10:02:57 UTC-5, Ariya Owam-aram wrote:
>
> Dear all,
>
> I implement conditions models but it seem to broken function download for 
> display image from upload fields.
> let say:
>
> ##
> # in models/01_defind_table.py
> ##
> class Pd_product_sku(BaseModel):
> def __init__(self, db):
> self.db = db
> self.tablename  = "pd_product_sku"
> 
> self.fields = [
> Field('code',
>   length= '50',
>   label = T('SKU Code'),
>   notnull   = True,
>   requires = IS_NOT_IN_DB(db, 'pd_product_sku.code')),
> Field('image', 'upload',
>   label = T('Image'),
>   uploadfolder = 
> os.path.join(request.folder,'static/pd_product_sku'),
>   requires  = IS_EMPTY_OR(
> IS_IMAGE(maxsize = (1200, 1200),error_message = 'The 
> maximum image dimension allowed for upload is 1200 x 1200px!')) ),
> ]
>
> self.params = dict(
> migrate = True,
> #fake_migrate= True,
> singular= T('SKU'),
> plural  = T('SKU'),  
> format  = '%(code)s : %(name)s'
> )  
>
> ##
> # in models/default/test/01.py
> ##
> pd_product_sku= Pd_product_sku(db)
> pd_product_sku.define_table()
>
> ##
> # in controller/default.py
> ##
> def test():
> # pd_product_sku
> db.pd_product_sku.image.represent = lambda v, r: 
> IMG(_src=URL('default', 'download', args=v) )
> grid= SQLFORM.grid(db.pd_product_sku)
> return dict(grid=grid)
>
> ||
> ||
> ||
> v
>
> IMG(_src=URL('default', 'download', args=v) not working 
> but if I define pd_product_sku in the normal environment (model/db.py) is 
> work as narmal.
>
>
> Please advise, and thank you in advance
>
> Ariya
>
>

-- 
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] last minute web2py hackaton

2015-03-20 Thread Massimo Di Pierro
We want to release 2.10.1 next week. We will try closing as many issue as 
possible in the next three days.

You can close an issue by submitting a pull-request.

The person who submits the largest number of accepted pull requests by 
Monday 5am UTC wins $100 paid for by experts4solutions. (The requests have 
to be submitted by the deadline but they will count even if accepted after. 
In case of ties the prize is split.)

Massimo





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


[web2py] Best way to rearrange sqlgrid columns?

2015-03-20 Thread LoveWeb2py
Is there an easier way to change the column order without re-arranging the 
model defined in db.py?

Here is what I'd like to do:

Col A, Col B, Col C

How could I have

Col C, Col A, Col B

or whatever order I want. I have the same table I'd like to present in 
different ways.

Thanks!

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


[web2py] Erro 404 - Web2py this not working with Google App Engine (GAE)

2015-03-20 Thread Rafael Costa Braga
I'm having trouble using the web2py on google app server (gae). The error 
is giving when I insert the url localhost:8080 in browser is:

rafael@rafael-debian:~/rafael/google_appengine$ python dev_appserver.py 
../web2py/
INFO 2015-03-20 03:38:20,075 sdk_update_checker.py:229] Checking for 
updates to the SDK.
INFO 2015-03-20 03:38:20,520 sdk_update_checker.py:257] The SDK is up to 
date.
INFO 2015-03-20 03:38:21,109 api_server.py:172] Starting API server at: 
http://localhost:41836
INFO 2015-03-20 03:38:21,202 dispatcher.py:186] Starting module "default" 
running at: http://localhost:8080
INFO 2015-03-20 03:38:21,203 admin_server.py:118] Starting admin server at: 
http://localhost:8000
INFO 2015-03-20 03:38:32,968 module.py:737] default: "GET / HTTP/1.1" 404 -
INFO 2015-03-20 03:38:33,172 module.py:737] default: "GET /favicon.ico 
HTTP/1.1" 404 -


The problem is in app.yaml. I used based on the app.example.yaml file, I 
made the necessary changes, but still does not work

Below is the simplifed structure like this the directories web2py and 
google_appengine and file app.yaml:

web2py/├── anyserver.py├── applications│   ├── admin│   ├── core│   ├── 
examples│   └── welcome├── app.yaml├── handlers│   ├── cgihandler.py│   ├── 
fcgihandler.py│   ├── gaehandler.py│   ├── isapiwsgihandler.py│   ├── 
modpythonhandler.py│   ├── README│   ├── scgihandler.py│   ├── 
web2py_on_gevent.py│   └── wsgihandler.py├── web2py.py└── welcome.w2p│
google_appengine/├── dev_appserver.py


*app.yaml*

#  For Google App Engine deployment, copy this file to app.yaml#  and edit as 
required#  See 
http://code.google.com/appengine/docs/python/config/appconfig.html#  and 
http://web2py.com/book/default/chapter/11?search=app.yaml

application: core
version: 1
api_version: 1
# use these lines for Python 2.7# upload app with: appcfg.py update web2py 
(where 'web2py' is web2py's root directory)#
runtime: python27
threadsafe: false# true for WSGI & concurrent requests (Python 2.7 only)

default_expiration: "24h"   # for static files

handlers:
# Warning! Static mapping - below - isn't compatible with # the parametric 
router's language logic. # You cannot use them together.
- url: /(.+?)/static/_\d.\d.\d\/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
  expiration: "365d"
- url: /(.+?)/static/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
- url: /favicon.ico
  static_files: applications/core/static/favicon.ico
  upload: applications/core/static/favicon.ico
- url: /robots.txt
  static_files: applications/core/static/robots.txt
  upload: applications/welcome/static/robots.txt
- url: .*
  script: handlers/gaehandler.wsgiapp# WSGI (Python 2.7 only)
  secure: optional

admin_console:
  pages:
  - name: Appstats
url: /_ah/stats

skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 (applications/examples/.*)|
 ((examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/rocket\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$

builtins:- remote_api: on- appstats: on- admin_redirect: on- deferred: on


Version: Python 2.7.9; Web2py 2.9.12; GAE 1.9.18

Could someone help me run the web2py with google app engine. I've tried 
everything I read countless articles already in forums and groups, videos 
on youtube but nothing worked. Thank you for attention

-- 
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] several vars in page

2015-03-20 Thread Carlos Costa
Question 1:
The parenthesis are wrong. The _href attribute is inside I and not A
helper. In fact, a parenthesis was missing too.
{{if page:}}
{{request.vars.page = [page - 1] }}
{{=SPAN(A(I(T('Previous')), _href = URL(vars = request.vars ) ) ) }}
{{elif len(rows) > items_per_page:}}
{{request.vars.page = [page + 1] }}
{{=SPAN(A(T('Next'), _href = URL(vars = request.vars ) ) ) }}
{{pass}}

Question 2:
If you are getting the following error: non-keyword arg after keyword arg
That is because you must always write first the "unnamed" arguments and and
the "named" arguments after.

2015-03-19 20:18 GMT-03:00 黄祥 :

> hi,
>
> i have several vars that store : view (grid or list), sort (a_z, z_a,
> highest_price, lowest_price, newest), search_product, category_product
> (drop down list IS_IN_DB() ) and product_brand (drop down list IS_IN_DB() )
>
> search_product, category_product (drop down list IS_IN_DB() ) and
> product_brand (drop down list IS_IN_DB() ) is on the other file (sidebar)
>
> *question 1 :*
> *works well*
> {{if page:}}
> {{=SPAN(A(T('Previous'),
>   _href = URL(*vars = dict(request.vars, page = [page - 1]*) ) ) ) }}
> {{elif len(rows) > items_per_page:}}
> {{=SPAN(A(T('Next'),
>   _href = URL(*vars = dict(request.vars, page = [page + 1]*) ) ) ) }}
> {{pass}}
>
> *no errors occured but the result is not expected*
> {{if page:}}
> * {{request.vars.page = [page - 1] }}*
> {{=SPAN(A(I(T('Previous'),
>   _href = URL(*vars = request.vars* ) ) ) }}
> {{elif len(rows) > items_per_page:}}
> * {{request.vars.page = [page + 1] }}*
> {{=SPAN(A(T('Next'),
>   _href = URL(*vars = request.vars* ) ) ) }}
> {{pass}}
>
> why the result is not expected, when i have multiple vars in 1 page (the
> page vars value is not store in vars)?
>
> *question 2 :*
> *works well*
> {{if page:}}
> {{=SPAN(A(T('Previous'),
>   _href = URL(vars = dict(*request.vars, page = [page - 1]*) ) ) ) }}
> {{elif len(rows) > items_per_page:}}
> {{=SPAN(A(T('Next'),
>   _href = URL(vars = dict(*request.vars, page = [page + 1]*) ) ) ) }}
> {{pass}}
>
> *an error occured*
> {{if page:}}
> {{=SPAN(A(T('Previous'),
>   _href = URL(vars = dict(*page = [page - 1], request.vars*) ) ) ) }}
> {{elif len(rows) > items_per_page:}}
> {{=SPAN(A(T('Next'),
>   _href = URL(vars = dict(*page = [page + 1], request.vars*) ) ) ) }}
> {{pass}}
>
> my 2nd question is why if i assign the var page first it return an error?
>
> thanks and best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Carlos J. Costa
Cientista da Computação  | BS Computer Science
Esp. Gestão em Telecom   | PgC Telecom Mangement
<º))><

-- 
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] Web Editor

2015-03-20 Thread Kurt Stieger
Hi all,

Is there som documentation for the webeditor. 
I' m interested in how to markup TODO comments to be recognized, fullscreen 
mode and hooks.

This seems not to work on my site, with Windows and Firefox or Chrome.

Thanks,
Kurt

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


Re: [web2py] Re: Search in web2py book case sensitive

2015-03-20 Thread Carlos Costa
+1

2015-03-19 14:07 GMT-03:00 Massimo Di Pierro :

> done. Thanks.
>
> On Thursday, 19 March 2015 05:26:22 UTC-5, Kiran Subbaraman wrote:
>>
>> Yes, it is.
>> This line of code probably needs to be changed:
>> https://github.com/mdipierro/web2py-book/blob/master/
>> controllers/default.py#L152 to
>> k = data.lower().find(search.lower())
>>
>>
>>
>>
>> On Thursday, March 19, 2015 at 2:35:59 PM UTC+5:30, Kenneth wrote:
>>>
>>> Hello,
>>>
>>> is the search function in web2py Book supposed to be case sensitive?
>>>
>>> I went to the online book and typed sqlform in the search field.
>>>
>>> Was a little bit surprised when I got: No results for "sqlform"
>>> Searching for SQLFORM works.
>>>
>>>
>>> Kenneth
>>>
>>>  --
> 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.
>



-- 


Carlos J. Costa
Cientista da Computação  | BS Computer Science
Esp. Gestão em Telecom   | PgC Telecom Mangement
<º))><

-- 
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] web2py creating subfolders

2015-03-20 Thread Vikash Sharma
Hi
I would like to create subfolders for uploading documents as per name 
provided by user. Example

dict_doc_type = ["Java", "J2EE", "Python"]
db.define_table('document',
Field('document_type', type='string', label=T('Document 
Type'), default="M", requires=IS_IN_SET(dict_doc_type)),
Field('doc_filename', type='string', readable=False, 
writable=False),
Field('doc', type='upload', label=T('Upload File'), 
uploadseparate=True))

Now 'doc' field value should be same as what was selected in 'doc_type' 
fieled while submitting the form. That is when user fills online form, he 
will select a category and that value will be used as parent for storing 
uploaded file.

Thanks in advance


-- 
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] condition models with function => IMG(_src='default', 'download', r=r.image)

2015-03-20 Thread Ariya Owam-aram
Dear all,

I implement conditions models but it seem to broken function download for 
display image from upload fields.
let say:

##
# in models/01_defind_table.py
##
class Pd_product_sku(BaseModel):
def __init__(self, db):
self.db = db
self.tablename  = "pd_product_sku"

self.fields = [
Field('code',
  length= '50',
  label = T('SKU Code'),
  notnull   = True,
  requires = IS_NOT_IN_DB(db, 'pd_product_sku.code')),
Field('image', 'upload',
  label = T('Image'),
  uploadfolder = 
os.path.join(request.folder,'static/pd_product_sku'),
  requires  = IS_EMPTY_OR(
IS_IMAGE(maxsize = (1200, 1200),error_message = 'The 
maximum image dimension allowed for upload is 1200 x 1200px!')) ),
]

self.params = dict(
migrate = True,
#fake_migrate= True,
singular= T('SKU'),
plural  = T('SKU'),  
format  = '%(code)s : %(name)s'
)  

##
# in models/default/test/01.py
##
pd_product_sku= Pd_product_sku(db)
pd_product_sku.define_table()

##
# in controller/default.py
##
def test():
# pd_product_sku
db.pd_product_sku.image.represent = lambda v, r: 
IMG(_src=URL('default', 'download', args=v) )
grid= SQLFORM.grid(db.pd_product_sku)
return dict(grid=grid)

||
||
||
v

IMG(_src=URL('default', 'download', args=v) not working 
but if I define pd_product_sku in the normal environment (model/db.py) is 
work as narmal.


Please advise, and thank you in advance

Ariya

-- 
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] Web2py this not working with Google App Engine (GAE) - Error 404

2015-03-20 Thread Rafael Costa Braga
I'm having trouble using the web2py on google app server (gae). The error 
is giving when I insert the url localhost:8080 in browser is:

rafael@rafael-debian:~/rafael/google_appengine$ python dev_appserver.py 
../web2py/
INFO 2015-03-20 03:38:20,075 sdk_update_checker.py:229] Checking for 
updates to the SDK.
INFO 2015-03-20 03:38:20,520 sdk_update_checker.py:257] The SDK is up to 
date.
INFO 2015-03-20 03:38:21,109 api_server.py:172] Starting API server at: 
http://localhost:41836
INFO 2015-03-20 03:38:21,202 dispatcher.py:186] Starting module "default" 
running at: http://localhost:8080
INFO 2015-03-20 03:38:21,203 admin_server.py:118] Starting admin server at: 
http://localhost:8000
INFO 2015-03-20 03:38:32,968 module.py:737] default: "GET / HTTP/1.1" 404 -
INFO 2015-03-20 03:38:33,172 module.py:737] default: "GET /favicon.ico 
HTTP/1.1" 404 -


The problem is in app.yaml. I used based on the app.example.yaml file, I 
made the necessary changes, but still does not work

Below is the simplifed structure like this the directories web2py and 
google_appengine and file app.yaml:

web2py/├── anyserver.py├── applications│   ├── admin│   ├── core│   ├── 
examples│   └── welcome├── app.yaml├── handlers│   ├── cgihandler.py│   ├── 
fcgihandler.py│   ├── gaehandler.py│   ├── isapiwsgihandler.py│   ├── 
modpythonhandler.py│   ├── README│   ├── scgihandler.py│   ├── 
web2py_on_gevent.py│   └── wsgihandler.py├── web2py.py└── welcome.w2p│
google_appengine/├── dev_appserver.py



app.yaml

#  For Google App Engine deployment, copy this file to app.yaml#  and edit as 
required#  See 
http://code.google.com/appengine/docs/python/config/appconfig.html#  and 
http://web2py.com/book/default/chapter/11?search=app.yaml

application: core
version: 1
api_version: 1
# use these lines for Python 2.7# upload app with: appcfg.py update web2py 
(where 'web2py' is web2py's root directory)#
runtime: python27
threadsafe: false# true for WSGI & concurrent requests (Python 2.7 only)

default_expiration: "24h"   # for static files

handlers:
# Warning! Static mapping - below - isn't compatible with # the parametric 
router's language logic. # You cannot use them together.
- url: /(.+?)/static/_\d.\d.\d\/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
  expiration: "365d"
- url: /(.+?)/static/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
- url: /favicon.ico
  static_files: applications/core/static/favicon.ico
  upload: applications/core/static/favicon.ico
- url: /robots.txt
  static_files: applications/core/static/robots.txt
  upload: applications/welcome/static/robots.txt
- url: .*
  script: handlers/gaehandler.wsgiapp# WSGI (Python 2.7 only)
  secure: optional

admin_console:
  pages:
  - name: Appstats
url: /_ah/stats

skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 (applications/examples/.*)|
 ((examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/rocket\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$

builtins:- remote_api: on- appstats: on- admin_redirect: on- deferred: on


Version: Python 2.7.9; Web2py 2.9.12; GAE 1.9.18

Could someone help me run the web2py with google app engine. I've tried 
everything I read countless articles already in forums and groups, videos 
on youtube but nothing worked. Thank you for attention

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


Re: [web2py] Re: No module named objects / 2.9.12-stable+timestamp.2015.03.17.18.03.34 / Windows

2015-03-20 Thread Massimo Di Pierro
@Kiran,

Can you download the latest "for testers" version and confirm this is fixed 
for you?


On Friday, 20 March 2015 02:20:23 UTC-5, Niphlod wrote:
>
> it's the one that was already fixed 8 hours ago.
>
> On Friday, March 20, 2015 at 7:38:05 AM UTC+1, Massimo Di Pierro wrote:
>>
>> Can anybody else reproduce this issue?
>>
>> On Friday, 20 March 2015 00:04:12 UTC-5, Kiran Subbaraman wrote:
>>>
>>>  Windows 8.1 64 bit
>>> Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit 
>>> (Intel)] on win32
>>> Just the plain rocket server - have not installed / configured a web 
>>> server.
>>>
>>> 
>>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>>
>>> On Thu, 19-03-2015 10:34 PM, Massimo Di Pierro wrote:
>>>  
>>> which windows version? what Python version? are you behind Apache or 
>>> other web server?
>>>
>>> On Thursday, 19 March 2015 03:24:45 UTC-5, Kiran Subbaraman wrote: 

  Tried with the latest (for testers):
 I saw the same "no module named objects" error.

 Went back to admin, and selected the "clean" option. I don't see the 
 previous error.

 Now I see this issue:
 Version
 web2py™ Version 2.9.12-stable+timestamp.2015.03.19.06.51.11
 Python Python 2.7.9: 
 C:\Users\subbaraman\Downloads\web2py_win_002\web2py\web2py.exe (prefix: 
 D:\programs\open\python27)
 Traceback


 Traceback (most recent call last):
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\restricted.py", 
 line 226, in restricted
 exec ccode in environment
   File 
 "C:/Users/subbaraman/Downloads/web2py_win_002/web2py/applications/my_app/controllers/default.py",
  
 line 1107, in 
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\globals.py", 
 line 393, in 
 self._caller = lambda f: f()
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\tools.py", line 
 3455, in f
 return action(*a, **b)
   File 
 "C:/Users/subbaraman/Downloads/web2py_win_002/web2py/applications/my_app/controllers/default.py",
  
 line 304, in index
 orderby=_construct_orderby(), limitby=limitby, **cache_settings)
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\packages\dal\pydal\objects.py",
  
 line 2085, in select
 return adapter.select(self.query,fields,attributes)
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\packages\dal\pydal\adapters\base.py",
  
 line 1228, in select
 time_expire)
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\cache.py", line 
 428, in __call__
 self.storage[key] = (now, value)
   File 
 "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\cache.py", line 
 328, in __setitem__
 pickle.dump((time.time(), value), tmp, pickle.HIGHEST_PROTOCOL)
 PicklingError: Can't pickle : attribute lookup 


 Have attached a sample app that will help recreate this problem. The 
 backend is postgres. The password needs to be updated, before you test it.

 
 Kiran Subbaramanhttp://subbaraman.wordpress.com/about/

 On Thu, 19-03-2015 12:58 PM, Niphlod wrote:
  
 nope, can't replicate. Try downloading the latest.

 On Thursday, March 19, 2015 at 5:46:43 AM UTC+1, Kiran Subbaraman 
 wrote: 
>
>  Downloaded it from 
> http://www.web2py.com/examples/static/nightly/web2py_win.zip. This 
> contains the binary / exe. 
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Thu, 19-03-2015 1:13 AM, Niphlod wrote:
>  
> is it the source or the binary version ?
>
> On Wednesday, March 18, 2015 at 6:25:22 PM UTC+1, Kiran Subbaraman 
> wrote: 
>>
>> Bumping this thread: 
>> https://groups.google.com/d/msg/web2py/6lWIcIAYoHY/lRPDjXHl2_wJ
>> Does anyone else face this issue?
>>  
>  -- 
> 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+un...@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 t

[web2py] Re: request.function .load father file

2015-03-20 Thread JorgeH
Could you post the code for you are trying to achieve?


On Friday, March 20, 2015 at 8:18:34 AM UTC-5, Gael Princivalle wrote:
>
> Hello all.
>
> Is there a way to test inside a .load file if it have been loaded inside a 
> .html file?
> 'request.function' return always the .load file.
>
> Thanks, regards.
>

-- 
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: request.function .load father file

2015-03-20 Thread Leonel Câmara
Well when you use LOAD you can set args and vars for the loaded function. 
So... just pass it the caller :)

-- 
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: Remember me with custom or alternate login?

2015-03-20 Thread Lisandro
I'm having trouble to get this to work.
I've already implemented my own login through ajax, but I can't get to work 
the "remember me" part.

This is my code:

def _login():
email = request.post_vars.email
password = request.post_vars.password
remember = request.post_vars.remember
user = auth.login_bare(email, password)
if not user:
return response.json({'success':False})
else:
if remember:
session.auth.expiration = 3600 * 24 * 30 # one month
session.auth.remember = True
response.cookies[response.session_id_name]["expires"] = 
session.auth.expiration
return response.json({'success':True})

However, I login, close the browser, reopen it, and I'm asked to login 
again. What am I missing? 



El jueves, 6 de junio de 2013, 19:07:31 (UTC-3), Anthony escribió:
>
> Yes, sorry, there's one more thing you have to do -- you have to convert 
> the session cookie to a non-session cookie:
>
> response.cookies[response.session_id_name]["expires"] = session.auth.
> expiration
>
> That will happen the next time Auth is initialized (which would happen on 
> the next request), but it won't happen if you simply close the browser.
>
> Anthony
>
> On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote:
>>
>> Here's the relevant part of the code I'm using. I make an ajax call to 
>> the function below
>>
>> def ajax_login():
>> email = request.vars.email
>> password = request.vars.password
>> remember_me = request.vars.remember_me
>>
>> user = auth.login_bare(email, password)
>> if user:
>> if remember_me:
>> session.auth.expiration = auth.settings.long_expiration
>> session.auth.remember = True
>>
>>
>>
>>

-- 
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: Global search form example

2015-03-20 Thread Gael Princivalle
Hi Ron.

For the moment I've not done this function, I'll do it asap.
Thank you for this suggestion, but using response.title the search function 
will search only in title pages, right?

Il giorno venerdì 20 marzo 2015 01:44:00 UTC+1, Ron Chatterjee ha scritto:
>
> Were you able to find a way around for the global search option. I believe 
> one way you can do this is to create a form and call that form in menu.py 
> using response.title. 
>
> I am sure there are lot of other ways. Any thoughts?
>
> On Wednesday, March 11, 2015 at 4:43:29 AM UTC-4, Gael Princivalle wrote:
>>
>> Thanks Ron but I've don't understand your answer, and I've don't find 
>> anything about this question page 84 of the web2py_manual_5th.pdf book.
>>
>> Anyway I can imagine the solution is crawling all searchable fields in 
>> all tables, saving in the for loop all rows references (function/args), and 
>> displaying a link list.
>>  
>>
>> Il giorno lunedì 9 marzo 2015 19:08:32 UTC+1, Ron Chatterjee ha scritto:
>>>
>>> SQLFORM.build_query[(db.table.field)]
>>>
>>> Passing a list ([]) into that will give you a text in that field. and 
>>> then you can use a form input to do the display like the book on page 84 on 
>>> the book. Damn I am getting good at this!
>>>
>>> On Monday, March 9, 2015 at 1:44:23 PM UTC-4, Gael Princivalle wrote:

 Sure.

 The search field at the top:
 http://www.chainreactioncycles.com/us/en


 Il giorno lunedì 9 marzo 2015 17:47:09 UTC+1, Ron Chatterjee ha scritto:
>
> Can you give an example of "global Search". Any reference site?
>
> On Monday, March 9, 2015 at 12:18:54 PM UTC-4, Gael Princivalle wrote:
>>
>> Hello all.
>>
>> I would like to add a global search form in a website, the classical 
>> one with one field and a search button.
>> I've got some idea's about how doing it, but I would like to know if 
>> there's an example on line, or if someone have some suggestions.
>>
>> Thanks.
>>
>

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


[web2py] request.function .load father file

2015-03-20 Thread Gael Princivalle
Hello all.

Is there a way to test inside a .load file if it have been loaded inside a 
.html file?
'request.function' return always the .load file.

Thanks, regards.

-- 
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: foreign key constraint failed

2015-03-20 Thread Leonel Câmara
I'm guessing there's no user with the id 6

-- 
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] foreign key constraint failed

2015-03-20 Thread António Ramos
hello i have this table

db.define_table('pedidos',
Field('amostra',db.amostras),
Field('destino'),
Field('estante','integer'),
Field('x','integer'),
Field('y','integer'),
Field('estante1',compute =lambda
r:"_E_"+str(r['estante'])+str(r['x'])+str(r['y'])),
Field('created','datetime',default=request.now),
Field('sit',default='danger'),
Field('creator',db.auth_user,default=auth.user_id),
)




when i do this

db.pedidos.update_or_insert((db.pedidos.amostra==amostra.n) &
(db.pedidos.destino=='end'),amostra=amostra.n,destino='end',estante=amostra.estante,x=amostra.x,y=amostra.y,creator=6,sit='danger')

i get the error




 foreign key constraint
failedVersãoweb2py™Version
2.9.5-stable+timestamp.2014.03.16.02.35.39PythonPython 2.7.9:
/usr/local/bin/python (prefix: /usr/local)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.

Traceback (most recent call last):
  File "/home/ramstein74/webapps/2py/web2py/gluon/restricted.py", line
220, in restricted
exec ccode in environment
  File 
"/home/ramstein74/webapps/2py/web2py/applications/lab/controllers/default.py"
,
line 510, in 
  File "/home/ramstein74/webapps/2py/web2py/gluon/globals.py", line
385, in 
self._caller = lambda f: f()
  File 
"/home/ramstein74/webapps/2py/web2py/applications/lab/controllers/default.py"
,
line 62, in deleteAmostrasAntigas
db.pedidos.update_or_insert((db.pedidos.amostra==amostra.n) &
(db.pedidos.destino=='end'),amostra=amostra.n,destino='end',estante=amostra.estante,x=amostra.x,y=amostra.y,creator=6,sit='danger')
  File "/home/ramstein74/webapps/2py/web2py/gluon/dal.py", line 9182,
in update_or_insert
newid = self.insert(**values)
  File "/home/ramstein74/webapps/2py/web2py/gluon/dal.py", line 9114, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File "/home/ramstein74/webapps/2py/web2py/gluon/dal.py", line 1360, in insert
raise e
IntegrityError: foreign key constraint failed




Help please


:)

-- 
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: several vars in page

2015-03-20 Thread Leonel Câmara
Why are you putting the page number in a list? If you do [1+1] in python 
you will get [2] which is a list with a 2 inside.

What error are you getting? Can I see some controller code? It seems you 
have a request.vars.page and also a 'page' returned by the controller.

Would it not be simpler to do this:

{{page = request.vars.pop('page', 0)}}
{{if page > 0:}}
{{=SPAN(A(T('Previous'), _href=URL(vars=dict(page=page-1, 
**request.vars}}
{{pass}}
{{if len(rows) == items_per_page:}}
{{=SPAN(A(T('Next'), _href=URL(vars=dict(page=page+1, 
**request.vars}}
{{pass}}


-- 
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 with IS_IN_SET(..., multiple=True) not SELECTED in FORM

2015-03-20 Thread Robin Manoli
Hi!
Using an SQLFORM with a Field that has IS_IN_SET(..., multiple=True), works 
for saving the values in the database. When I try to load the Field 
however, using SQLFORM(..., record=myRecord), I cannot see the saved values 
in the form. No OPTIONs are SELECTED.

Is there any way to SELECT them?

- Robin

-- 
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: iframes not working

2015-03-20 Thread Leonel Câmara
Probably what you're trying to put on the iframe doesn't have a valid 
certificate or it's redirecting you.

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


Re: [web2py] Re: No module named objects / 2.9.12-stable+timestamp.2015.03.17.18.03.34 / Windows

2015-03-20 Thread Niphlod
it's the one that was already fixed 8 hours ago.

On Friday, March 20, 2015 at 7:38:05 AM UTC+1, Massimo Di Pierro wrote:
>
> Can anybody else reproduce this issue?
>
> On Friday, 20 March 2015 00:04:12 UTC-5, Kiran Subbaraman wrote:
>>
>>  Windows 8.1 64 bit
>> Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] 
>> on win32
>> Just the plain rocket server - have not installed / configured a web 
>> server.
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On Thu, 19-03-2015 10:34 PM, Massimo Di Pierro wrote:
>>  
>> which windows version? what Python version? are you behind Apache or 
>> other web server?
>>
>> On Thursday, 19 March 2015 03:24:45 UTC-5, Kiran Subbaraman wrote: 
>>>
>>>  Tried with the latest (for testers):
>>> I saw the same "no module named objects" error.
>>>
>>> Went back to admin, and selected the "clean" option. I don't see the 
>>> previous error.
>>>
>>> Now I see this issue:
>>> Version
>>> web2py™ Version 2.9.12-stable+timestamp.2015.03.19.06.51.11
>>> Python Python 2.7.9: 
>>> C:\Users\subbaraman\Downloads\web2py_win_002\web2py\web2py.exe (prefix: 
>>> D:\programs\open\python27)
>>> Traceback
>>>
>>>
>>> Traceback (most recent call last):
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\restricted.py", 
>>> line 226, in restricted
>>> exec ccode in environment
>>>   File 
>>> "C:/Users/subbaraman/Downloads/web2py_win_002/web2py/applications/my_app/controllers/default.py",
>>>  
>>> line 1107, in 
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\globals.py", 
>>> line 393, in 
>>> self._caller = lambda f: f()
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\tools.py", line 
>>> 3455, in f
>>> return action(*a, **b)
>>>   File 
>>> "C:/Users/subbaraman/Downloads/web2py_win_002/web2py/applications/my_app/controllers/default.py",
>>>  
>>> line 304, in index
>>> orderby=_construct_orderby(), limitby=limitby, **cache_settings)
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\packages\dal\pydal\objects.py",
>>>  
>>> line 2085, in select
>>> return adapter.select(self.query,fields,attributes)
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\packages\dal\pydal\adapters\base.py",
>>>  
>>> line 1228, in select
>>> time_expire)
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\cache.py", line 
>>> 428, in __call__
>>> self.storage[key] = (now, value)
>>>   File 
>>> "C:\Users\subbaraman\Downloads\web2py_win_002\web2py\gluon\cache.py", line 
>>> 328, in __setitem__
>>> pickle.dump((time.time(), value), tmp, pickle.HIGHEST_PROTOCOL)
>>> PicklingError: Can't pickle : attribute lookup 
>>>
>>>
>>> Have attached a sample app that will help recreate this problem. The 
>>> backend is postgres. The password needs to be updated, before you test it.
>>>
>>> 
>>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>>
>>> On Thu, 19-03-2015 12:58 PM, Niphlod wrote:
>>>  
>>> nope, can't replicate. Try downloading the latest.
>>>
>>> On Thursday, March 19, 2015 at 5:46:43 AM UTC+1, Kiran Subbaraman wrote: 

  Downloaded it from 
 http://www.web2py.com/examples/static/nightly/web2py_win.zip. This 
 contains the binary / exe. 

 
 Kiran Subbaramanhttp://subbaraman.wordpress.com/about/

 On Thu, 19-03-2015 1:13 AM, Niphlod wrote:
  
 is it the source or the binary version ?

 On Wednesday, March 18, 2015 at 6:25:22 PM UTC+1, Kiran Subbaraman 
 wrote: 
>
> Bumping this thread: 
> https://groups.google.com/d/msg/web2py/6lWIcIAYoHY/lRPDjXHl2_wJ
> Does anyone else face this issue?
>  
  -- 
 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+un...@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+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>   -- 
>> Resources:
>> - http://web2py.com
>> - ht