Re: [web2py] is it possible to do something like SELECT column1, column2 is null FROM table.. in DAL?

2023-06-21 Thread Massimiliano
PyDal doen't implements *is_null,* but you can try something like that

t = db.yourtable
exp = "column2 is null"
print(db(t).select(t.column1, exp))


Il giorno mer 21 giu 2023 alle ore 19:47 Dragan Matic <
perakojotgen...@gmail.com> ha scritto:

> Postgresql allows this syntax:
>
> SELECT column1, column2 is null FROM table WHERE...
>
> Which returns the value from column one and a true/false for column2 like
> this:
>
> column1  column2
> value1  true
> value2  false
>
> To summarize, I just want for database to tell me whether column2 is null
> or not, I do not want to read the whole column2 and check it in program as
> it may contain a lot of text and will slow down execution. Can I translate
> this select to DAL?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b5d1573f-a5dc-4aad-8394-c2de75640cffn%40googlegroups.com
> 
> .
>


-- 
Massimiliano

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CANPTPx%2BA3WK%2B7bHX-nz7o6jbW7cmKjFcz93nc%3DdRXoNCr%2BPuAQ%40mail.gmail.com.


[web2py] is it possible to do something like SELECT column1, column2 is null FROM table.. in DAL?

2023-06-21 Thread Dragan Matic
Postgresql allows this syntax:

SELECT column1, column2 is null FROM table WHERE...

Which returns the value from column one and a true/false for column2 like 
this:

column1  column2
value1  true
value2  false

To summarize, I just want for database to tell me whether column2 is null 
or not, I do not want to read the whole column2 and check it in program as 
it may contain a lot of text and will slow down execution. Can I translate 
this select to DAL?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b5d1573f-a5dc-4aad-8394-c2de75640cffn%40googlegroups.com.


[web2py] Is it possible to change the boolean field widget from checkbox to option with yes and no?

2023-02-26 Thread Jeff Plata
Is it possible to change the boolean field widget from checkbox to option 
with yes and no? How?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b234cc3f-cbda-4db7-8417-ad92bc5019b4n%40googlegroups.com.


[web2py] Is it possible to write to session variables from Web2py modules?

2021-01-20 Thread at
Is it possible to write to session variables from Web2py modules? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9f5b9c8c-90db-45c0-b34e-2935cb3599d5n%40googlegroups.com.


[web2py] Is it possible to load older web2py binaries for Mac?

2019-12-18 Thread Jarrod Wilcox
When I updated Mac OSX to Catalina and updated web2py version to 2.18.5 my 
application broke badly.  As a temporary fix, is it possible to download 
older binaries such as 2.16?
Jarrod Wilcox

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bb6b8021-a7fd-4e3a-8aa2-30c4a0c71749%40googlegroups.com.


[web2py] Is it possible to change the auto-generated key used to cache an specific URL?

2019-10-18 Thread Lisandro
When using @cache.action in controller functions, the key used for storing 
the content is auto-generated based on the request URL. To be more 
specific, the key is generated based in *current.request.env.path_info* and 
*current.response.view:*
https://github.com/web2py/web2py/blob/1ce316609a7a70c42dbd586c4a264193608880ba/gluon/cache.py#L614

However, I'm seeing this issue.
Let's say we have a website that has articles splitted into several 
categories. 
We also have a controller function that exposes the articles given a 
category ID passed as first argument in the URL:

@cache.action(cache_model=cache.redis, session=False, vars=False, public=
True)
def category():
cat = db.categories(request.args(0))
articles = cat.articles.select()
return response.render(dict(cat=cat, articles=articles))


This works as expected, however I've noticed that a different key is 
generated for this two URLs:
/default/category/10
/default/category/10/

Notice one of the URLs has a trailing slash. 
I'm using Redis for caching, and I've checked the stored keys and they are 
different. 
*The issue here is that both URLs produce the exact same content, but the 
content is cached twice with different keys.*


In my case, the problem is even worst, because I add a slug to the URL with 
the name of the category, like this:
/default/category/10/technology

In this case, the slug is added just to make the URL prettier, so it 
doesn't really matter what is provided in the second argument. All these 
URLs produce the exact same content:
/default/category/10
/default/category/10/
/default/category/10/technology
/default/category/10/anything-at-all

In a public website, a bot could send all types of random requests, thus 
provoking the server to use a lot of RAM for caching several copies of the 
same content.

So I'm wondering, wouldn't be nice to be able to specify the key? Or at 
least be able to say which of the args should be consider to create the 
key? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/821c6951-f6c2-422a-a0bd-02f149c2ab61%40googlegroups.com.


[web2py] is it possible to make social site like facebook/linkedin by web2py ?

2019-06-26 Thread imran tube
which  framework best for me django or web2py?
web2py all demo site not work or old or unfinished...

why you dont update or make tutorial like django?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/703e2b8a-71be-4e49-8c40-863f2d7601c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Is it possible to write a virtual method field that modifies the row?

2019-04-26 Thread Lisandro
I've been working with Virtual Fields for a while, but now I'm wondering, 
how could I write a Virtual Field method that modifies the row itself?

I mean, I would like to do something similar that what the .update_record() 
method does. When you call row.update_record(), the row object is updated 
with the new values. 

I've tried returning the row object in the method definition function but 
it doesn't work.

I'm wondering, is it even possible to implement something like that? Any 
comment or suggestion will be much appreciated.

Thanks!
Warm regards,
Lisandro.

-- 
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 it possible to update a Rows object with another Rows object?

2019-04-16 Thread João Matos
Is it possible to update a Rows object with another Rows object?

I would like to do something similar to this (except that update does not 
exist in Rows)

rows = db(db.wo.id == int(request.args[0])).select()
if len(request.args) > 1:
for id_ in request.args[1:]:
rows.update(db(db.wo.id == int(id_)).select()

-- 
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 it possible to send all args & vars from a view/controller to another using POST instead of GET?

2019-04-12 Thread João Matos
Is it possible to send all args and vars from a view/controller to another 
view/controller using POST instead of GET?

-- 
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 it possible to show the results from a SELECT (made with SQLite using db.executesql) in a grid?

2019-04-01 Thread Val K
Create view in sqlite "CREATE VIEW your_tbl_name AS SELECT ..." using 
executesql and define corresponding  web2py table with migrate=False, 
fake_migrate=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] Is it possible to show the results from a SELECT (made with SQLite using db.executesql) in a grid?

2019-04-01 Thread João Matos
Hello,

Is it possible to show the results from a SELECT (made with SQLite using 
db.executesql) in a grid?
I have this 

result = db.executesql(
"SELECT auth_user.id, auth_user.username, "
"auth_user.canceled_on, "
"auth_user.canceled_by, "
"SUM(auth_group.role = 'Operador') operador, "
"SUM(auth_group.role = 'Verificador') verificador, "
"SUM(auth_group.role = 'Supervisor') supervisor "
"FROM auth_user "
"LEFT JOIN auth_membership ON auth_user.id = 
auth_membership.user_id "
"LEFT JOIN auth_group ON auth_group.id = 
auth_membership.group_id "
"GROUP BY username ORDER BY username"
)

that returns a list of tuples, and would like to show it using the grid.

Is it possible?

Thanks,

JM

-- 
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 it possible to disable grid sorting for some columns only?

2019-03-29 Thread João Matos
Is it possible to disable grid sorting for some columns only?

-- 
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 it possible to pass a grid's row modified_on field to and auto created edit form?

2019-03-21 Thread João Matos
Hello,

Is it possible to pass a record modified_on field to and auto created edit 
form from a grid?
Can I use editargs to do that? Something like editargs={'modified_on': 
row.modified_on}?

I need to check if the record changed when the user tries to save the 
edited record in the auto created edit form.

Thanks,

JM

-- 
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 it possible to run a Python script when starting web2py, without the shell option?

2019-03-21 Thread João Matos
Hello,

Is it possible to run a Python script when starting web2py, without the 
shell option?
What the script does can't be in the models or controllers. I need it to 
only run once per web2py start.

Thanks,

JM

-- 
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 it possible to log all errors to a log file using Python's logging?

2019-03-17 Thread João Matos
Hello,

Is it possible to log all errors (the same ones that go to the app\errors 
dir) to a log file using Python's logging?


Thanks,

JM

-- 
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 it possible to make a form field depend on another form field without submiting the form?

2019-03-14 Thread João Matos
Hello,

Is it possible to make a form field depend on another form field without 
submiting the form?

Thanks,

JM

-- 
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 it possible to have dummy columns in a grid without seeing them in the search field selection?

2019-03-14 Thread João Matos
Hello,

Is it possible to have dummy columns in a grid without seeing them in the 
search field selection?

Something like this (see the fields and headers arguments):

grid = SQLFORM.grid(
(db.wo.pies_verified == False) & (db.wo.is_active == True),
_class='web2py_grid_list_tags_to_issue',
create=False, csv=False, deletable=False, details=False, 
editable=False,
fields=[db.wo.product_name,
  db.wo.sn,
  db.wo.opts_names,
  dummy1,
  dummy2,
  dummy3,
  dummy4],
headers={'dummy1': ' ' * 10 + T('Chamber') + ' ' * 10,
 'dummy2': ' ' * 10 + T('Chamber date') + ' ' * 10,
 'dummy3': ' ' * 10 + T('VG') + ' ' * 10,
 'dummy4': ' ' * 10 + T('VG date') + ' ' * 10,
},
maxtextlengths={'wo.opts_names': GRID_COL_LEN_FOR_TEXT},
orderby=db.wo.product_name,
paginate=0,
# represent_none='',  # Grid and view form only.
)

The objective is to have something like the attached image.

I have a kludge in place using some unwanted fields, but that has a problem 
when the user selects the search. It shows the fields I'm using for the 
dummy columns. If I hide them (readable=False) they disappear from the grid.

What I want to know is if there is another solution, or if I can hide the 
fields from the search but still see them in the grid.

Thanks,

[image: Example.png]
JM

-- 
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 it possible to sort the grid search fields list?

2019-03-12 Thread João Matos
Hello,

Is it possible to sort the grid search fields list?

And limit the fields list to the only ones shown in the grid itself?

Thanks,

JM

-- 
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] Is it possible to translate data in SQLFORM.grid?

2018-06-18 Thread Anthony
On Monday, June 18, 2018 at 7:50:23 AM UTC-4, Bruno Duarte Ramos wrote:
>
> Hi Anthony, actually I just want to translate the form on my view, like my 
> view was {{=T(form)}}.
>

Yes, but what exactly do you want translated in the form? Do you want the 
actual data values translated? If so, that doesn't quite make sense, 
because then the translated values would end up getting submitted and saved 
to the database.

Please described the exact user workflow and experience you are trying to 
achieve.

Anthony

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


Re: [web2py] Is it possible to translate data in SQLFORM.grid?

2018-06-18 Thread 黄祥
perhaps you can achieve it using label=T()
e.g.
table.field.label = T('Field')

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.


Re: [web2py] Is it possible to translate data in SQLFORM.grid?

2018-06-18 Thread Bruno Duarte Ramos
Hi Anthony, actually I just want to translate the form on my view, like my
view was {{=T(form)}}.

2018-06-15 10:09 GMT-03:00 Anthony :

