[web2py] Tidy html output?

2014-04-28 Thread Robin Manoli
Hey!

I'm wondering if there is a way to make the html output beautifully 
indented and more easily readable?

-- 
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: API Rest authenticatio

2014-04-28 Thread Leonel Câmara
How do you save API authentication credentials on a phonegap application? 
How do you prevent people from stealing them?

-- 
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] How to redirect an error ticket response to the current url

2014-04-28 Thread aleonserra
Hi.

Im trying to display the error ticket caused by a controller "without 
changing the current url" on my browser, also in the same browser tab of 
course.

Im using Live Reload to display the changes to my pages and its quite 
annoying to manually refreshing the browser each time i have an error on 
the controller.

This is my routers.py at web2py folder:

routers = dict(
BASE=dict(
default_application='test',
),
test=dict(
default_controller = 'index',
default_function = 'index'
),
)
error_message_ticket='''
  

  location.replace("/admin/default/ticket/%(ticket)s")


  '''

I grabed the error_message_ticket from Stack Overflow which allows me to 
display the ticket at the same browser tab but its not quite what im 
looking for, the url still changes.

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] how to select from result of query other select

2014-04-28 Thread DucVa
Hi all,
I want build a query that can select from result of query other select. 
Like example:

*SELECT **
*FROM(*
* SELECT  Contracts.ContractNo, CustomerList.CustomerId,*
* COUNT(customer_comment.customer_id) AS Quantity*
* FROM Contracts, customer_comment, CustomerList*
* WHERE (((customer_comment.del_flag = 0)*
* AND (customer_comment.customer_id = CustomerList.CustomerId))*
* AND (Contracts.CustomerId = CustomerList.CustomerId))*
* GROUP BY Contracts.ContractNo, CustomerList.CustomerId*
*) AS A*
*WHERE **Quantity **> 123*

Best Regard!

-- 
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: AttributeError: 'Table' object has no attribute 'db' in appadmin deleting db.auth_user entry

2014-04-28 Thread Dave S


On Monday, April 28, 2014 8:00:40 AM UTC-7, DenesL wrote:
>
> ** bump **
>
> No luck here in finding out what is wrong.
>

Are you using auth in its out-of-the-box configuration?

/dps
 

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


[web2py] query DAL

2014-04-28 Thread Brian M
Are you sure that your situation table doesn't have some more fields? Fernando 
has three entries in situation so how do you know which one is the "last" one? 
Are you just going to assume that the highest situation.id is the last one  or 
is there a timestamp in there or some sort of "active" flag? If you are going 
to go by highest situation.id you could probably do a sub query to get each 
person's highest situation.id and work from there. Not really sure that's the 
best design though.

Or if you are 100% sure that statuses will always proceed through the system in 
1 -> 2 -> 3 (or 4) order you could just select their max () situation.id_status 
but I doubt that is going to be the case.

If a person can have only one valid situation status at a time but you still 
need a history of past statuses could you use the DAL's record versioning 
feature?

-- 
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 conference, next week!

2014-04-28 Thread Simon Ashley
Wouldn't be adverse to canvassing the idea of a weekend get together 
somewhere along the east coast ...

On Saturday, 26 April 2014 19:47:21 UTC+10, Greg Vaughan wrote:
>
> Make the next one in Sydney (Australia) Massimo :)
>
> Just joking... all the best for it and looking forward to seeing the 
> videos...
>
> On Saturday, 26 April 2014 13:08:01 UTC+10, Massimo Di Pierro wrote:
>>
>> Please register only if you plan to attend in person. We will record the 
>> talks and post them.
>>
>> On Friday, 25 April 2014 16:29:28 UTC-5, David Rager wrote:
>>>
>>> Is there an online option (if you don't tick the "will attend in 
>>> person")?
>>>
>>> On Thursday, April 24, 2014 9:20:56 AM UTC-6, Massimo Di Pierro wrote:

 There is one more to the first web2py conference

 http://www.experts4solutions.com/web2py_conference

 We got a bigger room and we can take 10-15 more people. register now!

 Massimo

>>>

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


Re: [web2py] API Rest authenticatio

2014-04-28 Thread Dave S
On Saturday, April 26, 2014 7:20:02 AM UTC-7, Samuel Marks wrote:
>
> I'm a big RFC6749 fan
>
> Quite simple; and you can implement your own custom grant for e.g.: higher 
> security using x509 certificates.
>
>
Is there a handy link to a good discussion of that?

I was concerned by the arguments from

so I'm wondering how to improve on WRAP  (and hoping it's been done, and I 
just have to follow the recipe).

