Re: [web2py] Web2py / Pydal Time Fields

2015-11-10 Thread Mark Graves
I ended up converting to Decimal and then working from there.

On Tue, Nov 10, 2015 at 1:18 AM, Manuele Pesenti 
wrote:

> Il 05/11/15 06:53, Mark Graves ha scritto:
> > Hey everyone,
> >
> > I find myself in the need for microsecond level precision for time
> > fields where I am querying over those fields regularly.
> >
> > As I dug into pydal and web2py's internals, I noticed that it seems to
> > be convention that times are truncated to H:M:S
> >
> > I'm aware I can easily store as a string and coerce or define a custom
> > field type or store as a datetime for the required precision.
> >
> > I'm finding that rather cumbersome.
> >
> > Am I missing something or would this be the best way to approach this?
> >
> > -Mark
> I was interested to read some answers to this question too... I would
> try to save the micro-seconds part of your datetime in a different column
> Let me know if this approach can fit to your needs.
>
> Best regards
>
> Manuele
>
> --
> 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/Iaklk67GzIw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: Admin plus plugin github page not found

2015-11-10 Thread Alessio Varalta
There also many problem in http://www.web2pyslices.com/..many plugin don't 
have the online demo and this is danger because the user can't work on a 
plugin for example 30 minutes only for see if is a good plugin or not

On Saturday, 7 November 2015 11:51:00 UTC+1, Alessio Varalta wrote:
>
> Hi, I see this plugin Admin plus 
> http://www.web2pyslices.com/slice/show/1937/admin-plus that is also on 
> download plugin of web2py but in both case there isn't a correct download. 
> Where I can find this plugin?
>

-- 
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 set the default value +1 on insert

2015-11-10 Thread Bart van Berkel
Hello web2py freaks,

In my first try to make an application with web2py i have a little struggle 
how to accomplish as what is would like to see.
In db1.py i created a field like this:

db.define_table('jobticket',
Field('ticket', 'integer', default = +1) # ticket needs to 
be ticket +1 when inserted
   )

I need to have something called "ticket" what represent a number where my 
other tables are linked to.

I know that the default id is auto increment, and i can reference it, so 
that's not the point. 

The ticket is a number what i needs to be set like : 15001. And that 
needs to be inserted +1 if there is a new job.
15 is a year, the rest is just a number.

So, i have 2 problems:
- if there is a new year like 1 january 2016, the first two numbers 
needs to be changed from 15 to 16?
- And how can i  get the max number out of the database and insert that 
with a new value( +1)

Does anybody have a good insperation or an good idea to get me on the right 
track?

Many thanks.

Bart




-- 
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] Web2py / Pydal Time Fields

2015-11-10 Thread Manuele Pesenti
Il 10/11/15 10:39, Mark Graves ha scritto:
> I ended up converting to Decimal and then working from there.
ok, not so far from my approach... you don't need to manage timezone I
guess.

Cheers

M.

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


Re: [web2py] Web2py / Pydal Time Fields

2015-11-10 Thread Mark Graves
No, thankfully everything was done in one timezone =)

On Tue, Nov 10, 2015 at 8:53 AM, Manuele Pesenti 
wrote:

> Il 10/11/15 10:39, Mark Graves ha scritto:
> > I ended up converting to Decimal and then working from there.
> ok, not so far from my approach... you don't need to manage timezone I
> guess.
>
> Cheers
>
> M.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/Iaklk67GzIw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: REST service POST responses

2015-11-10 Thread Gary Cowell
Thanks for your help, I got the GET and POST methods working. 

PUT for updating and DELETE don't seem to work though.

I changed my API on your suggestion to wrap dict() around the DAL calls:

@request.restful()
def secapi():
response.view = 'generic.'+request.extension
print "args ",request.args
print "vars ",request.vars
#pprint.pprint(request, indent=4)
def GET(*args,**vars):
patterns = 'auto'
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
def POST(table_name,**vars):
return dict(db[table_name].validate_and_insert(**vars))
def PUT(table_name,record_id,**vars):
return dict(db(db[table_name]._id==record_id).update(**vars))
def DELETE(table_name,record_id):
return dict(db(db[table_name]._id==record_id).delete())
return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)