> On Thursday, June 14, 2018 at 10:37:55 AM UTC-4, Bruno Duarte Ramos wrote:
>>
>> Hello,
>>
>> Is is possible translate a data in a SQLFORM?
>>
>> Where my controller is:
>>
>> form=SQLFORM(db.cake)
>>
>> And my view:
>>
>> {{=form}}
>>
>
> Are you saying you want the stored values of an existing record to be
> translated before inserting them in an update form? If you did that, when
> the form is submitted, the translated values would be stored rather than
> the original ones. What exactly are you trying to achieve?
>
> Anthony
>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] Is it possible to translate data in SQLFORM.grid?

2018-06-15 Thread Anthony
On Thursday, June 14, 2018 at 10:37:55 AM UTC-4, Bruno Duarte Ramos wrote:
>
> Hello,
>
> Is is possible translate a data in a SQLFORM?
>
> Where my controller is:
>
> form=SQLFORM(db.cake)
>
> And my view:
>
> {{=form}}
>

Are you saying you want the stored values of an existing record to be 
translated before inserting them in an update form? If you did that, when 
the form is submitted, the translated values would be stored rather than 
the original ones. What exactly are you trying to achieve?

Anthony

>

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


Re: [web2py] Is it possible to translate data in SQLFORM.grid?

2018-06-14 Thread Bruno Duarte Ramos
Hello,

Is is possible translate a data in a SQLFORM?

Where my controller is:

form=SQLFORM(db.cake)

And my view:

{{=form}}

thanks.

Em quinta-feira, 30 de julho de 2015 04:38:01 UTC-3, Massimiliano escreveu:
>
> Have you tried?
>
> db.cake.fruit.represent = lambda v, r: T(db.fruits[v].name)
> grid=SQLFORM.grid(db.cake)
>
>
> On Thu, Jul 30, 2015 at 8:55 AM, Gael Princivalle  > wrote:
>
>> Hello all.
>>
>> Is it possible to translate data in SQLFORM.grid?
>>
>> MODEL:
>> db.define_table('fruits',
>> Field('name', type='string'),
>> format='%(name)s')
>>
>> db.define_table('cake',
>> Field('name', type='string'),
>> Field('fruit', 'reference fruits', requires = IS_IN_DB(db
>> , db.fruits.id, '%(name)s'), represent=lambda id, r: db.fruits[id].name))
>>
>> CONTROLLER:
>> grid=SQLFORM.grid(db.cake)
>>
>> VIEW:
>> {{=grid}}
>>
>> In the fruits table, names are in english, for example "Apple".
>>
>> Is it possible to set for this field in the grid automatic traductions 
>> like T()?
>>
>> In this case for example I would like to have in an Italian page "Mela" 
>> instead of "Apple".
>>
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Massimiliano
>

-- 
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 it possible to trigger some action on error?

2018-06-03 Thread Ur. Kr.
Is it possible to trigger some action when an error occurs? When an error 
file is added to the errors folder. 

-- 
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: it's possible to use Autocomplete widget in SQLFORM.grid ?

2018-05-25 Thread Sandeep Patel
Sorry i didn't mention in my previous post ,

this is also be in controller.py
def selector():
if not request.vars.keywords:
return ''
pattern = request.vars.keywords + '%'
selected = list(set([row.customer_name for row in
db((db.inward_entries.customer_name.like(pattern,case_sensitive=False))(db.inward_entries.created_by==
auth.user.id)).select(limitby=(0, 10))]))
return ''.join([DIV(k,
 _onclick="jQuery('#w2p_keywords').val('%s')" % k,
 _onmouseover="this.style.backgroundColor='yellow'",
 _onmouseout="this.style.backgroundColor='white'"
 ).xml() for k in selected])

Thanks
Sandeep

On Fri, May 25, 2018 at 11:21 AM, Sandeep Patel  wrote:

>
> @isi_jca
> I have read some old threads, it seems to me that the web2py inbuild
> widget works with FORMS and *not* with the grid.
> But that's doesn't mean we can not do that. I have done so with the help
> of jQury.
>
> See my sample Code
>
> # Controller.py
> def myfuc():
> grid = SQLFROM.grid(.)
> grid.insert(1,DIV(_style="position: absolute;background-color:
> #ff;border: 1px solid #1364a5",_id="suggestions",_
> class="suggestions"))
> return  locals()
> # veiw/myfuc.html
> {{ 'include layout.html'}}
> {{=grid}}
> 
> jQuery( document ).ready(function( $ ){
> jQuery("#w2p_keywords").keyup(function(){
> ajax('{{=URL('default', 'selector')}}', ['keywords'], 'suggestions');
> jQuery('#suggestions').click(function(){jQuery('#suggestions').hide()
> });
> });
> });
> 
>
> Now, this script worked for me. Just want to update you and others.
> Thanks for your advice. Greatly  appreciated
>
>
> On Fri, May 25, 2018 at 2:19 AM, isi_jca 
> wrote:
>
>> Sandeep:
>>
>> Look at this link: http://web2py.com/books/defaul
>> t/chapter/29/07/forms-and-validators?search=autocomplete
>> #Autocomplete-widget
>>
>> Regards
>>
>> El lunes, 21 de mayo de 2018, 9:37:40 (UTC-3), Sandeep Patel escribió:
>>>
>>> Hello,
>>> Can anyone, let me know how to work Autocomplete widget with
>>> SQLFROM.grid in the search filed. I have used Autocomplete widget in
>>> SQLFROM that's work fine but in the grid, nothing in happen.
>>>
>>>
>>> Please give me some direction how to do that.
>>>
>>>
>>> Thank's
>>> Sandeep
>>>
>>> --
>> 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: it's possible to use Autocomplete widget in SQLFORM.grid ?

2018-05-24 Thread Sandeep Patel
@isi_jca
I have read some old threads, it seems to me that the web2py inbuild widget
works with FORMS and *not* with the grid.
But that's doesn't mean we can not do that. I have done so with the help of
jQury.

See my sample Code

# Controller.py
def myfuc():
grid = SQLFROM.grid(.)
grid.insert(1,DIV(_style="position: absolute;background-color:
#ff;border: 1px solid #1364a5",_id="suggestions",_class="suggestions"))
return  locals()
# veiw/myfuc.html
{{ 'include layout.html'}}
{{=grid}}

jQuery( document ).ready(function( $ ){
jQuery("#w2p_keywords").keyup(function(){
ajax('{{=URL('default', 'selector')}}', ['keywords'], 'suggestions');
jQuery('#suggestions').click(function(){jQuery('#suggestions').hide()
});
});
});


Now, this script worked for me. Just want to update you and others.
Thanks for your advice. Greatly  appreciated


On Fri, May 25, 2018 at 2:19 AM, isi_jca 
wrote:

> Sandeep:
>
> Look at this link: http://web2py.com/books/default/chapter/29/07/forms-
> and-validators?search=autocomplete#Autocomplete-widget
>
> Regards
>
> El lunes, 21 de mayo de 2018, 9:37:40 (UTC-3), Sandeep Patel escribió:
>>
>> Hello,
>> Can anyone, let me know how to work Autocomplete widget with SQLFROM.grid
>> in the search filed. I have used Autocomplete widget in SQLFROM that's work
>> fine but in the grid, nothing in happen.
>>
>>
>> Please give me some direction how to do that.
>>
>>
>> Thank's
>> Sandeep
>>
>> --
> 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: it's possible to use Autocomplete widget in SQLFORM.grid ?

2018-05-24 Thread isi_jca
Sandeep:

Look at this link: 
http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=autocomplete#Autocomplete-widget

Regards

El lunes, 21 de mayo de 2018, 9:37:40 (UTC-3), Sandeep Patel escribió:
>
> Hello,
> Can anyone, let me know how to work Autocomplete widget with SQLFROM.grid 
> in the search filed. I have used Autocomplete widget in SQLFROM that's work 
> fine but in the grid, nothing in happen.
>
>
> Please give me some direction how to do that.
>
>
> Thank's
> Sandeep
>
>

-- 
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] Is it possible to translate data in SQLFORM.grid?

2017-11-14 Thread Yebach
hello

I have a similar problem except it goes for only one table - no parent - 
child relationship

db.define_table('config',
Field('co_code', type = 'string', length = 256 ,label = 
T('Code')),
Field('co_organization','reference organizations' ,label = 
T('Organization')),
Field('co_value', type = 'string', length = 256 ,label = 
T('Value')),
Field('co_area', type = 'string', length = 256 ,label = 
T('Area')),
Field('co_note',type = 'text' ,label = T('Note')),
Field('co_access_level',type = 'integer'),
migrate = settings.migrate,
fake_migrate=settings.fake_migrate,
)


I would like to translate values from co_note. 

Different variations of your suggested answer do not work 
db.config.represent = lambda v, r: T(db.config[v])

db.config.represent = lambda v, r: T(db.config[v].co_note)


Any suggestions? I do have translations already in my language.py file

On Thursday, July 30, 2015 at 9:38:01 AM UTC+2, Massimiliano wrote:
>
> Have you tried?
>
> db.cake.fruit.represent = lambda v, r: T(db.fruits[v].name)
> grid=SQLFORM.grid(db.cake)
>
>
> On Thu, Jul 30, 2015 at 8:55 AM, Gael Princivalle  > wrote:
>
>> Hello all.
>>
>> Is it possible to translate data in SQLFORM.grid?
>>
>> MODEL:
>> db.define_table('fruits',
>> Field('name', type='string'),
>> format='%(name)s')
>>
>> db.define_table('cake',
>> Field('name', type='string'),
>> Field('fruit', 'reference fruits', requires = IS_IN_DB(db
>> , db.fruits.id, '%(name)s'), represent=lambda id, r: db.fruits[id].name))
>>
>> CONTROLLER:
>> grid=SQLFORM.grid(db.cake)
>>
>> VIEW:
>> {{=grid}}
>>
>> In the fruits table, names are in english, for example "Apple".
>>
>> Is it possible to set for this field in the grid automatic traductions 
>> like T()?
>>
>> In this case for example I would like to have in an Italian page "Mela" 
>> instead of "Apple".
>>
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Massimiliano
>

-- 
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 it possible to set Cache-Control: no-cache using @cache.action decorator?

2017-07-21 Thread Lisandro
Maybe my question is wrong because of some background that I'm not seeing.
Due to the structure of my app, I use @cache.action like this in all my 
controller functions:

@cache.action(cache_model=CACHE.model, time_expire=CACHE.time_expire, 
session=CACHE.session, vars=CACHE.vars, public=CACHE.public)
def index():
# code here

In my model, I define the CACHE object with the proper attributes, 
depending on several situations (logged in or not, certain permissions, 
specific scenarios). The thing is that, *in some cases I need to set the 
response headers as if I hadn't use @cache.action*. I've tried to set 
cache_model=None and time_expire=None, but it throws the following error:

Traceback (most recent call last):
  File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/gonguinguen/medios/applications/mazar/controllers/default.py", 
line 463, in 
  File "/home/gonguinguen/medios/gluon/globals.py", line 417, in 
self._caller = lambda f: f()
  File "/home/gonguinguen/medios/gluon/cache.py", line 669, in wrapped_f
'Expires': expires,
UnboundLocalError: local variable 'expires' referenced before assignment



I mean, if I dont use @cache.action, then Cache-Control header has the 
following value:
no-store, no-cache, must-revalidate, post-check=0, pre-check=0

But I can't generate that same response header using @cache.action.
Wouldn't be nice if we could pass time_expire=0 and cache_model=None to set 
those headers?

In anycase, how can I solve it? Would I need a custom decorator? Would it 
be possible to instantiate and rewrite the default cache.action behaviour?

Thanks in advance!
Regards,
Lisandro

-- 
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 it possible to set target of callback method to a div of view of another function?

2017-06-15 Thread Sibasish_247
I have a button in a function A() and on clicking it I need to send a value 
to function B() which will process it and send the desired output to view 
of function C(). Using callback I am able to send the value to function B() 
but it only gets displayed in view of function B() if I set a target div. 
Can this target div be set to view of function C() or is there any other 
way?

I am new to web2py. Please help 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] Is it possible to share cache between two differente web2py applications?

