[web2py] Re: Is there a way to donate money to web2py

2018-02-01 Thread Ntogg
baka 

On Thursday, February 1, 2018 at 5:35:55 AM UTC+8, Dragan Matic wrote:
>
>
> It would be nice if web2py had a patreon page or something similar. I see 
> that similar questions have been asked before and I know that there was a 
> 'send bitcoins' link but most of us still pay online with credit cards or 
> paypal. If web2py had a patreon page people could just send a predefined 
> amount monthly. 
>

-- 
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: appadmin.py interpret represent differently than default.py, causing keyError or attributeError

2018-02-01 Thread Yi Liu
I figured a work around:

```
if request.controller == 'default':
ctID = ctID.t_trial.f_ctid
else:
ctID = ctID.f_ctid
```

It would be nice to fix from the source.

On Thursday, February 1, 2018 at 6:39:37 PM UTC-8, Yi Liu wrote:
>
> Dear all,
>
> I have a field with custom represent:
> ```
> Field('f_lastupdate', type='string',
>   label=T('Last Update'), represent=lambda value, row: 
> lastUpdateDateFormat(value, row['t_trial']['f_ctid'])),
> ```
>
> It is fine in the application (default.py), but not in appadmin when i 
> admin the table.
>
> If i change row['t_trial']['f_ctid'] to row['f_ctid'], appadmin works but 
> the application throws similar error. It seems appadmin.py interpret the 
> lambda function differently than default.py, causing keyerror or 
> attributeerror
>
> Am I missing something? 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] appadmin.py interpret represent differently than default.py, causing keyError or attributeError

2018-02-01 Thread Yi Liu
Dear all,

I have a field with custom represent:
```
Field('f_lastupdate', type='string',
  label=T('Last Update'), represent=lambda value, row: 
lastUpdateDateFormat(value, row['t_trial']['f_ctid'])),
```

It is fine in the application (default.py), but not in appadmin when i 
admin the table.

If i change row['t_trial']['f_ctid'] to row['f_ctid'], appadmin works but 
the application throws similar error. It seems appadmin.py interpret the 
lambda function differently than default.py, causing keyerror or 
attributeerror

Am I missing something? 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] Change style of the view sqlform.grid

2018-02-01 Thread Tu Duong
How to change the style for the "view details" page of sqlform.grid. For 
now, it's very "blank"

Id

1
First Name
Tony
Age
23

I want at least the title is in bold, and both value and title in the same 
row.

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] Re: session var in table decimal field throws error on postgres

2018-02-01 Thread Anthony
On Thursday, February 1, 2018 at 4:53:59 PM UTC-5, Jordan Ladora wrote:
>
> Hi Anthony,
>
> Thanks again for this. I had dozens of vars that were needlessly declared 
> as session vars. 
>
> I was wondering how to make global vars declared in a model accessible 
> from a compiled module (that is placed in the modules folder and imported 
> when needed by models and controllers)? e.g. from your example above, how 
> could a compiled module access the DECPLACES global variable?
>

There are  a couple options. First, you could put those constants 
themselves in a module instead of a model file, and then import them into 
models, modules, controllers, etc. Alternatively, in your module, you can 
do something like:

from gluon import current

def some_function():
decplaces = current.globalenv['DECPLACES'] # This goes inside a 
function, not at the top level of the module.
...

current.globalenv is a dictionary of the web2py global environment.

I would probably take the first approach.

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] API for database sequence?

2018-02-01 Thread David Orme
Hi,

I've got a table where I want to group related rows with a unique id. I 
could use something like:

next_val = db.table.unique_id.max() + 1

But that does not seem safe against updates happening at almost the same 
time (I might be being paranoid). I could also use:

next_val = uuid.uuid4

But that seems like overkill - and an ugly thing to pass as a variable to a 
URL. So, the most obvious solution is to use a DB sequence (I'm using 
postgres, if it matters). That way I can grab the next value from the 
sequence, be sure I'm always getting a unique value and I've got simple 
integers. I can always create the sequence manually on the backend and then 
use:

next_val = db.executesql("select nextval('unique_id_seq');")

But is there an elegant way to do this within pydal? It would be nice to 
define the sequence in the model in the same way that tables are defined.

Thanks,
David

-- 
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: session var in table decimal field throws error on postgres

2018-02-01 Thread Jordan Ladora
Hi Anthony,

Thanks again for this. I had dozens of vars that were needlessly declared
as session vars.

I was wondering how to make global vars declared in a model accessible from
a compiled module (that is placed in the modules folder and imported when
needed by models and controllers)? e.g. from your example above, how could
a compiled module access the DECPLACES global variable?