Not that I'm ready to provide a discoverable API, but I've already used up 
a few corners in painting myself into.

/dps

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


[web2py] GAE: Downloading uploaded images

2014-04-28 Thread St. Pirsch
Hi,
i am trying to find an efficient way to display images uploaded to GAE.
Currently, im using the download action:
* background-image: url({{=URL('download', 
args=line.contents.vorschaubild)}});*
Since there are a lot images to display, there should be a less power 
consuming way to get the image files.
Is it possible to let GAE directly serve the images, without the web2py 
download action, like it works for static files?
Or is it possible to cache the output of the download action?
Thanks for Your help.
Stephan

-- 
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: Take background images in OptionsWidget

2014-04-28 Thread Massimo Di Pierro
The best way is just to give it a class

SQLFORM 
.widgets.options.widget(field,
 value, _class="myclass" % field.image)

and then use JS (something like this):

jQuery(function(){
jQuery('.myclass option').each(function() { 
var image=jQuery(this).html()+'.png'
jQuery(this).css('background-image','url('+image+')');
   });
});


On Monday, 28 April 2014 14:02:55 UTC-5, raj...@gmail.com wrote:
>
> I have a tables
>
> db.define_table('provider',
> Field 
> ('name'),
> Field 
> ('image', type='upload'),
> format='%(name)s',)
>
>
> db.define_table('payment',
> Field 
> ('provider', 'reference 
> provider'),
>
> ...
>
>
> how i can use "SQLFORM
> .widgets.options.widget" 
>
> def index():
> db.payment.provider.widget = lambda field, value: \
> SQLFORM 
> .widgets.options.widget(field,
>  value, _style='background-image:url(%s);' % field.image)
>
>
> to get something like this
>
> 
>   Provider1
>   Provider2
>   Provider3
>  
>
> 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: s-cubism's plugin_jstree

2014-04-28 Thread Dave S


On Friday, April 25, 2014 3:49:53 PM UTC-7, Bushwood Gopher wrote:
>
> Has anybody used s-cubism's jstree 
> plugin? 
> It seems to work fine on their site, but when I try to use it in my web2py 
> application I keep getting the following:
>
>  unsupported type for timedelta seconds 
> component: NoneType
>
> Here is the traceback:
>
> Traceback (most recent call last):
>   File "/Applications/web2py/gluon/restricted.py", line 220, in restricted
> exec ccode in environment
>   File "/Applications/web2py/applications/test/models/db.py" 
> , line 45, in 
> 
> auth = Auth(db)
>   File "/Applications/web2py/gluon/tools.py", line 1194, in __init__
> delta = datetime.timedelta(days=0, seconds=auth.expiration)
> TypeError: unsupported type for timedelta seconds component: NoneType
>
>
> Any idea what this means? I'm running the following web2py on a mac:
>
>
The first observation to make is that you seem to be getting a value of 
None for auth.expiration, which results in timedelta seeing the Nonetype.

Did you make any changes to the auth table?  What sort of login process do 
you have?

/dps



 

> 2.9.5-stable+timestamp.2014.03.16.02.35.39
> (Running on Rocket 1.2.6, Python 2.7.5) 
>
> Regards,
> Eric
>

-- 
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: first() as aggregation function

2014-04-28 Thread Manuele Pesenti
Il 28/04/14 21:06, Niphlod ha scritto:
> seems to me that you should use windowing functions instead
>
> there's no need to introduce a new method you can use expression
> themselves in the select, and extract the field as usual
>
> myexpr = 'first_value(b_field) over (partition by a_field order by
> b_field)'
> rows = db2(db2.test_table.id > 0).select(myexpr, db2.test_table.a_field)
> for row in rows:
> print row.aa, row[myexpr]
uh! it sounds good :)
I'll surely try it

thanks a lot

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 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: first() as aggregation function

2014-04-28 Thread Carlos Costa
Jim, I thought that at first too. :)


2014-04-28 16:06 GMT-03:00 Niphlod :