But, I see this:

curl -X GET http://localhost:8007/apitest/default/secapi/secrets/id/21.json

{"content": [{"datavalue": "othertest", "id": 21}]}

Can do my get, then I try:

curl -X PUT -d "datavalue=updated" http:
//localhost:8007/apitest/default/secapi/secrets/id/21
invalid arguments

I see "invalid arguments" and the row is not updated:


curl -X GET http://localhost:8007/apitest/default/secapi/secrets/id/21.json

{"content": [{"datavalue": "othertest", "id": 21}]}


Is my use of curl incorrect, or is the api function for PUT coded 
incorrectly?

Sorry if it's a simple thing 

Thanks





On Monday, 9 November 2015 17:34:27 UTC, Anthony wrote:
>
> The book is incorrect. If you want to rely on the generic.json view to 
> generate the JSON response, then you must return a dictionary (otherwise, 
> no view will be called, and whatever you return will be returned directly). 
> In this case, the .validate_and_insert method returns a DAL Row object (not 
> a database record, just a Row object that contains "error" and "id" keys). 
> Apparently, when you return a Row object, the response body ends up being 
> just a concatenation of its keys, so in this case, we get "errorid" as the 
> response.
>
> You have a few options:
>
> 1. Put the result in a dictionary:
>
> return dict(result=db[table_name].validate_and_insert(**vars))
>
> 2. Convert the Row object itself to a dictionary:
>
> return db[table_name].validate_and_insert(**vars).as_dict()
>
> 3. Return JSON directly:
>
> from gluon.serializers import json
> return json(db[table_name].validate_and_insert(**vars))
>
> Anthony
>
> On Monday, November 9, 2015 at 10:50:21 AM UTC-5, Gary Cowell wrote:
>>
>> Lookint at providing simple REST API to database tables through web2py. I 
>> used this example from the book:
>> @request.restful()
>> def secapi():
>> response.view = 'generic.'+request.extension
>> def GET(*args,**vars):
>> patterns = 'auto'
>> parser = db.parse_as_rest(patterns,args,vars)
>> if parser.status == 200:
>> return dict(content=parser.response)
>> else:
>> raise HTTP(parser.status,parser.error)
>> def POST(table_name,**vars):
>> return db[table_name].validate_and_insert(**vars)
>> def PUT(table_name,record_id,**vars):
>> return db(db[table_name]._id==record_id).update(**vars)
>> def DELETE(table_name,record_id):
>> return db(db[table_name]._id==record_id).delete()
>> return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>>
>>
>> Now the GET methods work, I can get json responses with curl:
>>
>> curl http://localhost:8007/apitest/default/secapi/secrets.json
>> {"content": [{"datavalue": "foobar", "id": 1}, ... ]}
>>
>>
>> When I POST though:
>>
>> $ curl --data "datavalue=sometest" http:
>> //localhost:8007/apitest/default/secapi/secrets.json
>>
>> I get the response:
>>
>> errorsid
>>
>> When I really want the resource URL of the created thing.
>>
>> It did actually create the row:
>>
>> curl http://localhost:8007/apitest/default/secapi/secrets/id/20.json
>> {"content": [{"datavalue": "sometest", "id": 20}]}
>>
>> So my question  is, how do I code the POST such that it returns the 
>> resource URL that was created?  
>>
>> 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] Routes problem?

2015-11-10 Thread Gael Princivalle
Hello all.

All applications in the same web2py installation works fine.
https://mydomain.com/myapp1
https://mydomain.com/myapp2
https://mydomain.com/myapp3

But now I don't know why all new apps goes on the welcome app.
For app "myapp4" instead of
https://mydomain.com/myapp4
I have:
https://mydomain.com/welcome