2017-01-23 Thread Lisandro
I'm using RedisCache, and I've seen that web2py adds a prefix to all the 
keys I store in the cache.
For example, if I have an application called "master" and I do this:

config = cache.redis('config', lambda: initialize_config(), time_expire=
999)

... then the actual key used to store the data is "w2p:master:config"

But, what about if I have two applications that need to share the config?
How can I tell web2py to use the same cache prefix for two specific 
applications?

-- 
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 it possible to run doctests for scheduler tasks?

2016-10-31 Thread Bernardo Leon
Hi, I have seen in the book that running web2py with the -T flag I can run 
doctests for my controllers but I want to run doctests for my scheduler 
tasks. Is it possible? How?

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


[web2py] Is it possible for Web2Py SOAP-Services to give feedback during lenghty operations?

2016-10-20 Thread Oliver Holmes
I am using Web2Py on a RaspberryPI as a SOAP service provider and a very 
rudimentary configuration is possible through some views. User interaction 
is via a client application and users are mostly unaware that there is some 
server running in one of their shelves. I have just recently implemented a 
procedure to update a server via the client. It stores the current 
web2py-app then exports the db as csv, updates any files that need 
updating, clears all tables and reimports the csv. This works fine, but may 
result in timeout messages on the client side, as tests have shown. 
Besides, for the user there is no way of knowing how far the procedure has 
gone, and how much longer the wait will be. Is there a possibility to give 
feedback to the client? Any kind of message would be great just numeric to 
fill a progress indicator or even text to display progress messages?

Regards,
Oliver Holmes

-- 
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] it it possible to loop through field names and set "readable = False" conditional if field is empty?

2016-10-17 Thread Alex Glaros
Would like to loop through columns in a set object and set readable = False 
if the field has no data in it

something like:

[setattr(f, 'readable', False) for f in db.Address if 
specificAddress.f.name 
== None]

(the set above is created with this line: specificAddress = 
db.Address(specificAddressID)

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.


[web2py] Is it possible to use compiled modules only?, without source code

2016-10-11 Thread Jaime Herrero
Hello group,

  I'm working in a couple of applications that requires same modules; I'm 
using site-packages to have just one instance of the modules shared between 
the applications.
  Another site requires to use the same modules but I don't want to share 
the source code, just the modules in pyc format.
  I tried to use them copying only the modules in pyc format and it works 
locally (localhost) but when I tried to upload the application in a web 
server on internet, it stop working and never recognize the modules using 
the import command, neither if I restart the web server.

  Any clue? thanks in advance,

Jaime

-- 
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 it possible reload my model.py from an ajax request?

2016-08-05 Thread Bernardo Leon
Hi, I have an SQLFORM.grid form and when I am inserting data I want to make 
the selectors work in cascade. I have seen some recipies where they create 
by hand the form using plain html and throw some jQuery in the middle but I 
dont like it, I like the cleaness of web2py so I am looking for a cleaner 
way to accomplish this.

So far I am trying with ajax request and I have been able to call a 
function in my controller passing the id of the parent selector to finally 
change the child's selector IS_IN_DB validator. That was my idea, but it 
seems I cannot change the validator from de controller, only from the 
model; so is there a way to reload the model within an ajax request so I 
can change the behavior of my form at runtime? Is there a better/cleaner 
way to accomplish this?

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


[web2py] Is it possible to hide some value inside set of the field?

2016-06-02 Thread Tadas Talaikis
Hey guys,

For example, I have a bunch of rows with IS_IN_SET validator inside the 
field an want to dispaly some columns, but hide others. More specifically, 
is it possible to hide them and still have them available for later use?

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] Is it possible to chose the cache folder on disk?

2016-04-26 Thread Antonio
Hi, 
I'm using web2py to create a json to later use on a mobile app. The thing 
is that it takes a while to get all the information so I decided to use 
cache.disk to have my application cache on disk.
I just pasted this on top my function:
@cache(request.env.path_info, time_expire=600, cache_model=cache.disk)

But what this does is create a folder with the name of my application in my 
root directory.
I've searched everywhere for a way with which to chose where I want my 
cache directory but I couldn't find it.

¿Is it possible to do?
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] Is it possible to use APSW or have a similar feature

2015-12-07 Thread Jitun John
Hi, I am new to web2py and am an amateur programmer.
I have working python script with APSW imported. 
(http://rogerbinns.github.io/apsw/)

I wanted to make use of the same script in web2py.
But I guess I cannot import it in the module. (apsw works with 2.x version 
of python as well though)
Wanted to check if it is possible to import it ?

The feature that I want is to be able to create a Table in the memory.
Once things are imported to it, dump it to the disk as a .sqlite file.
We can read that .sqlite file from the disk and put it memory as well if 
needed.
It is a log analysis application, so each log would have db file which can 
be re-read later.
The table is going to be static, so there will not be any modifications to 
it once data is inserted.
It mostly will be queries to the table and if the table is in memory, 
things will be much faster.

mem_db_connection = apsw.Connection(":memory:")
cursor = mem_db_connection.cursor()
global_db_backup_con = apsw.Connection(db_file_name)

# Copy from memory to disk
with global_db_backup_con.backup("main", mem_db_connection, "main") as 
backup:
backup.step()   # copy whole database in one go

Its is a simple application, which would run on local host and the table 
size would be small.
Wanted to check if something on those lines is possible.

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


[web2py] multiple conditionals possible in grid formatting statements?

2015-12-04 Thread Alex Glaros
Is it possible, and if yes, what is syntax for multiple "IF" statements in 
grid links statements?

connection_canceling_links =  [dict(header='Cancel connection', 
 body=lambda row: A('Withdraw my invitation', 
_href=URL('delete_connection_request_i_sent', args=row.auth_membership.id, 
vars=dict(person_first_name=row.auth_user.first_name, 
person_last_name=row.auth_user.last_name, 
person_user_id=row.auth_user.id)), _class='btn') if 
row.auth_membership.is_active 
 DIV('Testing data', _style='color:Yellow') if 
row.auth_membership.is_active==False  else DIV('Historical data', 
_style='color:DarkGray'))] 

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.


[web2py] Is it possible to have this type of multiple requires in db.py?

2015-09-16 Thread Alex Glaros
would like to have two "requires" in DAL.  Does below effort make sense?

the IS_IN_DB part works by itself, but the lambda is a guess.  It crashes 
after attempt to add a record.

Field('organizationID','reference Organization', requires = [IS_IN_DB(db, 
'Organization.id', '%(organizationFullName)s',zero=T('choose one')), lambda 
id, row: db.Organization(organizationID).organizationPrimaryTypeID == 1]),

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.


[web2py] Is it possible to translate data in SQLFORM.grid?

2015-07-30 Thread Gael Princivalle
Hello all.

Is it possible to translate data in SQLFORM.grid?

MODEL:
db.define_table('fruits',
Field('name', type='string'),
format='%(name)s')

db.define_table('cake',
Field('name', type='string'),
Field('fruit', 'reference fruits', requires = IS_IN_DB(db, 
db.fruits.id, '%(name)s'), represent=lambda id, r: db.fruits[id].name))

CONTROLLER:
grid=SQLFORM.grid(db.cake)

VIEW:
{{=grid}}

In the fruits table, names are in english, for example Apple.

Is it possible to set for this field in the grid automatic traductions like 
T()?

In this case for example I would like to have in an Italian page Mela 
instead of Apple.

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.


Re: [web2py] Is it possible to translate data in SQLFORM.grid?

2015-07-30 Thread Massimiliano
Have you tried?

db.cake.fruit.represent = lambda v, r: T(db.fruits[v].name)
grid=SQLFORM.grid(db.cake)


On Thu, Jul 30, 2015 at 8:55 AM, Gael Princivalle gaelprinciva...@gmail.com
 wrote:

 Hello all.

 Is it possible to translate data in SQLFORM.grid?

 MODEL:
 db.define_table('fruits',
 Field('name', type='string'),
 format='%(name)s')

 db.define_table('cake',
 Field('name', type='string'),
 Field('fruit', 'reference fruits', requires = IS_IN_DB(db,
 db.fruits.id, '%(name)s'), represent=lambda id, r: db.fruits[id].name))

 CONTROLLER:
 grid=SQLFORM.grid(db.cake)

 VIEW:
 {{=grid}}

 In the fruits table, names are in english, for example Apple.

 Is it possible to set for this field in the grid automatic traductions
 like T()?

 In this case for example I would like to have in an Italian page Mela
 instead of Apple.

 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.




-- 
Massimiliano

-- 
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] Is it possible to translate data in SQLFORM.grid?

2015-07-30 Thread Gael Princivalle
Thank a lot Massimiliano.
I've to remind to search more for solutions with the lambda function.

Il giorno giovedì 30 luglio 2015 09:38:01 UTC+2, Massimiliano ha scritto:

 Have you tried?

 db.cake.fruit.represent = lambda v, r: T(db.fruits[v].name)
 grid=SQLFORM.grid(db.cake)


 On Thu, Jul 30, 2015 at 8:55 AM, Gael Princivalle gaelpri...@gmail.com 
 javascript: wrote:

 Hello all.

 Is it possible to translate data in SQLFORM.grid?

 MODEL:
 db.define_table('fruits',
 Field('name', type='string'),
 format='%(name)s')

 db.define_table('cake',
 Field('name', type='string'),
 Field('fruit', 'reference fruits', requires = IS_IN_DB(db
 , db.fruits.id, '%(name)s'), represent=lambda id, r: db.fruits[id].name))

 CONTROLLER:
 grid=SQLFORM.grid(db.cake)

 VIEW:
 {{=grid}}

 In the fruits table, names are in english, for example Apple.

 Is it possible to set for this field in the grid automatic traductions 
 like T()?

 In this case for example I would like to have in an Italian page Mela 
 instead of Apple.

 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+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Massimiliano
  

-- 
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: web2ruby possible?

2015-05-19 Thread Stuart Deal
The question is Why would you translate web2py to Ruby?

On Sunday, September 11, 2011 at 11:21:23 AM UTC-7, Ramos wrote:

 hello

 why not translate web2py to ruby? 

 is this a good question or what?





  

-- 
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: web2ruby possible?

2015-05-13 Thread Leonel Câmara
I want whatever it is you guys are smoking!

-- 
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: web2ruby possible?

2015-05-13 Thread José Ricardo Borba
+1.
web2py rocks...