> seems to me that you should use windowing functions instead
>
> there's no need to introduce a new method you can use expression
> themselves in the select, and extract the field as usual
>
> myexpr = 'first_value(b_field) over (partition by a_field order by
> b_field)'
> rows = db2(db2.test_table.id > 0).select(myexpr, db2.test_table.a_field)
> for row in rows:
> print row.aa, row[myexpr]
>
>
>
>
> On Monday, April 28, 2014 4:46:43 PM UTC+2, Manuele wrote:
>>
>> Il 28/04/14 16:05, Carlos Costa ha scritto:
>> > I think he is looking for the first record of each group, not the
>> > first record of the entire result.
>> > I think there is no such function in web2py yet.
>> >
>> > I have performed a similar task for reporting using this:
>> > https://docs.python.org/2/library/itertools.html#itertools.groupby
>> >
>> > It will require more computation and memory as you will have do it in
>> > memory but is possible and simple.
>> starting from the point I'm using postgresql (v. 9.3) I was thinking
>> about introducing a new method to the class Expression in dal defined as
>> follows:
>>
>> def array_agg(self):
>> db = self.db
>> return Expression(db, db._adapter.AGGREGATE, self, 'array_agg',
>> self.type)
>>
>> and get the first argument of the returned list.
>>
>> maybe this method can be introduced in the dal code but for the moment
>> Is there a way to locally "monkey patch" the Expression class for my
>> application?
>>
>> thank you
>> Cheers
>>
>> 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 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.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
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] URLising Links in Tables

2014-04-28 Thread Carlos Costa
Use represent and the tag A helper.

db.table_name.link_field.represent = lambda value, row: A(value,
_href=value)


2014-04-28 13:17 GMT-03:00 :

> Hi
>
> I've created a run-of-the-mill table:
>
> def index():
> grid = SQLFORM.grid(db.table_name, user_signature=False)
> return dict(grid=grid)
>
> One of the columns in the table is an actual link - how do I go about
> making this "clickable"?
>
> 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.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
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] Take background images in OptionsWidget

2014-04-28 Thread rajabiy
I have a tables

db.define_table('provider',
Field 
('name'),
Field 
('image', type='upload'),
format='%(name)s',)


db.define_table('payment',
Field 
('provider', 'reference 
provider'),

...


how i can use "SQLFORM .
widgets.options.widget" 

def index():
db.payment.provider.widget = lambda field, value: \
SQLFORM 
.widgets.options.widget(field,
 value, _style='background-image:url(%s);' % field.image)


to get something like this


  Provider1
  Provider2
  Provider3
 

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] Autocomplete and list:string

2014-04-28 Thread Miguel Andrés Moya Rojas
Hello! My issue is this: I want to use the autocomplete widget (
SQLFORM.widgets.autocomplete) but my field is a list:string, and now it 
shows all data in only one field, resulting in an awkward input. How can I 
use this widget with a list:string field? 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] URLising Links in Tables

2014-04-28 Thread jawbax
Hi

I've created a run-of-the-mill table:

def index():
grid = SQLFORM.grid(db.table_name, user_signature=False)
return dict(grid=grid)

One of the columns in the table is an actual link - how do I go about 
making this "clickable"?

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] query DAL

2014-04-28 Thread Fernando Vieira
Guys, I have a problem and can not solve, I'll describe it below 

I have three tables

##Person##   ##Status## 
##Situation##
--name----id--  --id----status--   
  --id_person--  --id_status--   
fernando  1   1   INICIADO 
  11 
ricardo 2   2  ADAMENTO 
  12 
evandro3   3  OK   
 13
manolo4   4 CANCELADO   
21

 24

I need to show the person's name and the last situation, using DAL
>> fernando - OK 
>> ricardo --- CANCELADO
>> evandro --  null
>> manolo --- null
---
with got the query, but id_situation field comes with the first record, and 
not the last