Cheers,
j



On Fri, Dec 29, 2017 at 4:14 PM, Anthony  wrote:

> On Friday, December 29, 2017 at 12:38:24 PM UTC-5, Jordan Ladora wrote:
>>
>> Brilliant - thank you very much for the thoughtful reply.
>>
>> I actually set it as a session var bc there are several tables with a
>> decimal field that I want to be consistent with each other,
>>
>
> Note, the session is unique per user, so it doesn't make sense to store a
> global value in the session, as you are unnecessarily storing a separate
> copy of it for each user. Instead, just create a constant somewhere in a
> model file and use that in your table definitions:
>
> DECPLACES = 7
>
> Or if the only place you need that constant is in defining decimal fields,
> just store the entire field type as a constant:
>
> DECFIELD = 'decimal(100, 7)'
>
> Then in your table definitions:
>
> db.define_table(..., Field('myfield', DECFIELD, ...))
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/WDUqTculX1Q/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] POST api return 405

2018-02-01 Thread Marco Mansilla
What's the responde of Chrome Dev tools or firebug?, Could you show usted
the API definition?.

As César says, we need some code to provide an accurate solution proposal

El 1 feb. 2018 16:04, "yogeshwar khalkar" 
escribió:

> I have POST api in web2py I am accessing it using angular httpclient post
> service but, it returns 405(method not allow) error.
>
> can anybody give me solution for it
>
> 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.
>

-- 
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] POST api return 405

2018-02-01 Thread Carlos Cesar Caballero Díaz
Hi, is a little difficult to get an idea of the issue without some code 
to reproduce it.


Greetings.


El 01/02/18 a las 14:04, yogeshwar khalkar escribió:
I have POST api in web2py I am accessing it using angular httpclient 
post service but, it returns 405(method not allow) error.


can anybody give me solution for it

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.


--
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] POST api return 405

2018-02-01 Thread yogeshwar khalkar
I have POST api in web2py I am accessing it using angular httpclient post 
service but, it returns 405(method not allow) error.

can anybody give me solution for it

Thanks

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


[web2py] Re: web2py and 3rd Python script

2018-02-01 Thread Jim S
You could setup the scheduler to run your time consuming back-end tasks.

http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler

Then just send an email to the user when it is done.

You can place your 3rd party code in the modules folder or just install as 
a regular Python package.

-Jim


On Thursday, February 1, 2018 at 7:01:02 AM UTC-6, Gregorio Bueno wrote:
>
> Hi Web2py team,
>
> I have a Python script where users enter some information, the code will 
> process it and return the results. The script code is a little big, with 
> many imports and runs on few servers with RPyC. I have to start the script 
> via command line, enter the input information and wait for the results. 
> Until now, it is working fine.
>
>
> The next step is to develop a Web Server where users will access it, enter 
> the inputs information on a HTML page, and after that, they will have the 
> results printed on screen.
>
> My doubt is how can I pass the variables entered by user to a third 
> script. Searching for it, I found that I can run a third code under Modules 
> folder and import it on controllers. Some forums says to use local_import 
> (due to some limitations), but according with The Book, it must be a normal 
> import.
>
> Could someone please help me to find the best way for Web2py to send a 
> variable and trigger a 3rd code, and also, how Web2py can wait for the 
> results (it can last up to 1 minute)?
>
>
> Thank you very much.
>

-- 
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] Script to create models from legacy PostgreSQL tables

2018-02-01 Thread Johann Spies
I have written a script which I use to create models for an existing database.

Maybe it will be useful for others.

Comments are welcome.

https://github.com/johannspies/pg_to_web2py_model

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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


[web2py] web2py and 3rd Python script

2018-02-01 Thread Gregorio Bueno
Hi Web2py team,

I have a Python script where users enter some information, the code will 
process it and return the results. The script code is a little big, with 
many imports and runs on few servers with RPyC. I have to start the script 
via command line, enter the input information and wait for the results. 
Until now, it is working fine.


The next step is to develop a Web Server where users will access it, enter 
the inputs information on a HTML page, and after that, they will have the 
results printed on screen.

My doubt is how can I pass the variables entered by user to a third script. 
Searching for it, I found that I can run a third code under Modules folder 
and import it on controllers. Some forums says to use local_import (due to 
some limitations), but according with The Book, it must be a normal import.

Could someone please help me to find the best way for Web2py to send a 
variable and trigger a 3rd code, and also, how Web2py can wait for the 
results (it can last up to 1 minute)?


Thank you very much.

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