2015-05-13 8:36 GMT-03:00 Leonel Câmara leonelcam...@gmail.com:

 I want whatever it is you guys are smoking!

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




-- 
José Ricardo Borba

-- 
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 it possible to create a webservice funcion for login (instead of basic authentication)?

2015-05-05 Thread Lisandro
I'm creating a XMLRPC webservice with web2py, everything works perfect. 
In order to restrict access to the webservice, acordingly to the docs, you 
have to decorate the function that instantiates the webservice, for example:

@auth.requires_login()
def call():
return service()


@service.xmlrpc
def check():
return auth.user.email

So, in order to connect to this webservice, you would have to pass the user 
and password in the url, like this:
http://user:email@domain/default/call/xmlrpc
And then you would be able to run the function check() of the webservice.

So far all good. But what if I want to create a public webservice, and 
include a function for login (taking user and email as arguments)? The 
function should login the user and next calls to other functions should be 
able to check if user is logged in.

I've tried this with no success:

def call():
return service()


@service.xmlrpc
def login(data):
user = auth.login_bare(data['email'], data['password'])
if not user:
return False
else:
auth.login_user(user)
return True


@service.xmlrpc
def check():
if auth.is_logged_in():
return auth.user.email
else:
return False

However this doesn't work. I can succesfully connect to the webservice, and 
I can succesfully execute login() function, but then inmediately I 
execute check() function and I always receive False, so the session isn't 
created.

For the testing client I'm using class ServerProxy from python xmlrpclib. 
I know this is easy to fix (using the first of the two examples shown 
here), but not all clients support basic authentication and I'm trying to 
figure out what to do for those cases. 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] is it possible to conditionally format grid field based on other field in the row?

2015-03-09 Thread Alex Glaros
can content of one grid field control formatting of other field in same row?

tried many variations including this but got: 'Row' object has no attribute 
'modified_on'

db.InternalMessage.subjectLine.represent = lambda value,row: DIV(value, 
_style='font-size:75%;color:#656555') if row.modified_on == None else DIV(
value, _style='font-size:135%;color:#991155')

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.


[web2py] Is it possible to rename a database without using csv export/import?

2015-02-24 Thread Lisandro
I have a website running with a database, and I want to make an exact copy 
of the website (that is, copy all web2py folder with its applications and 
all the stuff), and I would like to assign that new site an exact copy of 
the database, but with another name. I'm using postgresql, and I already 
figured out to make a dump of the original db and then restore that dump to 
a new db with a different name.

However, in the new copy of the site, all the filenames under databases 
folder start with a hash. That hash, accordingly to documentation, is 
created based on connection string. So, in my case, I need to use the 
original databases folder with the new database name.
I already tryed fake_migrate_all and migrate_enabled but, in this specific 
case, it's useful, because my models have some custom migration code, and 
they need to create some new tables, keeping the old ones too). 

I guess that if I get the correct hash for the new connection string, and 
then replace the old hash with the new one in the filenames of databases 
folder, then it would work. But it's just a guess.
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] Is it possible to append content to a block from multiple included files?

2014-12-10 Thread Lisandro
I'm wondering if it's possible to append content to a block from multiple 
included files
This a resume of what I would like to do:

layout.html
html
{{include}}
script src=//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
/script
script
{{block jquery_code}}
{{end}}
/script
/html

index.html
{{extend 'layout.html'}}

pThis is a paragraph/p

{{include 'file_1.html'}}
{{include 'file_2.html'}}

And then the two included files looking pretty much the same for this 
example:
pThis is file_1.html/p

{{blockjquery_code}}
  //Some jquery code here
{{end}}

pThis is file_2.html/p

{{blockjquery_code}}
  //Some jquery code here
{{end}}

This way it doesn't work. I also tried adding  {{block jquery_code}} 
{{end}} to the index.html file. And I also tried using {{super}}, but 
nothing.

I'm trying to use it this way so the jquery.min.js file is included in the 
bottom of the html (accordingly to what it is the preffered way). Then, I 
would be able to add some jquery code in every extended view, like the 
file_1.html and file_2.html examples above. 

I'm trying to figure out how to do it. Any suggestions about achieving the 
same with a different approach? 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.


Re: [web2py] Is it possible to restrict a user to single login instance ?

2014-10-15 Thread Mandar Vaze / मंदार वझे
All,

Let me clarify a little - since lot of answer seemed to focus on MachineA
Vs MachineB
What I need is only one valid session from UserA at given point - so two
sessions - one from Chrome and other from Firefox - both from MachineA -
should be disallowed. (Not sure if it makes problem easy or difficult)

*Theoretically* I am thinking following :

in pre-login (if I can intercept login attempt) - put a code that checks
whether user that is trying to login - has already logged in (and not
logged out yet) If yes, do not allow the login (or somehow forcely
invalidate other session - and allow this login attempt to go thru)

*But I am not sure how this maps to web2py flow/hooks etc*.
So pointers w/ specifics above would help.

Thanks,
-Mandar



On Tue, Oct 14, 2014 at 11:31 PM, Mandar Vaze mandarv...@gmail.com wrote:

 This is related to possible security issue. I've written privately to
 Massimo and Anthony (in another email on this list - they suggested that
 security issues not be discussed publicly on this list)

 Lets say UserA logs in successfully from MachineA
 now without logging out from MachineA - UserA logs in from MachineB

 Is it possible to either :
 not allow login from MachineB (show message that You are currently logged
 in from MachineA - continue to access the application from MachineA, or
 logout from MachineA... or some such message.)
 OR
 allow login from MachineB - but forcefully log out userA from MachineA
 (since login from MachineB was later)

 Either case - UserA is logged in only once from any machine/browser

 I prefer second option - cause the (legitimate) reason why UserA is
 logging in from MachineB is because s/he doesn't have access to MachineA
 (at this point)

 -Mandar

 --
 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/Z3gjaLzM65E/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.


Re: [web2py] Is it possible to restrict a user to single login instance ?

2014-10-15 Thread Anthony


 Let me clarify a little - since lot of answer seemed to focus on MachineA 
 Vs MachineB
 What I need is only one valid session from UserA at given point - so two 
 sessions - one from Chrome and other from Firefox - both from MachineA - 
 should be disallowed. (Not sure if it makes problem easy or difficult)


You still need to be able to distinguish one machine/browser from another 
in order to know whether a given login request is coming from a different 
client. The user agent will tell you if a different browser is being used 
(though it can be spoofed, so this is not a security measure), but that 
won't help if someone is using the same browser on two different machines 
(also, what kind of app requires that users should not be able to log in 
from different browsers on the same machine?). And as already mentioned, 
there are limitations to using IP address to uniquely identify machines.
 

 *Theoretically* I am thinking following :

 in pre-login (if I can intercept login attempt) - put a code that checks 
 whether user that is trying to login - has already logged in (and not 
 logged out yet) If yes, do not allow the login (or somehow forcely 
 invalidate other session - and allow this login attempt to go thru)


Maybe add a session_id field to db.auth_user, and when a user logs in (a) 
check that field, and if it has a value, delete the session file associated 
with the existing ID (if it exists) and (b) store the new session_id. Note, 
this won't work with cookie based sessions -- in that case, you would 
instead have to check the session_id value stored in db.auth_user on every 
request in order to catch and invalidate the session cookie from the older 
session (this adds a db lookup to every request -- might want to cache 
these in RAM, though you may need to clean up periodically if there are a 
large number of users).

Also, note that this doesn't protect against session hijacking. It only 
protects against multiple simultaneous logins (which would be using 
different sessions rather than sharing a single hijacked session).

Anthony

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


Re: [web2py] Is it possible to restrict a user to single login instance ?

2014-10-15 Thread Anthony
 

 *Theoretically* I am thinking following :

 in pre-login (if I can intercept login attempt) - put a code that checks 
 whether user that is trying to login - has already logged in (and not 
 logged out yet) If yes, do not allow the login (or somehow forcely 
 invalidate other session - and allow this login attempt to go thru)


 Maybe add a session_id field to db.auth_user, and when a user logs in (a) 
 check that field, and if it has a value, delete the session file associated 
 with the existing ID (if it exists) and (b) store the new session_id. Note, 
 this won't work with cookie based sessions -- in that case, you would 
 instead have to check the session_id value stored in db.auth_user on every 
 request in order to catch and invalidate the session cookie from the older 
 session (this adds a db lookup to every request -- might want to cache 
 these in RAM, though you may need to clean up periodically if there are a 
 large number of users).

 Also, note that this doesn't protect against session hijacking. It only 
 protects against multiple simultaneous logins (which would be using 
 different sessions rather than sharing a single hijacked session).


And keep in mind that this isn't really a security measure -- if an 
attacker has obtained the login credentials of a user, you are letting the 
attacker log in. For this to help with security, you would have to warn the 
original user about a login taking place from a new client.

Anthony

 


 Anthony


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


[web2py] Is it possible to restrict a user to single login instance ?

2014-10-14 Thread Mandar Vaze
This is related to possible security issue. I've written privately to 
Massimo and Anthony (in another email on this list - they suggested that 
security issues not be discussed publicly on this list)

Lets say UserA logs in successfully from MachineA
now without logging out from MachineA - UserA logs in from MachineB

Is it possible to either :
not allow login from MachineB (show message that You are currently logged 
in from MachineA - continue to access the application from MachineA, or 
logout from MachineA... or some such message.)
OR
allow login from MachineB - but forcefully log out userA from MachineA 
(since login from MachineB was later)

Either case - UserA is logged in only once from any machine/browser

I prefer second option - cause the (legitimate) reason why UserA is logging 
in from MachineB is because s/he doesn't have access to MachineA (at this 
point)

-Mandar

-- 
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] Is it possible to compress the output html before rendering out?

2014-09-11 Thread Francisco Costa
tried with https://pypi.python.org/pypi/htmlmin/0.1.5 and worked fine

On Thursday, 27 October 2011 14:59:30 UTC+1, Anthony wrote:

 If you have a function that does the compressing, I suppose you could do 
 something like:

 def my_action():
 [some code]
 d = dict(...)
 return compress_html(response.render(d))

 Anthony

 On Thursday, October 27, 2011 9:40:30 AM UTC-4, Marco Tulio wrote:

 like the uglifier on Ruby?

 2011/10/21 Farsheed Ashouri farsheed...@gmail.com

 Is it possible to compress the output html before rendering out? I mean
 using tools like compressors or tiddy to clean/compress the output code
 automatically on output not on our source.




 -- 
 []'s
 Marco Tulio



-- 
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] Is it possible to get an _onclick prompt variable to send to the controller?

2014-08-04 Thread Richard Vézina
Oh, sorry I didn't realise you were assigning a var...

You may in this case create a function that create the var you want and
just call it with the onclick...

Richard