db(db.person).select(db.person.name, db.situation.id_status, 
left=db.situation.on((db.person.id 
==db.situation.id_person), 
distinct=db.person.name)

I figured out how to bring the last record >> db(db.situation.id_person == 
db.person.id ).select().as_list()[-1]['id_status']

Perhaps by combining the queries I would have the result, but I can not
--

If anyone can help me, I'll be grateful

-- 
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: first() as aggregation function

2014-04-28 Thread Niphlod
seems to me that you should use windowing functions instead

there's no need to introduce a new method you can use expression 
themselves in the select, and extract the field as usual

myexpr = 'first_value(b_field) over (partition by a_field order by b_field)'
rows = db2(db2.test_table.id > 0).select(myexpr, db2.test_table.a_field)
for row in rows:
print row.aa, row[myexpr]



On Monday, April 28, 2014 4:46:43 PM UTC+2, Manuele wrote:
>
> Il 28/04/14 16:05, Carlos Costa ha scritto: 
> > I think he is looking for the first record of each group, not the 
> > first record of the entire result. 
> > I think there is no such function in web2py yet. 
> > 
> > I have performed a similar task for reporting using this: 
> > https://docs.python.org/2/library/itertools.html#itertools.groupby 
> > 
> > It will require more computation and memory as you will have do it in 
> > memory but is possible and simple. 
> starting from the point I'm using postgresql (v. 9.3) I was thinking 
> about introducing a new method to the class Expression in dal defined as 
> follows: 
>
> def array_agg(self): 
> db = self.db 
> return Expression(db, db._adapter.AGGREGATE, self, 'array_agg', 
> self.type) 
>
> and get the first argument of the returned list. 
>
> maybe this method can be introduced in the dal code but for the moment 
> Is there a way to locally "monkey patch" the Expression class for my 
> application? 
>
> thank you 
> Cheers 
>
> 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 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: AttributeError: 'Table' object has no attribute 'db' in appadmin deleting db.auth_user entry

2014-04-28 Thread DenesL
** bump **

No luck here in finding out what is wrong.

-- 
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: first() as aggregation function

2014-04-28 Thread Manuele Pesenti
Il 28/04/14 16:05, Carlos Costa ha scritto:
> I think he is looking for the first record of each group, not the
> first record of the entire result.
> I think there is no such function in web2py yet.
>
> I have performed a similar task for reporting using this:
> https://docs.python.org/2/library/itertools.html#itertools.groupby
>
> It will require more computation and memory as you will have do it in
> memory but is possible and simple.
starting from the point I'm using postgresql (v. 9.3) I was thinking
about introducing a new method to the class Expression in dal defined as
follows:

def array_agg(self):
db = self.db
return Expression(db, db._adapter.AGGREGATE, self, 'array_agg',
self.type)

and get the first argument of the returned list.

maybe this method can be introduced in the dal code but for the moment
Is there a way to locally "monkey patch" the Expression class for my
application?

thank you
Cheers

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

2014-04-28 Thread Ruud Schroen
Web2Py seems to start, but everytime i load the page i get a ticket.

When i try to open the ticket it says:

admin disabled because unable to access password file

My routes.py is like this:

routes_in = (
('/socket.io/$anything', '/iochat/default/socketio/$anything'),
)


-- 
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: first() as aggregation function

2014-04-28 Thread Jim S
That's what I get for answering first thing on a Monday morning...

On Monday, April 28, 2014 9:05:04 AM UTC-5, yamandu wrote:
>
> I think he is looking for the first record of each group, not the first 
> record of the entire result.
> I think there is no such function in web2py yet.
>
> I have performed a similar task for reporting using this:
> https://docs.python.org/2/library/itertools.html#itertools.groupby
>
> It will require more computation and memory as you will have do it in 
> memory but is possible and simple.
>
>
> 2014-04-28 10:33 GMT-03:00 Jim S >:
>
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#first-and-last
>>
>> Is this what you were looking for?
>>
>> -Jim
>>
>> On Monday, April 28, 2014 7:20:15 AM UTC-5, Manuele wrote:
>>>
>>> Hi! 
>>> does exists or can be implemented an aggregation function that returns 
>>> the first element of a group instead of the sum, max, min or avg result? 
>>>
>>> Thank you... as usual :) 
>>>
>>> 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 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.
>>
>
>
>
> -- 
> Att.
>
> Carlos J. Costa
> Cientista da Computação
> Esp. Gestão em Telecom
>
> EL MELECH NEEMAN!
> אָמֵן
>
> 

-- 
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: first() as aggregation function

2014-04-28 Thread Carlos Costa
I think he is looking for the first record of each group, not the first
record of the entire result.
I think there is no such function in web2py yet.

I have performed a similar task for reporting using this:
https://docs.python.org/2/library/itertools.html#itertools.groupby

It will require more computation and memory as you will have do it in
memory but is possible and simple.


2014-04-28 10:33 GMT-03:00 Jim S :

>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#first-and-last
>
> Is this what you were looking for?
>
> -Jim
>
> On Monday, April 28, 2014 7:20:15 AM UTC-5, Manuele wrote:
>>
>> Hi!
>> does exists or can be implemented an aggregation function that returns
>> the first element of a group instead of the sum, max, min or avg result?
>>
>> Thank you... as usual :)
>>
>> 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 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.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
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: first() as aggregation function

2014-04-28 Thread Jim S
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#first-and-last

Is this what you were looking for?

-Jim