In the routes.py file I have only domains:
routers = dict(
BASE = dict(
domains = {
"www.mydomain1.com" : "myapp1",
"www.mydomain2.com" : "myapp2",
"www.mydomain3.com" : "myapp3",
"www.mydomain4.com" : "myapp4",
}
),
)

And also www.mydomain4.com display the welcome app instead of the myapp4 
app.

Someone knows why, or how can I make the debug?

Thanks, regards.



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


[web2py] Re: Routes problem?

2015-11-10 Thread Bart van Berkel
Dit you also press the button reload routes after the change?

-- 
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: Routes problem?

2015-11-10 Thread Gael Princivalle
I don't know why but this button have never works in my both web2py 
installations. I restart the server for reloading the routes.py file. And 
yes I've done it.

Il giorno martedì 10 novembre 2015 16:45:53 UTC+1, Bart van Berkel ha 
scritto:
>
> Dit you also press the button reload routes after the change?
>

-- 
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: Field set the default value +1 on insert

2015-11-10 Thread Niphlod
if you want to have a number that strictly:

- is incremental (no gaps, always sequential, etc)
- the first two digits are the year

I'd suggest to have a "last_tickets" table  (year(int) , ticket_no(int))

 holding the current ticket.

then, you can use _before_insert callback on the "tickets" table to:

- fetch the last ticket_no for the current year
- compute the next integer, update last ticket_no
- use the computed value in the ticket_no of the "tickets" table

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


[web2py] Re: REST service POST responses

2015-11-10 Thread Anthony


> def POST(table_name,**vars):
> return dict(db[table_name].validate_and_insert(**vars))
>

Just to be more explicit (and not so dependent on the magic in the 
generic.json view), I would instead recommend:

db[table_name].validate_and_insert(**vars).as_dict()


def PUT(table_name,record_id,**vars):
> return dict(db(db[table_name]._id==record_id).update(**vars))
> def DELETE(table_name,record_id):
> return dict(db(db[table_name]._id==record_id).delete())
> return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>
> Can do my get, then I try:
>
> curl -X PUT -d "datavalue=updated" http:
> //localhost:8007/apitest/default/secapi/secrets/id/21
> invalid arguments
>

Note, your PUT and DELETE functions take table_name and record_id 
positional arguments, yet you have passed "secrets", "id", and "21" as 
positional arguments (via URL args). There is no need for the "id" URL arg 
with these two methods. The "id" arg is used with the GET request because 
that method is relying on the more generalized parse_as_rest functionality, 
which matches patterns and allows you to specify a field name in addition 
to a table name. Just change your URL to:

http://localhost:8007/apitest/default/secapi/secrets/21

If you want the GET function to be more consistent (and limit it to 
filtering by id), then you could exclude "id" from the GET URLs and instead 
insert "id" into the args list before passing args to parse_as_rest.

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] Scheduler not reassigning task after restart

2015-11-10 Thread Benson Myrtil
I am running on a windows server 2008. I have nssm setup which manages my 4 
worker nodes. The workers appear to be working correctly in the sense that 
the heartbeat is consistently updating. However, the tasks are stuck in the 
QUEUE status assigned to old worker nodes that do not exist.

Is there a way to force the scheduler to update the assignments every so 
often or at least to check to make sure they are assigned to 'living' 
workers?

-- 
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: Grabbing form data from one page to another and saving it to excel file

2015-11-10 Thread aetagothno
Thank you, that makes much more sense. I really appreciate it!
Also, in regards to the redirect..are you suggesting I may not want to do 
that for this application?
Because I was intending on making that a confirmation page with the 
submitted information, I thought redirect would be the best for that?