On Fri, Jul 18, 2014 at 1:57 PM, ucm...@gmail.com wrote:

 Hi Richard,

 Thanks for the reply!  I decided to go with an easier solution due to time
 constraints but I'm still very interested in how my issue would've been
 solved.  You mention to pass the _onclick variable as a kwarg but the A()
 helper would not accept it.  Also, I do not understand how I would be able
 to send it to my 'extend' controller function or how the A() _onlick prompt
 would trigger.  Can you please clarify your solution?

 Regards,
 Jimmy


 On Thursday, July 17, 2014 7:23:13 AM UTC-7, Richard wrote:

 Yes, but I guess you need to pass it like that :

 **{'*_onclick*': *var reason=prompt('Reason for extending?'); return
 reason;*}

 Richard


 On Wed, Jul 16, 2014 at 8:09 PM, ucm...@gmail.com wrote:

 Hi all,

 I started using web2py a week ago with little MVC experience.  I have a
 page displaying a database table using a SQLFORM.grid() where each row has
 buttons to extend a time variable or delete the row.  I want to add a
 pop-up prompt which asks the user why they are extending the time variable.

 My links in the controller displaying the database:
 ## instantiate row variable with database output

 links = [{'header': '', 'body': lambda row: A('extend',
   _class='btn',
 *  _onclick=var
 reason=prompt('Reason for extending?'); return reason;,*
   _href=URL('extend',
 args=[row.project_name, row.kill_date]))},
  {'header': '', 'body': lambda row: A('kill',
   _class='btn',
   callback=URL('kill',
 args=[row.project_name]),
   delete=tr)}]

 grid = SQLFORM.grid(, links=links, ...)
 return dict(form=grid)

 My view:
 {{extend 'layout.html'}}
 {{=form}}

 When I press the extend button, the prompt comes up and I can enter a
 string.  Where does that string go to and how do I access it so that I can
 use it in the 'extend' controller?  Is there a different way I should be
 doing this?

 Thanks,
 Jimmy

 --
 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+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] Is it possible to step through scheduler task code in debugger?

2014-07-24 Thread Stephen Weiss
I want to use a debugger (winpdb) to step through a scheduler module.

However, when I run the scheduler in the debugger (-K option) and I set a 
breakpoint in my module and submit a job to the scheduler_task table, 
I get debug output (prints) in the console, but the breakpoint is never 
hit.  The row in the scheduler_task table changes to COMPLETED.

Thus, I know the scheduler is running my module in the debugger, but it 
just won't stop at the breakpoint I have set.

I believe the issue is with the multi-threaded nature of the scheduler and 
debugger, but I don't know how to resolve the problem.

Any help would be greatly appreciated.

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.


Re: [web2py] Is it possible to get an _onclick prompt variable to send to the controller?

2014-07-20 Thread ucmyih
Hi Richard,

Thanks for the reply!  I decided to go with an easier solution due to time 
constraints but I'm still very interested in how my issue would've been 
solved.  You mention to pass the _onclick variable as a kwarg but the A() 
helper would not accept it.  Also, I do not understand how I would be able 
to send it to my 'extend' controller function or how the A() _onlick prompt 
would trigger.  Can you please clarify your solution?

Regards,
Jimmy

On Thursday, July 17, 2014 7:23:13 AM UTC-7, Richard wrote:

 Yes, but I guess you need to pass it like that :

 **{'*_onclick*': *var reason=prompt('Reason for extending?'); return 
 reason;*}

 Richard


 On Wed, Jul 16, 2014 at 8:09 PM, ucm...@gmail.com javascript: wrote:

 Hi all,

 I started using web2py a week ago with little MVC experience.  I have a 
 page displaying a database table using a SQLFORM.grid() where each row has 
 buttons to extend a time variable or delete the row.  I want to add a 
 pop-up prompt which asks the user why they are extending the time variable.

 My links in the controller displaying the database:
 ## instantiate row variable with database output

 links = [{'header': '', 'body': lambda row: A('extend',
   _class='btn',
 *  _onclick=var 
 reason=prompt('Reason for extending?'); return reason;,*
   _href=URL('extend', 
 args=[row.project_name, row.kill_date]))},
  {'header': '', 'body': lambda row: A('kill',
   _class='btn',
   callback=URL('kill', 
 args=[row.project_name]),
   delete=tr)}]

 grid = SQLFORM.grid(, links=links, ...)
 return dict(form=grid)

 My view:
 {{extend 'layout.html'}}
 {{=form}}

 When I press the extend button, the prompt comes up and I can enter a 
 string.  Where does that string go to and how do I access it so that I can 
 use it in the 'extend' controller?  Is there a different way I should be 
 doing this?

 Thanks,
 Jimmy

 -- 
 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 javascript:.
 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] Is it possible to get an _onclick prompt variable to send to the controller?

2014-07-17 Thread ucmyih
Hi all,

I started using web2py a week ago with little MVC experience.  I have a 
page displaying a database table using a SQLFORM.grid() where each row has 
buttons to extend a time variable or delete the row.  I want to add a 
pop-up prompt which asks the user why they are extending the time variable.

My links in the controller displaying the database:
## instantiate row variable with database output

links = [{'header': '', 'body': lambda row: A('extend',
  _class='btn',
*  _onclick=var 
reason=prompt('Reason for extending?'); return reason;,*
  _href=URL('extend', 
args=[row.project_name, row.kill_date]))},
 {'header': '', 'body': lambda row: A('kill',
  _class='btn',
  callback=URL('kill', 
args=[row.project_name]),
  delete=tr)}]

grid = SQLFORM.grid(, links=links, ...)
return dict(form=grid)

My view:
{{extend 'layout.html'}}
{{=form}}

When I press the extend button, the prompt comes up and I can enter a 
string.  Where does that string go to and how do I access it so that I can 
use it in the 'extend' controller?  Is there a different way I should be 
doing this?

Thanks,
Jimmy

-- 
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] Is it possible to get an _onclick prompt variable to send to the controller?

2014-07-17 Thread Richard Vézina
Yes, but I guess you need to pass it like that :

**{'*_onclick*': *var reason=prompt('Reason for extending?'); return
reason;*}

Richard


On Wed, Jul 16, 2014 at 8:09 PM, ucm...@gmail.com wrote:

 Hi all,

 I started using web2py a week ago with little MVC experience.  I have a
 page displaying a database table using a SQLFORM.grid() where each row has
 buttons to extend a time variable or delete the row.  I want to add a
 pop-up prompt which asks the user why they are extending the time variable.

 My links in the controller displaying the database:
 ## instantiate row variable with database output

 links = [{'header': '', 'body': lambda row: A('extend',
   _class='btn',
 *  _onclick=var
 reason=prompt('Reason for extending?'); return reason;,*
   _href=URL('extend',
 args=[row.project_name, row.kill_date]))},
  {'header': '', 'body': lambda row: A('kill',
   _class='btn',
   callback=URL('kill',
 args=[row.project_name]),
   delete=tr)}]

 grid = SQLFORM.grid(, links=links, ...)
 return dict(form=grid)

 My view:
 {{extend 'layout.html'}}
 {{=form}}

 When I press the extend button, the prompt comes up and I can enter a
 string.  Where does that string go to and how do I access it so that I can
 use it in the 'extend' controller?  Is there a different way I should be
 doing this?

 Thanks,
 Jimmy

 --
 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] is it possible to hand over Rows object to sqlform.grid form ?

2014-04-21 Thread alex
Hello guys. I need to display different rows with checkboxes from different 
tables , so I decided to use grid form. With such demands I have to use one 
grid form for each table, but as far as I know that it's incorrect to do 
so. Maybe there is a way to extract rows from those tables and hand them 
over to a grid form ?? Any other options ? 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] Using record_versioning - possible to place links only on right side of grid=SQLFORM?

2014-04-11 Thread LoveWeb2py
Hello,

I'd like to just have my links on the right side of the SQLFORM Grid and my 
buttons on the left and right. I've tried modifying the sqlhtml.py and 
changing links_placement = 'right', and buttons_placement = 'both', but 
both the links and buttons still appear. I'm guessing the record versioning 
links are some how included with the buttons?



-- 
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] Field.label=lambda ... possible?

2014-03-19 Thread Kiran Subbaraman
Hello,
I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
want to display the label value by computing it.

Basically, I have this:

model:
db.define_table('x',
Field('p', type='string'),
Field('q', type='string')
)


controller:

  if blah:
 db.x.q.label = lambda row: row.p
.


The label is displayed like this 'function lambda at 0x0955FF30'
Not sure if this is supported, or I need to change this code?
Any help?

Thanks,
Kiran

-- 
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 it possible to execute {{code}} from database?

2014-02-22 Thread Robin Manoli
Suppose db.page.content has some text like : {{ arbitrary python code }}. 
Would this python code then be executed? Is it possible to execute such 
code?

-- 
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/groups/opt_out.


Re: [web2py] Is it possible to execute {{code}} from database?

2014-02-22 Thread Jonathan Lundell
On 22 Feb 2014, at 3:31 PM, Robin Manoli ramat...@gmail.com wrote:
 Suppose db.page.content has some text like : {{ arbitrary python code }}. 
 Would this python code then be executed? Is it possible to execute such code?
 
 

Assuming that the code is a valid web2py template, I think you could set 
response.view to StringIO(your_text) and it'd be rendered normally as a web2py 
view (template). If that's what you're after...

That's just my quick reading of the template code, not solid information.

-- 
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/groups/opt_out.


[web2py] Re: parse_as_rest possible problem

2014-01-03 Thread Massimo Di Pierro
I am removing those lines because I cannot find a good reason for them. 