On Monday, April 28, 2014 7:20:15 AM UTC-5, Manuele wrote:
>
> Hi! 
> does exists or can be implemented an aggregation function that returns 
> the first element of a group instead of the sum, max, min or avg result? 
>
> Thank you... as usual :) 
>
> 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 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: How to start web2py server as linux daemon along with nginx?

2014-04-28 Thread Cynthia Butler
Thank you very much, that worked!

On Saturday, April 26, 2014 9:38:29 PM UTC-6, Massimo Di Pierro wrote:
>
> Can you try edit the file /etc/init.d/web2py and replace
>
> DAEMON_USER=web2py
>
> with
>
> DAEMON_USER=www-data
>
> On Saturday, 26 April 2014 22:38:00 UTC-5, Massimo Di Pierro wrote:
>>
>> You can try 
>>
>> On Saturday, 26 April 2014 13:29:08 UTC-5, Cynthia Butler wrote:
>>>
>>> I followed the instructions in the book Chapter 13 "Start as Linux 
>>> daemon". But when I type this on command line:
>>>
>>> sudo /etc/init.d/web2py start
>>>
>>> I get this error:
>>>
>>>  * Starting Web Framework web2py
>>> chown: invalid user: 'web2py'
>>> start-stop-daemon: user 'web2py' not found
>>>
>>> I think it's caused by the group:user is actually "www-data' as setup by 
>>> the ngenix-uwsgi-ubuntu.sh script, instead of "web2py".
>>>
>>> I can get the web2py server to run by typing this at the command line:
>>> cd /home/www-data/web2py
>>> sudo -u www-data python web2py
>>>
>>> But it is not a daemon process (running in the background).
>>>
>>> What is the proper way to resolve the different owners so I can run web2py 
>>> server as a daemon and also in a secure way (not by sudo -- or does that 
>>> matter)?
>>>
>>> Thank you-- I'm a noob!
>>>
>>>
>>>

-- 
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: Error on the nginix-uwsgi-ubunto setup script?

2014-04-28 Thread Cynthia Butler
Thank you very much!

On Saturday, April 26, 2014 12:48:37 PM UTC-6, Niphlod wrote:
>
> it's an ini file.
> all "errors" are in commented lines...I'll send a PR to fix it.
>
> On Saturday, April 26, 2014 10:51:04 AM UTC+2, Cynthia Butler wrote:
>>
>> Which file extension is correct, .xml or .ini , in this snippet from
>> "web2py/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh"?
>>
>> # Create configuration file /etc/uwsgi/web2py.xml
>> echo '[uwsgi]
>>
>> socket = /tmp/web2py.socket
>> pythonpath = /home/www-data/web2py/
>> mount = /=wsgihandler:application
>> processes = 4
>> master = true
>> harakiri = 60
>> reload-mercy = 8
>> cpu-affinity = 1
>> stats = /tmp/stats.socket
>> max-requests = 2000
>> limit-as = 512
>> reload-on-as = 256
>> reload-on-rss = 192
>> uid = www-data
>> gid = www-data
>> cron = 0 0 -1 -1 -1 python /home/www-data/web2py/web2py.py -Q -S welcome 
>> -M -R scripts/sessions2trash.py -A -o
>> no-orphans = true
>> ' >/etc/uwsgi/web2py.ini
>> ...
>>
>> ## to reload web2py only (without restarting uwsgi)
>> # touch /etc/uwsgi/web2py.xml
>>
>> 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.


Re: [web2py] Migrating from sqlite to postgres?

2014-04-28 Thread Andy Griggs
Hi,
   Try the script at the link to migrate the database.  You should be able 
to dump the SQLite database and import it into the Postgres database 
outside of web2py.  I have not tested this script, other have used it 
successfully.


https://gist.github.com/eclubb/2253099


Thanks!
Andy