On Friday, November 6, 2015 at 9:32:08 PM UTC-5, Anthony wrote:
>
>
> def about():
>> import sys
>> form = SQLFORM(db.excelform)
>> from openpyxl import load_workbook
>> wb = load_workbook(filename='filepath/excel.xlsx')
>> sheet_ranges = wb['Sheet1']
>> sheet_ranges['C4'] = form.vars.last_name
>>
>
> Close. Recall that you saved the submitted form data from the previous 
> request in session.vars -- so that's where you will find those values:
>
> sheet_ranges['C4'] = session.vars.last_name
>
> form = SQLFORM(db.excelform) is therefore unnecessary. With this line, 
> you are simply creating a fresh form object -- it doesn't know anything 
> about the form object you had created in the previous request to the 
> excelform function. Note that each request is independent of other 
> requests, with the models, controllers, and views executed in a new 
> environment. You save state from one request to the next via the session, 
> cache, files, or the database.
>
> Also, to be clear, when you call redirect(), that results in a new HTTP 
> request -- it sends a 303 response back to the browser, which instructs the 
> browser to make a new request to the redirect URL.
>
> 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] stepofweb theme layouts?

2015-11-10 Thread pumplerod
I'm coming over from PHP where I was using the "Smarty" theme template from 
stepofweb .

I'd like to build this into my web2py site.  

Has someone already done this? Or is there a best practice for 
implementation?  For example, should I try and create a "layout plugin" to 
accomplish this?


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


[web2py] Re: Oracle perfomance issues with version 2.12.3

2015-11-10 Thread 'tomt' via web2py-users
Thanks for the suggestion.  I started a web2py session from the command 
line, and ran a simple DAL select from there.

python web2py.py -M -S myapplication

result = 
db2(db2.soe_tdb.pointnumber>0).select(db2.soe_tdb.ALL,limitby=(0,10))

print db2._timings

[("ALTER SESSION SET NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'", 
0.001035928726196289), ("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 
'-MM-DD HH24:MI:SS'", 0.0008900165557861328), ('SELECT soe_tdb.utctime, 
soe_tdb.miliseconds, soe_tdb.pointnumber, soe_tdb.pointname, 
soe_tdb.stationname, soe_tdb.statenumber, soe_tdb.statename, 
soe_tdb.groupname, soe_tdb.tv_sec, soe_tdb.tv_usec, soe_tdb.confirmed FROM 
(SELECT w_tmp.*, ROWNUM w_row FROM (SELECT soe_tdb.utctime, 
soe_tdb.miliseconds, soe_tdb.pointnumber, soe_tdb.pointname, 
soe_tdb.stationname, soe_tdb.statenumber, soe_tdb.statename, 
soe_tdb.groupname, soe_tdb.tv_sec, soe_tdb.tv_usec, soe_tdb.confirmed FROM 
soe_tdb WHERE (soe_tdb.pointnumber > 0) ORDER BY soe_tdb.utctime) w_tmp 
WHERE ROWNUM<=10) soe_tdb WHERE (soe_tdb.pointnumber > 0) AND w_row > 0 
ORDER BY soe_tdb.utctime', 59.642492055892944)]

The select took about a minute whether I used web2py version 2.9.5, 2.11.2 
or 2.12.3.  This does suggest that something changed to SQLFORM.grid 
between 2.11 and 2.12.  I'll dig a little deeper by trying some variations 
on my use of SQLFORM.grid.

Thanks, - Tom 


On Tuesday, November 10, 2015 at 12:30:55 AM UTC-6, Paolo Valleri wrote:

> Hi,
> there should be something wrong going on.
> As a first step, I'd write a simple query (i.e., select(db.table.ALL, 
> limit=(0,10)) using pydal (the database abstraction layer used in web2py) 
> and try to find out in which version has been introduced this performance 
> issue. If you don't find a performance issue on pydal, then there should be 
> something in the SQLFORM.grid part.
>
>  Paolo
>
> On Sunday, November 8, 2015 at 6:16:31 AM UTC+1, tomt wrote:
>>
>> Hi,
>>
>> I encountered really slow responses when I was using my web2py app to 
>> access an oracle database.  I tried to use dbstats in response.toolbar to 
>> measure this, but it wouldn't show the sql or any timing information.  I 
>> decided to try downgrading to an older web2py version, 2.11.2, and noticed 
>> a dramatic change.
>>
>> web2py 2.11.2   query took 4 seconds
>> web2py 2.12.3   query took > 2 minutes
>>
>> I've tried this several times, with the same result. Were there any 
>> changes in web2py that could account for this?
>>
>> The query I am running was passed to sqlform.grid
>>
>> soequery = ( (db2.soe_tdb.utctime > fromdate)&\
>>  (db2.soe_tdb.utctime < todate)&\
>>  (db2.soe_tdb.stationname.belongs(stationlist))&\
>>  (db2.soe_tdb.pointnumber == db2.statuspoint.pointnumber)&\
>>  (db2.statuspoint.pointaccessarea == 
>> db2.accessareaassignment.setnumber)&\
>>  (db2.accessareaassignment.referencename == 'SOE')&\
>>  ~(db2.statuspoint.pointname.like('%@%')) )
>>
>> orderby = [db2.soe_tdb.utctime]
>>
>> grid=SQLFORM.grid(
>> query=soequery,
>> deletable=False,editable=False,details=False,
>> searchable=True,fields=fields,headers=headers,
>> paginate=10,csv=False,maxtextlengths=maxtextlengths,
>> orderby=orderby,
>> )
>>
>> Please let me know if there is any other information that I could provide 
>> to try to resolve this.
>>
>> Thanks in advance, - Tom
>>
>

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


[web2py] sqlform.grid csv export set delimiter

2015-11-10 Thread Yebach
Hello

Is it possible to set the delimiter (tab delimited) for csv export from 
SQLform.grid?

also if I want to export some rows but do not want to show them in grid, 
what is the syntax to use (I want to hide a column db.workers.id, but i 
want to export it)?

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] Re: sqlform.grid csv export set delimiter