On Friday, 3 January 2014 09:26:07 UTC-6, Felipe Augusto Meirelles wrote:

 Hi,

 Can some one on the devs team explain this on DAL.py (line 8098):
 if count  limits[1]-limits[0]:
 return Row({'status':400,'error':'too many 
 records','response':None})

 I'm trying to use the parse_as_rest function, sending a request as 
 /auth-user?offset=16limit=10. This should give me 10 records starting 
 at the record 17, am I right?
 If I remove this this condition, it seems to work just fine.

 Any thoughts?



-- 
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/groups/opt_out.


Re: [web2py] is this possible db.table(id).field.represent

2013-11-11 Thread Richard Vézina
The seconde choice seems to be what I was search for... I was know about
.render(), but as you explain it is for rows only and don't apply when I
use this short cut : db.table(id_of_record).field

Thanks a lot.

Richard


On Fri, Nov 8, 2013 at 4:59 PM, Anthony abasta...@gmail.com wrote:

 Are you saying you want the represent function applied specifically to a
 reference field?

 Note, a Row object does not know with what DAL table it is associated, so
 it can't automatically apply the represent attributes of its fields.
 However, the Rows object has a new .render() method for this purpose -- see
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Rendering-rows-using-represent.
 In this case:

 {{=db(db.table.id == id).select().render(0).field}}

 Above, .render(0) extracts the first Row and applies the represent
 attributes to all fields.

 For reference fields, you can also simply do a recursive select as long as
 you know the name of the field to be used to represent the reference:

 {{=db.table(id).reference_field.field_in_referenced_table}}

 Anthony



 On Friday, November 8, 2013 4:06:40 PM UTC-5, Richard wrote:

 Hello,

 How can I do this :

 db.table(id).field.represent

 Could a short cut be created to handle this use case?

 {{=form.custom.begin}}
 table class=table table-condensed table-hover
 theadtrth{{=T('Field label')}}/th/tr/thead
 tbody
 {{for r in rows:}}
 tr
 {{if record_id is not None and r.id == record_id:}}
 td{{=form.custom.widget.referenced_field_id}}/td

 {{else:}}
 td{{=db.table(r.id).referenced_field_id.represent}
 }/td
* !-- So I don't have to do --*
 *!--
 {{=db.referenced_table(r.referenced_field_id).field_representing_id_referenced}}
 --*
 {{pass}}
 /tr
 {{pass}}

 /tbody
 /table
 {{=form.custom.end}}


 Thanks

 Richard

  --
 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/groups/opt_out.


-- 
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/groups/opt_out.


[web2py] is this possible db.table(id).field.represent

2013-11-08 Thread Richard
Hello,

How can I do this :

db.table(id).field.represent

Could a short cut be created to handle this use case?

{{=form.custom.begin}}
table class=table table-condensed table-hover
theadtrth{{=T('Field label')}}/th/tr/thead
tbody
{{for r in rows:}}
tr
{{if record_id is not None and r.id == record_id:}}
td{{=form.custom.widget.referenced_field_id}}/td

{{else:}}
td{{=db.table(r.id).referenced_field_id.represent
}}/td
   * !-- So I don't have to do --*
*!-- 
{{=db.referenced_table(r.referenced_field_id).field_representing_id_referenced}}
 
--*
{{pass}}
/tr
{{pass}}

/tbody
/table
{{=form.custom.end}}


Thanks

Richard

-- 
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/groups/opt_out.


Re: [web2py] is this possible db.table(id).field.represent

2013-11-08 Thread Anthony
Are you saying you want the represent function applied specifically to a 
reference field?

Note, a Row object does not know with what DAL table it is associated, so 
it can't automatically apply the represent attributes of its fields. 
However, the Rows object has a new .render() method for this purpose -- see 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Rendering-rows-using-represent.
 
In this case:

{{=db(db.table.id == id).select().render(0).field}}

Above, .render(0) extracts the first Row and applies the represent 
attributes to all fields.

For reference fields, you can also simply do a recursive select as long as 
you know the name of the field to be used to represent the reference:

{{=db.table(id).reference_field.field_in_referenced_table}}

Anthony


On Friday, November 8, 2013 4:06:40 PM UTC-5, Richard wrote:

 Hello,

 How can I do this :

 db.table(id).field.represent

 Could a short cut be created to handle this use case?

 {{=form.custom.begin}}
 table class=table table-condensed table-hover
 theadtrth{{=T('Field label')}}/th/tr/thead
 tbody
 {{for r in rows:}}
 tr
 {{if record_id is not None and r.id == record_id:}}
 td{{=form.custom.widget.referenced_field_id}}/td
 
 {{else:}}
 td{{=db.table(r.id).referenced_field_id.represent
 }}/td
* !-- So I don't have to do --*
 *!-- 
 {{=db.referenced_table(r.referenced_field_id).field_representing_id_referenced}}
  
 --*
 {{pass}}
 /tr
 {{pass}}

 /tbody
 /table
 {{=form.custom.end}}


 Thanks

 Richard


-- 
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/groups/opt_out.


[web2py] Is it possible to redirect() after response.stream()?

2013-10-15 Thread Vinicius Assef
Is it possible to make a redirect() after a response.stream() file download?

I'd like to redirect to my list page with message Download succesful.

I tried this, but no redirect is done:
response.stream(filename, attachment=True, filename=my_filename.xls)
session.flash = T(Download succesful)
redirect(URL(c=request.controller, f=list)

-- 
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/groups/opt_out.


[web2py] Is is possible to create a postgres database from web2py application?

2013-10-02 Thread at

Is is possible to create a postgres database from web2py application?

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/groups/opt_out.


Re: [web2py] Is is possible to create a postgres database from web2py application?

2013-10-02 Thread Richard Vézina
You mean : createdb ... ?

I think no, you have to create it in postgres with createdb or pgAdminIII
and then write the DAL connection string according to your created database
: database name, username, password, etc.

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=migrate#Connection-strings

http://www.postgresql.org/docs/9.1/static/app-createdb.html

If you start from scratch you will also have to master pg_hba.conf

http://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html

and postgresql.confget

http://www.postgresql.org/docs/9.1/static/tutorial-start.html
https://help.ubuntu.com/community/PostgreSQL

Good read!!

Richard



On Wed, Oct 2, 2013 at 9:49 AM, at matifa...@gmail.com wrote:


 Is is possible to create a postgres database from web2py application?

 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/groups/opt_out.


-- 
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/groups/opt_out.


[web2py] Speaking URLs possible?

2013-09-02 Thread xelomac
Hi everybody,

after playing around with routes.py for a while I wonder if what I want to 
do is possible at all. I want to rewrite the URLs shown to the visitor 
after clicking a menu link in the following way:

Lets say I built a site that deals with colors. My menu shows base color 
links like red, green, blue on the top level and variations of the the base 
colors on the next menu level. My app would be named color_book my 
controller colors and the the function showing the pages 
show_color_page.

After clicking the submenu item light-blue under the parent menu-item 
blue I would normally see an URL in the browser like:
http://my.domain.com/color_book/colors/show_color_page/light-blue

But I want to rewrite the URL to: http://my.domain.com/blue/light-blue

Accordingly a page with the menu location red  dark-red should be 
presented with: http://my.domain.com/red/light-red

I thought that a pattern-based routes.py could be configured to do things 
like that. But I've only had success with rewriting URLs manually entered 
in the browser's address field so far- but not with internal links.

Is there an example for my use case somewhere?

Thanks for any help!
 

-- 

--- 
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/groups/opt_out.


[web2py] Is it possible to know what view was rendered?

2013-08-06 Thread Vinicius Assef
I'm working on tests in apps, again.

To test a controller, we usually check if some view was used, but when
response.view doesn't exist, generic.extension is used and
response.view is not updated accordingly.

In this situation, how may know which view was really rendered?

-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to know what view was rendered?

2013-08-06 Thread Ovidio Marinho
If response.view not been completed and finalized, there is no session, so
it was not used.




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
   83   8826 9088 - Oi
   83   9336 3782 - Claro
Brasil



2013/8/6 Vinicius Assef vinicius...@gmail.com

 I'm working on tests in apps, again.

 To test a controller, we usually check if some view was used, but when
 response.view doesn't exist, generic.extension is used and
 response.view is not updated accordingly.

 In this situation, how may know which view was really rendered?

 --

 ---
 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/groups/opt_out.




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Richard Vézina
I think to get the represent in csv you need a custom csv export
function... I understand you want represent in SQLFROM.grid... Sorry.

Richard


On Wed, Jul 10, 2013 at 5:49 PM, greenpoise danel.sega...@gmail.com wrote:

 read it. Dont have a clue yet.. If I use represent, the values wont show
 up in a csv export...sort of looking for alternatives now. Thanks




 On Wednesday, July 10, 2013 1:30:41 PM UTC-7, Richard wrote:

 Here you can get more clue about what I mean :

 https://groups.google.com/**forum/#!topic/web2py/**wUBbAzFHbxshttps://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs


 On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina ml.richa...@gmail.comwrote:

 If you pass to grid a select I think yes...

 Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel@gmail.com wrote:

 Is it possible to concatenate fileds in a grid??

  --

 ---
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .





  --

 ---
 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/groups/opt_out.




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Richard Vézina
Personnaly, I use Datatables.net and it button export facility...

Richard


On Thu, Jul 11, 2013 at 11:28 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 I think to get the represent in csv you need a custom csv export
 function... I understand you want represent in SQLFROM.grid... Sorry.

 Richard


 On Wed, Jul 10, 2013 at 5:49 PM, greenpoise danel.sega...@gmail.comwrote:

 read it. Dont have a clue yet.. If I use represent, the values wont show
 up in a csv export...sort of looking for alternatives now. Thanks




 On Wednesday, July 10, 2013 1:30:41 PM UTC-7, Richard wrote:

 Here you can get more clue about what I mean :

 https://groups.google.com/**forum/#!topic/web2py/**wUBbAzFHbxshttps://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs


 On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina 
 ml.richa...@gmail.comwrote:

 If you pass to grid a select I think yes...

  Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel@gmail.comwrote:

 Is it possible to concatenate fileds in a grid??

  --

 ---
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .





  --

 ---
 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/groups/opt_out.






-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread greenpoise
Thanks Richard! appreciate your help! I might revisit datatables. I 
remember trying it before. 

THanks again!

d


On Thursday, July 11, 2013 8:30:03 AM UTC-7, Richard wrote:

 Personnaly, I use Datatables.net and it button export facility...

 Richard


 On Thu, Jul 11, 2013 at 11:28 AM, Richard Vézina 
 ml.richa...@gmail.comjavascript:
  wrote:

 I think to get the represent in csv you need a custom csv export 
 function... I understand you want represent in SQLFROM.grid... Sorry.

 Richard


 On Wed, Jul 10, 2013 at 5:49 PM, greenpoise danel@gmail.comjavascript:
  wrote:

 read it. Dont have a clue yet.. If I use represent, the values wont show 
 up in a csv export...sort of looking for alternatives now. Thanks




 On Wednesday, July 10, 2013 1:30:41 PM UTC-7, Richard wrote:

 Here you can get more clue about what I mean :

 https://groups.google.com/**forum/#!topic/web2py/**wUBbAzFHbxshttps://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs
  

 On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina 
 ml.richa...@gmail.comwrote:

 If you pass to grid a select I think yes...

  Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel@gmail.comwrote:

 Is it possible to concatenate fileds in a grid??

  -- 
  
 --- 
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  



  -- 
  
 --- 
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  





-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Richard Vézina
I can save you some time with the initialization, just ask here I will take
look a couples more times...


On Thu, Jul 11, 2013 at 12:47 PM, greenpoise danel.sega...@gmail.comwrote:

 Thanks Richard! appreciate your help! I might revisit datatables. I
 remember trying it before.

 THanks again!

 d


 On Thursday, July 11, 2013 8:30:03 AM UTC-7, Richard wrote:

 Personnaly, I use Datatables.net and it button export facility...

 Richard


 On Thu, Jul 11, 2013 at 11:28 AM, Richard Vézina 
 ml.richa...@gmail.comwrote:

 I think to get the represent in csv you need a custom csv export
 function... I understand you want represent in SQLFROM.grid... Sorry.

 Richard


 On Wed, Jul 10, 2013 at 5:49 PM, greenpoise danel@gmail.com wrote:

 read it. Dont have a clue yet.. If I use represent, the values wont
 show up in a csv export...sort of looking for alternatives now. Thanks




 On Wednesday, July 10, 2013 1:30:41 PM UTC-7, Richard wrote:

 Here you can get more clue about what I mean :

 https://groups.google.com/**foru**m/#!topic/web2py/**wUBbAzFHbxshttps://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs


 On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina ml.richa...@gmail.com
  wrote:

 If you pass to grid a select I think yes...

  Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel@gmail.comwrote:

 Is it possible to concatenate fileds in a grid??

  --

 ---
 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/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .





  --

 ---
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .





  --

 ---
 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/groups/opt_out.




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread greenpoise
I think I saw some light in here!  this did the trick for me:

Field('supplier', 'reference supplier',compute=lambda row: 
db.series(row.series).supplier),

didnt know you could do that. Thanks Richard for the offer. I might come 
back to it later on though!  :)




On Thursday, July 11, 2013 9:54:49 AM UTC-7, Richard wrote:

 I can save you some time with the initialization, just ask here I will 
 take look a couples more times...


 On Thu, Jul 11, 2013 at 12:47 PM, greenpoise danel@gmail.comjavascript:
  wrote:

 Thanks Richard! appreciate your help! I might revisit datatables. I 
 remember trying it before. 

 THanks again!

 d


 On Thursday, July 11, 2013 8:30:03 AM UTC-7, Richard wrote:

 Personnaly, I use Datatables.net and it button export facility...

 Richard


 On Thu, Jul 11, 2013 at 11:28 AM, Richard Vézina 
 ml.richa...@gmail.comwrote:

 I think to get the represent in csv you need a custom csv export 
 function... I understand you want represent in SQLFROM.grid... Sorry.

 Richard


 On Wed, Jul 10, 2013 at 5:49 PM, greenpoise danel@gmail.comwrote:

 read it. Dont have a clue yet.. If I use represent, the values wont 
 show up in a csv export...sort of looking for alternatives now. Thanks




 On Wednesday, July 10, 2013 1:30:41 PM UTC-7, Richard wrote:

 Here you can get more clue about what I mean :

 https://groups.google.com/**foru**m/#!topic/web2py/**wUBbAzFHbxshttps://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs
  

 On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina 
 ml.richa...@gmail.com wrote:

 If you pass to grid a select I think yes...

  Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel@gmail.comwrote:

 Is it possible to concatenate fileds in a grid??

  -- 
  
 --- 
 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/**grou**
 ps/opt_out https://groups.google.com/groups/opt_out.
  
  



  -- 
  
 --- 
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  



  -- 
  
 --- 
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Anthony
On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series(row.
 series).supplier),


Should be the same as:

lambda row: row.series.supplier

assuming row.series is a reference field referring to db.series.

Anthony

-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Richard Vézina
But in this case you don't have the id of the referenced record as relation
key... I am not sure it's what you want. But you question is really vague
so difficult to answer correctly to your I think :P

Richard


On Thu, Jul 11, 2013 at 2:21 PM, Anthony abasta...@gmail.com wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series(row.
 series).supplier**),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  --

 ---
 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/groups/opt_out.




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Anthony
Oops, sorry, I read that wrong -- thought it was a represent function 
rather than a compute function. Yes, not sure you want to store a value 
other than the db.series.id value in a reference field for db.series.

Anthony

On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:

 But in this case you don't have the id of the referenced record as 
 relation key... I am not sure it's what you want. But you question is 
 really vague so difficult to answer correctly to your I think :P

 Richard


 On Thu, Jul 11, 2013 at 2:21 PM, Anthony abas...@gmail.com 
 javascript:wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series(row
 .series).supplier**),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  -- 
  
 --- 
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread greenpoise
Ok..I started playing around with an empty and smaller database for the 
sake of speed. This is what I have:

db.define_table('supplier',
Field('suppliercode'),
Field('suppliername'),
format='%(suppliercode)s')
db.supplier.suppliercode.requires = 
IS_NOT_IN_DB(db,db.supplier.suppliercode)
db.supplier.suppliername.requires = 
IS_NOT_IN_DB(db,db.supplier.suppliername)

db.define_table('series',
Field('supplier','reference supplier'),
Field('seriesname'),
Field('seriesdescription'))
db.series.supplier.requires = IS_IN_DB(db,db.supplier.id,'%(suppliername)s')

db.define_table('product',
Field('series', 'reference series'),
Field('supplier', 'reference series',compute=lambda row: 
db.series(row.series).supplier),
Field('supptile', 'reference supplier',compute=lambda row: 
db.series(row.series).supplier),
Field('tilename'))
db.product.series.requires = 
IS_EMPTY_OR(IS_IN_DB(db,db.series.id,'%(seriesname)s'))

I want to concatenate/compute db.product.supptile with db.product.tilename 
..Is is possible?? .



On Thursday, July 11, 2013 11:50:07 AM UTC-7, Anthony wrote:

 Oops, sorry, I read that wrong -- thought it was a represent function 
 rather than a compute function. Yes, not sure you want to store a value 
 other than the db.series.id value in a reference field for db.series.

 Anthony

 On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:

 But in this case you don't have the id of the referenced record as 
 relation key... I am not sure it's what you want. But you question is 
 really vague so difficult to answer correctly to your I think :P

 Richard


 On Thu, Jul 11, 2013 at 2:21 PM, Anthony abas...@gmail.com wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series(
 row.series).supplier**),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  -- 
  
 --- 
 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/groups/opt_out.
  
  




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Richard Vézina
Hmmm... I think your model is wrong...

You can't use a compute on a reference field..

What you are trying to do exactly?

Why you need to concatenate thing? For representation purpose?

I think I really can help you what you need is easy but I can't understand
your goal from the model you posted...

Richard


On Thu, Jul 11, 2013 at 4:12 PM, greenpoise danel.sega...@gmail.com wrote:

 Ok..I started playing around with an empty and smaller database for the
 sake of speed. This is what I have:

 db.define_table('supplier',
 Field('suppliercode'),
 Field('suppliername'),
 format='%(suppliercode)s')
 db.supplier.suppliercode.requires =
 IS_NOT_IN_DB(db,db.supplier.suppliercode)
 db.supplier.suppliername.requires =
 IS_NOT_IN_DB(db,db.supplier.suppliername)

 db.define_table('series',
 Field('supplier','reference supplier'),
 Field('seriesname'),
 Field('seriesdescription'))
 db.series.supplier.requires = IS_IN_DB(db,db.supplier.id
 ,'%(suppliername)s')

 db.define_table('product',
 Field('series', 'reference series'),
 Field('supplier', 'reference series',compute=lambda row:
 db.series(row.series).supplier),
 Field('supptile', 'reference supplier',compute=lambda row:
 db.series(row.series).supplier),
 Field('tilename'))
 db.product.series.requires = IS_EMPTY_OR(IS_IN_DB(db,db.series.id
 ,'%(seriesname)s'))

 I want to concatenate/compute db.product.supptile with db.product.tilename
 ..Is is possible?? .




 On Thursday, July 11, 2013 11:50:07 AM UTC-7, Anthony wrote:

 Oops, sorry, I read that wrong -- thought it was a represent function
 rather than a compute function. Yes, not sure you want to store a value
 other than the db.series.id value in a reference field for db.series.

 Anthony

 On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:

 But in this case you don't have the id of the referenced record as
 relation key... I am not sure it's what you want. But you question is
 really vague so difficult to answer correctly to your I think :P

 Richard


 On Thu, Jul 11, 2013 at 2:21 PM, Anthony abas...@gmail.com wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series(
 row.series).supplier),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  --

 ---
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




  --

 ---
 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/groups/opt_out.




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread greenpoise
haa..Its an odd model I know. But it works!! punch it in in a blank project 
and you will see..
With my model I am trying to:

1. Concatenate the fields I just mentioned
2. I want to compute the supplier code for products so I dont have to 
add/select it in over and over.
3. I want to export the final output (reason why I need the concatenate in 
a compute).

Once I export that in CSV, I can bulk upload that worksheet into RMS 
(microsoft)..thats the whole reason behind this application and its weird 
model.
If you can think of a better idea, I am open for input


Thanks again!!

On Thursday, July 11, 2013 1:39:10 PM UTC-7, Richard wrote:

 Hmmm... I think your model is wrong...

 You can't use a compute on a reference field..

 What you are trying to do exactly?

 Why you need to concatenate thing? For representation purpose?

 I think I really can help you what you need is easy but I can't understand 
 your goal from the model you posted...

 Richard


 On Thu, Jul 11, 2013 at 4:12 PM, greenpoise danel@gmail.comjavascript:
  wrote:

 Ok..I started playing around with an empty and smaller database for the 
 sake of speed. This is what I have:

 db.define_table('supplier',
 Field('suppliercode'),
 Field('suppliername'),
 format='%(suppliercode)s')
 db.supplier.suppliercode.requires = 
 IS_NOT_IN_DB(db,db.supplier.suppliercode)
 db.supplier.suppliername.requires = 
 IS_NOT_IN_DB(db,db.supplier.suppliername)

 db.define_table('series',
 Field('supplier','reference supplier'),
 Field('seriesname'),
 Field('seriesdescription'))
 db.series.supplier.requires = IS_IN_DB(db,db.supplier.id
 ,'%(suppliername)s')

 db.define_table('product',
 Field('series', 'reference series'),
 Field('supplier', 'reference series',compute=lambda row: 
 db.series(row.series).supplier),
 Field('supptile', 'reference supplier',compute=lambda row: 
 db.series(row.series).supplier),
 Field('tilename'))
 db.product.series.requires = IS_EMPTY_OR(IS_IN_DB(db,db.series.id
 ,'%(seriesname)s'))

 I want to concatenate/compute db.product.supptile with 
 db.product.tilename ..Is is possible?? .




 On Thursday, July 11, 2013 11:50:07 AM UTC-7, Anthony wrote:

 Oops, sorry, I read that wrong -- thought it was a represent function 
 rather than a compute function. Yes, not sure you want to store a value 
 other than the db.series.id value in a reference field for db.series.

 Anthony

 On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:

 But in this case you don't have the id of the referenced record as 
 relation key... I am not sure it's what you want. But you question is 
 really vague so difficult to answer correctly to your I think :P

 Richard


 On Thu, Jul 11, 2013 at 2:21 PM, Anthony abas...@gmail.com wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series(
 row.series).supplier),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  -- 
  
 --- 
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
  
 --- 
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread Richard Vézina
So you don't want to reference the series and supplier... So, I think that
your model should be better in this case if your field were of type
'string', since you control the contain of the dropbox with requires anyway.

That said... What I still don't understand is that you just seems to want
the representation of the id of the record not a concat compute or your
lambda are wrong because you don't know how to acheive it.

For instance it easy to compute a contatation from different selected id of
reference table like this :

model

db.define_table('table',
Field('f1', 'reference table1'),
Field('f2', 'reference table2'),
Field('compute_field', 'string', compute=lambda row: '%s - %s' %
(db.table1(row.f1).represent_field, db.table2(row.f2).represent_field))

Richard


On Thu, Jul 11, 2013 at 4:45 PM, greenpoise danel.sega...@gmail.com wrote:

 haa..Its an odd model I know. But it works!! punch it in in a blank
 project and you will see..
 With my model I am trying to:

 1. Concatenate the fields I just mentioned
 2. I want to compute the supplier code for products so I dont have to
 add/select it in over and over.
 3. I want to export the final output (reason why I need the concatenate in
 a compute).

 Once I export that in CSV, I can bulk upload that worksheet into RMS
 (microsoft)..thats the whole reason behind this application and its weird
 model.
 If you can think of a better idea, I am open for input


 Thanks again!!

 On Thursday, July 11, 2013 1:39:10 PM UTC-7, Richard wrote:

 Hmmm... I think your model is wrong...

 You can't use a compute on a reference field..

 What you are trying to do exactly?

 Why you need to concatenate thing? For representation purpose?

 I think I really can help you what you need is easy but I can't
 understand your goal from the model you posted...

 Richard


 On Thu, Jul 11, 2013 at 4:12 PM, greenpoise danel@gmail.com wrote:

 Ok..I started playing around with an empty and smaller database for the
 sake of speed. This is what I have:

 db.define_table('supplier',
 Field('suppliercode'),
 Field('suppliername'),
 format='%(suppliercode)s')
 db.supplier.suppliercode.**requires = IS_NOT_IN_DB(db,db.supplier.**
 suppliercode)
 db.supplier.suppliername.**requires = IS_NOT_IN_DB(db,db.supplier.**
 suppliername)

 db.define_table('series',
 Field('supplier','reference supplier'),
 Field('seriesname'),
 Field('seriesdescription'))
 db.series.supplier.requires = IS_IN_DB(db,db.supplier.id,'%(**
 suppliername)s')

 db.define_table('product',
 Field('series', 'reference series'),
 Field('supplier', 'reference series',compute=lambda row:
 db.series(row.series).**supplier),
 Field('supptile', 'reference supplier',compute=lambda row:
 db.series(row.series).**supplier),
 Field('tilename'))
 db.product.series.requires = 
 IS_EMPTY_OR(IS_IN_DB(db,db.**series.idhttp://db.series.id
 ,'%(seriesname)s'))

 I want to concatenate/compute db.product.supptile with
 db.product.tilename ..Is is possible?? .




 On Thursday, July 11, 2013 11:50:07 AM UTC-7, Anthony wrote:

 Oops, sorry, I read that wrong -- thought it was a represent function
 rather than a compute function. Yes, not sure you want to store a value
 other than the db.series.id value in a reference field for db.series.

 Anthony

 On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:

 But in this case you don't have the id of the referenced record as
 relation key... I am not sure it's what you want. But you question is
 really vague so difficult to answer correctly to your I think :P

 Richard


 On Thu, Jul 11, 2013 at 2:21 PM, Anthony abas...@gmail.com wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.series
 (row.series).supplier**),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  --

 ---
 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/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .




  --

 ---
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




  --

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

Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-11 Thread greenpoise
Must probably because I dont know!  :(   Let me give it a try what you just 
posted and will write back. Thanks!



On Thursday, July 11, 2013 1:58:10 PM UTC-7, Richard wrote:

 So you don't want to reference the series and supplier... So, I think that 
 your model should be better in this case if your field were of type 
 'string', since you control the contain of the dropbox with requires anyway.

 That said... What I still don't understand is that you just seems to want 
 the representation of the id of the record not a concat compute or your 
 lambda are wrong because you don't know how to acheive it.

 For instance it easy to compute a contatation from different selected id 
 of reference table like this :

 model

 db.define_table('table',
 Field('f1', 'reference table1'),
 Field('f2', 'reference table2'),
 Field('compute_field', 'string', compute=lambda row: '%s - %s' % 
 (db.table1(row.f1).represent_field, db.table2(row.f2).represent_field))

 Richard


 On Thu, Jul 11, 2013 at 4:45 PM, greenpoise danel@gmail.comjavascript:
  wrote:

 haa..Its an odd model I know. But it works!! punch it in in a blank 
 project and you will see..
 With my model I am trying to:

 1. Concatenate the fields I just mentioned
 2. I want to compute the supplier code for products so I dont have to 
 add/select it in over and over.
 3. I want to export the final output (reason why I need the concatenate 
 in a compute).

 Once I export that in CSV, I can bulk upload that worksheet into RMS 
 (microsoft)..thats the whole reason behind this application and its weird 
 model.
 If you can think of a better idea, I am open for input


 Thanks again!!

 On Thursday, July 11, 2013 1:39:10 PM UTC-7, Richard wrote:

 Hmmm... I think your model is wrong...

 You can't use a compute on a reference field..

 What you are trying to do exactly?

 Why you need to concatenate thing? For representation purpose?

 I think I really can help you what you need is easy but I can't 
 understand your goal from the model you posted...

 Richard


  On Thu, Jul 11, 2013 at 4:12 PM, greenpoise danel@gmail.comwrote:

 Ok..I started playing around with an empty and smaller database for the 
 sake of speed. This is what I have:

 db.define_table('supplier',
 Field('suppliercode'),
 Field('suppliername'),
 format='%(suppliercode)s')
 db.supplier.suppliercode.**requires = IS_NOT_IN_DB(db,db.supplier.**
 suppliercode)
 db.supplier.suppliername.**requires = IS_NOT_IN_DB(db,db.supplier.**
 suppliername)

 db.define_table('series',
  Field('supplier','reference supplier'),
 Field('seriesname'),
 Field('seriesdescription'))
 db.series.supplier.requires = IS_IN_DB(db,db.supplier.id,'%(**
 suppliername)s')

 db.define_table('product',
 Field('series', 'reference series'),
 Field('supplier', 'reference series',compute=lambda row: 
 db.series(row.series).**supplier),
 Field('supptile', 'reference supplier',compute=lambda row: 
 db.series(row.series).**supplier),
 Field('tilename'))
 db.product.series.requires = 
 IS_EMPTY_OR(IS_IN_DB(db,db.**series.idhttp://db.series.id
 ,'%(seriesname)s'))

 I want to concatenate/compute db.product.supptile with 
 db.product.tilename ..Is is possible?? .




 On Thursday, July 11, 2013 11:50:07 AM UTC-7, Anthony wrote:

 Oops, sorry, I read that wrong -- thought it was a represent 
 function rather than a compute function. Yes, not sure you want to 
 store 
 a value other than the db.series.id value in a reference field for 
 db.series.

 Anthony

 On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:

 But in this case you don't have the id of the referenced record as 
 relation key... I am not sure it's what you want. But you question is 
 really vague so difficult to answer correctly to your I think :P

 Richard


 On Thu, Jul 11, 2013 at 2:21 PM, Anthony abas...@gmail.com wrote:

 On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:

 I think I saw some light in here!  this did the trick for me:

 Field('supplier', 'reference supplier',compute=lambda row: db.
 series(row.series).supplier**),


 Should be the same as:

 lambda row: row.series.supplier

 assuming row.series is a reference field referring to db.series.

 Anthony

  -- 
  
 --- 
 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/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
  
 --- 
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
  
 --- 
 You received 

[web2py] Is it possible to concatenate fileds in a grid??

2013-07-10 Thread greenpoise
Is it possible to concatenate fileds in a grid??

-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-10 Thread Richard Vézina
If you pass to grid a select I think yes...

Richard


On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel.sega...@gmail.com wrote:

 Is it possible to concatenate fileds in a grid??

 --

 ---
 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/groups/opt_out.




-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-10 Thread Richard Vézina
Here you can get more clue about what I mean :

https://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs


On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 If you pass to grid a select I think yes...

 Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel.sega...@gmail.comwrote:

 Is it possible to concatenate fileds in a grid??

 --

 ---
 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/groups/opt_out.






-- 

--- 
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/groups/opt_out.




Re: [web2py] Is it possible to concatenate fileds in a grid??

2013-07-10 Thread greenpoise
read it. Dont have a clue yet.. If I use represent, the values wont show up 
in a csv export...sort of looking for alternatives now. Thanks




On Wednesday, July 10, 2013 1:30:41 PM UTC-7, Richard wrote:

 Here you can get more clue about what I mean :

 https://groups.google.com/forum/#!topic/web2py/wUBbAzFHbxs
  

 On Wed, Jul 10, 2013 at 4:27 PM, Richard Vézina 
 ml.richa...@gmail.comjavascript:
  wrote:

 If you pass to grid a select I think yes...

 Richard


 On Wed, Jul 10, 2013 at 4:21 PM, greenpoise danel@gmail.comjavascript:
  wrote:

 Is it possible to concatenate fileds in a grid??

 -- 
  
 --- 
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  





-- 

--- 
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/groups/opt_out.




[web2py] Re: Not possible to import reportlab.platypus.doctemplate?

2013-05-06 Thread Fabian Bühler
Thanks a lot Alan. I will check this!

Am Freitag, 3. Mai 2013 03:25:38 UTC+2 schrieb Alan Etkin:

 so after web2py update my pdf generator with reportlab is not working 
 anymore. So after a long research i dont have any idea how to fix it. 
 Is it possible to get it running again? Thanks a lot!


 Looks like you are running a windows binary version of web2py which ships 
 with its own Python interpreter, and so it cannot detect packages installed 
 for another Python installation. Make sure your libraries are installed as 
 described here by Anthony:


 stackoverflow.com/questions/8131279/install-python-module-in-local-install-of-web2py



-- 

--- 
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/groups/opt_out.




[web2py] Re: Not possible to import reportlab.platypus.doctemplate?

2013-05-06 Thread Fabian Bühler
I was running web2py on pythonanywhere.com. It was working with the old 
version.
So the solution was to insert the source code manually into the Apps Module 
folder. Source link: 
http://www.reportlab.com/software/opensource/rl-toolkit/download/
Thanks a lot!

Am Montag, 6. Mai 2013 18:57:25 UTC+2 schrieb Fabian Bühler:

 Thanks a lot Alan. I will check this!

 Am Freitag, 3. Mai 2013 03:25:38 UTC+2 schrieb Alan Etkin:

 so after web2py update my pdf generator with reportlab is not working 
 anymore. So after a long research i dont have any idea how to fix it. 
 Is it possible to get it running again? Thanks a lot!


 Looks like you are running a windows binary version of web2py which ships 
 with its own Python interpreter, and so it cannot detect packages installed 
 for another Python installation. Make sure your libraries are installed as 
 described here by Anthony:


 stackoverflow.com/questions/8131279/install-python-module-in-local-install-of-web2py



-- 

--- 
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/groups/opt_out.




[web2py] Re: Not possible to import reportlab.platypus.doctemplate?

2013-05-02 Thread Alan Etkin


 so after web2py update my pdf generator with reportlab is not working 
 anymore. So after a long research i dont have any idea how to fix it. 
 Is it possible to get it running again? Thanks a lot!


Looks like you are running a windows binary version of web2py which ships 
with its own Python interpreter, and so it cannot detect packages installed 
for another Python installation. Make sure your libraries are installed as 
described here by Anthony:

stackoverflow.com/questions/8131279/install-python-module-in-local-install-of-web2py

-- 

--- 
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/groups/opt_out.




[web2py] is it possible to add an autocomplete widget to the rows of an SQLFORM.grid?

2013-04-29 Thread Tim Richardson
I want to use SQLFORM.grid to show rows of data from one table, and to 
conveniently allow the user to quickly select a foreign key. The foreign 
key is a reference field, so it works with a click to edit the row which 
then opens the detail view. 
I was hoping to allow an in-line edit. I think I can work out the ajax 
required to update the database after a change is made, but is there a lazy 
way of getting an inline autocomplete widget? 

-- 

--- 
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/groups/opt_out.




[web2py] Is it possible to use grid style search to filter records before handing off to another function?

2013-03-30 Thread Jake Lowen
I like the way that SQLFORM.grid search works. Once I've searched for 
records and come up with the set I want, How can I pass that set off to 
another function to do work just on those filtered records?   Or in other 
words.. if I have 100 records, and I use the grid search to narrow it down 
to 15... how can I pass just those 15 records to another controller 
function?

Is it possible to get at the matching records in the grid as is or do I 
need to build another search tool?

Thanks!

-- 

--- 
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/groups/opt_out.




[web2py] Is it possible to generate a file containing the update for book 4th to 5th?

2013-03-13 Thread david xiao
Just wondering, if it's possible, i think i will be helpful to know the new 
features.

-- 

--- 
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/groups/opt_out.




  1   2   3   >