On Friday, April 25, 2014 6:29:12 AM UTC-4, Michele Comitini wrote:
>
> Use this:
> http://pgloader.org/howto/pgloader.1.html
>
>
>
>
> 2014-04-24 14:39 GMT+02:00 Rene Dohmen >:
>
>> Hi Web2py users,
>>
>> we are struggling, for some time now, with a migration of our apps from 
>> sqlite to postgres. We tried a couple of approaches: first we tried doing 
>> it with cp_db.py but that had problems with relations and seems broken. Our 
>> current approach consist of these steps:
>>
>> 1) export data with:
>> def export_all():
>> db.export_to_csv_file(open('export_all.csv', 'w'))
>>
>> 2) change conenction string from sqlite:
>> db = DAL('sqlite://storage.sqlite', migrate=settings.migrate)
>> TO:
>> db = DAL('postgres://user:pass@localhost/project', migrate=settings.
>> migrate, check_reserved=False, entity_quoting=True)
>>
>> 3) remove contents of database/ folder and let web2py create the DB
>>
>> 4) import data from the csv
>>  def import_all():
>> db.import_from_csv_file(open('export_all.csv', 'r'))
>>
>>
>> The import then runs for a very long time and after 10 minutes or so a 
>> ticket is served:
>> -
>> Ticket ID
>>
>> 127.0.0.1.2014-04-24.13-38-52.6c7d2674-34e2-4968-9526-ee78b83fda76
>> Versie web2py™Version 2.9.5-stable+timestamp.2014.03.16.02.35.39PythonPython 
>> 2.7.5: /usr/bin/python (prefix: 
>> /System/Library/Frameworks/Python.framework/Versions/2.7) Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>> 23.
>> 24.
>> 25.
>> 26.
>> 27.
>>
>> Traceback (most recent call last):
>>   File "/Users/acidjunk/GIT/formatics.web2py/gluon/main.py", line 539, in 
>> wsgibase
>>
>> BaseAdapter.close_all_instances('rollback')
>>   File "/Users/acidjunk/GIT/formatics.web2py/gluon/dal.py", line 600, in 
>> close_all_instances
>>
>> db._adapter.close(action)
>>   File "/Users/acidjunk/GIT/formatics.web2py/gluon/dal.py", line 580, in 
>> close
>>
>> getattr(self, action)()
>>   File "/Users/acidjunk/GIT/formatics.web2py/gluon/dal.py", line 1923, in 
>> rollback
>>
>> return self.connection.rollback()
>>   File "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/dbapi.py", 
>> line 455, in _fn
>>
>> return fn(self, *args, **kwargs)
>>
>>   File "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/dbapi.py", 
>> line 551, in rollback
>>
>> self.conn.rollback()
>>   File 
>> "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/interface.py", 
>> line 622, in rollback
>>
>> self._rollback.execute()
>>   File 
>> "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/interface.py", 
>> line 166, in execute
>>
>> self.c.close_portal(self._portal_name)
>>
>>   File 
>> "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/protocol.py", 
>> line 1326, in close_portal
>>
>> reader.handle_messages()
>>   File 
>> "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/protocol.py", 
>> line 906, in handle_messages
>>
>> msg = self._conn._read_message()
>>
>>   File 
>> "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/protocol.py", 
>> line 1033, in _read_message
>>
>> bytes = self._read_bytes(5)
>>
>>   File 
>> "/Users/acidjunk/GIT/formatics.web2py/gluon/contrib/pg8000/protocol.py", 
>> line 1021, in _read_bytes
>>
>> self._sock_buf = self._sock.recv(1024)
>> timeout: timed out
>>
>> Error snapshot [image: 
>> help]
>>  
>>
>> (timed out)
>> -
>>
>> Is there a better way to do this kind of migrate, or to have better debug 
>> info about where it goes wrong?
>>
>> Any help is appreciated.
>>
>> Kind Regards
>>
>> Rene
>>
>>  -- 
>> 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...@g

[web2py] Re: "Tk library is not installed" which package do I need and where do I install it?

2014-04-28 Thread Cynthia Butler
Yes, I agree, I have been working just fine without it.
Thank you!

On Saturday, April 26, 2014 9:39:03 PM UTC-6, Massimo Di Pierro wrote:
>
> That is not a critical error. Web2py works well without it.
>
> Massimo
>
> On Saturday, 26 April 2014 15:51:18 UTC-5, Cynthia Butler wrote:
>>
>> My machine: ubuntu 14.04 LTS, 64 bit
>> My web2py:  2.9.5-stable+timestamp.2014.03.16.02.35.39
>>
>> I get this when running web2py.py: 
>>
>> "WARNING:web2py:GUI not available because Tk library is not installed"
>>
>>
>> I tried downloading/installing Tk 8.6.1 from Active State but it didn't 
>> fix it.
>>
>> I also tried:
>> >sudo apt-get install python-tk
>>
>> which removed the warning, but I still do not see the GUI/console.
>>
>> Sorry, I'm a noob. Which package do I need and where do I install it to 
>> get web2py's GUI/console to display?
>>
>> 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] first() as aggregation function

2014-04-28 Thread Manuele Pesenti
Hi!
does exists or can be implemented an aggregation function that returns
the first element of a group instead of the sum, max, min or avg result?

Thank you... as usual :)

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