2015-11-10 Thread Anthony
I think you want the tsv_with_hidden_cols option:

http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=tsv_with_hidden_cols

See the surrounding documentation for details on how to control/customize 
the download options (if you don't see an option that suits your needs, you 
can create your own export class, using the existing ones as examples).

Anthony

On Tuesday, November 10, 2015 at 10:41:23 PM UTC-5, Yebach wrote:
>
> Hello
>
> Is it possible to set the delimiter (tab delimited) for csv export from 
> SQLform.grid?
>
> also if I want to export some rows but do not want to show them in grid, 
> what is the syntax to use (I want to hide a column db.workers.id, but i 
> want to export it)?
>
> 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] blocking all access but america

2015-11-10 Thread lucas
hey everyone,

what if i wanted to block all users except those originating from one 
country, say america.  i know i can download a IP file of all america IP 
addresses and have iptables deny all others.  but how about a web2py 
method.  any ideas, not necessarily IP based?

thanx in advance, lucas

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


[web2py] TypeError: an integer is required

2015-11-10 Thread Anthony Smith
Hi, 
I am using the follow to highlight a date field where the date is greater 
then the current date.

db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
SPAN(datetime.date(v),_class='withhold' if v >datetime.date.today() else None)
db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
SPAN(datetime.date(v),_class='withhold' if v and v> datetime.date.today() else 
None)

Traceback (most recent call last):
  File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
, line 
562, in 
  File "applications/cps5c/modules/plugin_sqleditable/editable.py", line 415, 
in extract
r=func()
  File "/home/tony/web2py/gluon/tools.py", line 3774, in f
return action(*a, **b)
  File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
, line 
268, in stock_tasks
db.stock_task.created_by,
  File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
nvalue = field.represent(value, row)
  File "/home/tony/web2py/applications/cps5c/models/db1.py" 
, line 144, in 

db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
SPAN(datetime.date (v),_class='withhold' if v > datetime.date.today() else None)
TypeError: an integer is required


if I use the following works fine.
db.stock_task.withhold_until_date.represent = lambda v, row: 
SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today() else 
None)

any help appreciated

cheers

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