[web2py] Re: SQLFORM.grid - Create from list of objects

2013-09-08 Thread Gliese 581 g
Hi Massimo,
I will try to be more specific.
I am developing a web2py application(APP1) which works on the data which it 
gets from another web2py application(APP2).
We do not have access to the database of APP2, we access their data through 
jsonrpc web services exposed by APP2.
Now, there is an API(get_objects) of APP2 which gives us a list of certain 
type of objects. APP2 internally fetch this data from its database and 
convert it to a list of specific type of objects.
I want it to be displayed in a table with sorting and paging capabilities. 
Can I use web2py's SQLFORM.grid to achieve this?
Please suggest me any solution.

Thank you.

On Friday, 6 September 2013 20:26:54 UTC+5:30, Gliese 581 g wrote:
>
>  **
>
> I am working on a project where we have a different subsystem whose API 
> returns a list of certain type of objects. 
>
> I want it to be displayed on my form. Can I use SQLForm.grid for this? 
> Please suggest.
>  

-- 

--- 
You received this message because you are subscribed to the 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: Routing A Subdomain (on Openshift)

2013-09-08 Thread Massimo Di Pierro
Please open a ticket pointing to this. I think we should support something 
like this in routes.py but it needs some more thought.

On Sunday, 8 September 2013 00:00:03 UTC-5, Charles Law wrote:
>
> For completeness I have modified code in application:
>
> application_web2py = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
>logfilename=WEB2PY_LOG,
>profilerfilename=None)
>
> def application(environ, start_response):
> fw = environ.get('HTTP_X_FORWARDED_HOST')
> if isinstance(fw, basestring):
> if fw.startswith('rapydscript'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydscript' + 
> environ['PATH_INFO']
> elif fw.startswith('rapydml'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydml' + environ['PATH_INFO']
> elif fw.startswith('rapydcss'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydcss' + environ['PATH_INFO']
>
> return application_web2py(environ, start_response)
>
>
>
> On Friday, September 6, 2013 9:01:50 AM UTC-7, Charles Law wrote:
>>
>> We have a site with a subdomain that correctly gets forwarded to web2py 
>> on openshift, but the page it hits is our default home page.  We want the 
>> subdomains to go ti different functions on our default controller, but we 
>> can't figure out how to do that with routes.  Included below is the current 
>> routes file we have.  We would like to have visitors going to http(s)://
>> rapydscript.pyjeon.com to visit our rapydscript function on the default 
>> controller by default.  I tried looking at examples, and what I have below 
>> I think should work, but users are just seeing the same content as 
>> www.pyjeon.com under the rapydscript subdomain.  Is the file setup 
>> incorrectly?  Does openshift do something odd?
>> Thanks in advance for any help,
>> Charles
>>
>> routes.py:
>>
>> default_application = 'pyjeon'# ordinarily set in base routes.py
>> default_controller = 'default'  # ordinarily set in app-specific routes.py
>> default_function = 'index'  # ordinarily set in app-specific routes.py
>>
>>
>> BASE = ''  # optonal prefix for incoming URLs
>>
>> myapp = 'pyjeon'
>>
>> routes_in = (
>> # reroute favicon and robots, use exable for lack of better choice
>> ('/favicon.ico', '/static/favicon.png'),
>> ('/robots.txt', '/pyjeon/static/robots.txt'),
>> ('/sitemap.xml', '/pyjeon/static/sitemap.xml'),
>> (('.*http://rapydscript.pyjeon.com', '/' + myapp + 
>> '/default/rapydscript')),
>> (('.*http://rapydscript.pyjeon.com/(?P.*)', '/' + myapp + 
>> '/default/rapydscript/\g')),
>> (BASE + '/', '/' + myapp + '/default/index'),
>> # do not reroute admin unless you want to disable it
>> (BASE + '/admin', '/admin/default/index'),
>> (BASE + '/admin/$anything', '/admin/$anything'),
>> #setup static
>> (BASE + '/static/', '/' + myapp + '/static/index.html'),
>> (BASE + '/static/$anything', '/' + myapp + '/static/$anything'),
>> (BASE + '/appadmin', '/' + myapp + '/appadmin'),
>> (BASE + '/pyjeon/appadmin/$anything', '/' + myapp + 
>> '/appadmin/$anything'),
>> (BASE + '/$app/$anything', '/' + myapp + '/default/$app/$anything'),
>> (BASE + '/$app', '/' + myapp + '/default/$app'),
>> # do other stuff
>> # remove the BASE prefix
>> (BASE + '/$anything', '/$anything'),
>> )
>>
>> # routes_out, like routes_in translates URL paths created with the web2py 
>> URL()
>> # function in the same manner that route_in translates inbound URL paths.
>> #
>>
>> routes_out = (
>> # do not reroute admin unless you want to disable it
>> ('/admin/$anything', BASE + '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>> # do not reroute static files
>> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>> # do other stuff
>> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
>> (r'/app(?P.*)', r'\g'),
>> # restore the BASE prefix
>> ('/$anything', BASE + '/$anything'),
>> )
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the 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: SQLFORM.grid - Create from list of objects

2013-09-08 Thread Massimo Di Pierro
You cannot unless you first load the data in a database. You can use a 
temporary in memory database like this:

fields = [Field('one'), Field('two'), Field('three'), ...]
temp_db = cache.ram('tmp_db',lambda: 
DAL('sqlite:memory').define_table('mytable',*fields)._db, None)

temp_db.mytable.truncate()
temp_db.mytable.insert()
form = SQLFORM.grid(temp_db.mytable)


On Sunday, 8 September 2013 05:35:13 UTC-5, Gliese 581 g wrote:
>
> Hi Massimo,
> I will try to be more specific.
> I am developing a web2py application(APP1) which works on the data which 
> it gets from another web2py application(APP2).
> We do not have access to the database of APP2, we access their data 
> through jsonrpc web services exposed by APP2.
> Now, there is an API(get_objects) of APP2 which gives us a list of certain 
> type of objects. APP2 internally fetch this data from its database and 
> convert it to a list of specific type of objects.
> I want it to be displayed in a table with sorting and paging capabilities. 
> Can I use web2py's SQLFORM.grid to achieve this?
> Please suggest me any solution.
>
> Thank you.
>
> On Friday, 6 September 2013 20:26:54 UTC+5:30, Gliese 581 g wrote:
>>
>>  **
>>
>> I am working on a project where we have a different subsystem whose API 
>> returns a list of certain type of objects. 
>>
>> I want it to be displayed on my form. Can I use SQLForm.grid for this? 
>> Please suggest.
>>  
>

-- 

--- 
You received this message because you are subscribed to the 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: smartgrid of grid and list of dictionary

2013-09-08 Thread keiser1080
thanks 
this kinfd of table is unique for each session or user?

Le dimanche 8 septembre 2013 04:03:40 UTC+2, Massimo Di Pierro a écrit :
>
> You can make a fate table in ram or in cache (DAL('sqlite:memory') or 
> MEMDB),
>
> On Saturday, 7 September 2013 16:49:12 UTC-5, Anthony wrote:
>>
>> I think he wants the list of dictionaries to be the data displayed in the 
>> table, not to be used to construct a query.
>>
>> On Saturday, September 7, 2013 2:34:01 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Something like this?
>>>
>>> def parse(table,d):
>>>return reduce(lambda a,b:a&b,[table[k]==v for k,v in d.iteritems()])
>>>
>>> SQLFORM.smartgrid(parse(db.yourtable, {'name':'alex', 'age':'55'}))
>>>
>>>
>>>
>>>
>>>
>>> On Saturday, 7 September 2013 11:07:31 UTC-5, keiser1080 wrote:

 hi,

 It is possible tu use smartgrid with a list of dictionary in place of a 
 query?
 Can i do something like this?

 smartgrid
 (table, constraints=None, linked_tables=None, links=None, links_in_grid
 =True, args=None,user_signature=True, divider='>', breadcrumbs_class=''
 , **kwargs)

 smartgrid([{'name':'alex', 'age':'55'},  {'name':'albert', 'age':'44'}
 ])








-- 

--- 
You received this message because you are subscribed to the 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: Routing A Subdomain (on Openshift)

2013-09-08 Thread Charles Law
Is it supported already?

I saw this:
http://web2py.com/book/default/chapter/04#Pattern-based-system (last 
example)
and 
http://stackoverflow.com/questions/7622961/defining-sub-domain-based-on-a-function-in-routes-py-of-web2py
that look like examples of web2py supporting subdomain routes.

I assumed openshift was messing with headers/env so the matching wasn't 
working.  I don't have a non-openshift web2py site to play with to test my 
assumption though.


On Sunday, September 8, 2013 6:42:48 AM UTC-7, Massimo Di Pierro wrote:
>
> Please open a ticket pointing to this. I think we should support something 
> like this in routes.py but it needs some more thought.
>
> On Sunday, 8 September 2013 00:00:03 UTC-5, Charles Law wrote:
>>
>> For completeness I have modified code in application:
>>
>> application_web2py = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
>>logfilename=WEB2PY_LOG,
>>profilerfilename=None)
>>
>> def application(environ, start_response):
>> fw = environ.get('HTTP_X_FORWARDED_HOST')
>> if isinstance(fw, basestring):
>> if fw.startswith('rapydscript'):
>> if environ['PATH_INFO'] in ['', '/']:
>> environ['PATH_INFO'] = '/rapydscript' + 
>> environ['PATH_INFO']
>> elif fw.startswith('rapydml'):
>> if environ['PATH_INFO'] in ['', '/']:
>> environ['PATH_INFO'] = '/rapydml' + environ['PATH_INFO']
>> elif fw.startswith('rapydcss'):
>> if environ['PATH_INFO'] in ['', '/']:
>> environ['PATH_INFO'] = '/rapydcss' + environ['PATH_INFO']
>>
>> return application_web2py(environ, start_response)
>>
>>
>>
>> On Friday, September 6, 2013 9:01:50 AM UTC-7, Charles Law wrote:
>>>
>>> We have a site with a subdomain that correctly gets forwarded to web2py 
>>> on openshift, but the page it hits is our default home page.  We want the 
>>> subdomains to go ti different functions on our default controller, but we 
>>> can't figure out how to do that with routes.  Included below is the current 
>>> routes file we have.  We would like to have visitors going to http(s)://
>>> rapydscript.pyjeon.com to visit our rapydscript function on the default 
>>> controller by default.  I tried looking at examples, and what I have below 
>>> I think should work, but users are just seeing the same content as 
>>> www.pyjeon.com under the rapydscript subdomain.  Is the file setup 
>>> incorrectly?  Does openshift do something odd?
>>> Thanks in advance for any help,
>>> Charles
>>>
>>> routes.py:
>>>
>>> default_application = 'pyjeon'# ordinarily set in base routes.py
>>> default_controller = 'default'  # ordinarily set in app-specific 
>>> routes.py
>>> default_function = 'index'  # ordinarily set in app-specific 
>>> routes.py
>>>
>>>
>>> BASE = ''  # optonal prefix for incoming URLs
>>>
>>> myapp = 'pyjeon'
>>>
>>> routes_in = (
>>> # reroute favicon and robots, use exable for lack of better choice
>>> ('/favicon.ico', '/static/favicon.png'),
>>> ('/robots.txt', '/pyjeon/static/robots.txt'),
>>> ('/sitemap.xml', '/pyjeon/static/sitemap.xml'),
>>> (('.*http://rapydscript.pyjeon.com', '/' + myapp + 
>>> '/default/rapydscript')),
>>> (('.*http://rapydscript.pyjeon.com/(?P.*)', '/' + myapp + 
>>> '/default/rapydscript/\g')),
>>> (BASE + '/', '/' + myapp + '/default/index'),
>>> # do not reroute admin unless you want to disable it
>>> (BASE + '/admin', '/admin/default/index'),
>>> (BASE + '/admin/$anything', '/admin/$anything'),
>>> #setup static
>>> (BASE + '/static/', '/' + myapp + '/static/index.html'),
>>> (BASE + '/static/$anything', '/' + myapp + '/static/$anything'),
>>> (BASE + '/appadmin', '/' + myapp + '/appadmin'),
>>> (BASE + '/pyjeon/appadmin/$anything', '/' + myapp + 
>>> '/appadmin/$anything'),
>>> (BASE + '/$app/$anything', '/' + myapp + '/default/$app/$anything'),
>>> (BASE + '/$app', '/' + myapp + '/default/$app'),
>>> # do other stuff
>>> # remove the BASE prefix
>>> (BASE + '/$anything', '/$anything'),
>>> )
>>>
>>> # routes_out, like routes_in translates URL paths created with the 
>>> web2py URL()
>>> # function in the same manner that route_in translates inbound URL paths.
>>> #
>>>
>>> routes_out = (
>>> # do not reroute admin unless you want to disable it
>>> ('/admin/$anything', BASE + '/admin/$anything'),
>>> # do not reroute appadmin unless you want to disable it
>>> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>>> # do not reroute static files
>>> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>>> # do other stuff
>>> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
>>> (r'/app(?P.*)', r'\g'),
>>> # restore the BASE prefix
>>> ('/$anything', BASE + '/$anything'),
>>> )
>>>
>>>
>>>

-- 

--- 
You received this message because

Re: [web2py] Re: Routing A Subdomain (on Openshift)

2013-09-08 Thread Jonathan Lundell
On 8 Sep 2013, at 9:19 AM, Charles Law  wrote:
> Is it supported already?

The parametric router might do what you want.

> 
> I saw this:
> http://web2py.com/book/default/chapter/04#Pattern-based-system (last example)
> and 
> http://stackoverflow.com/questions/7622961/defining-sub-domain-based-on-a-function-in-routes-py-of-web2py
> that look like examples of web2py supporting subdomain routes.
> 
> I assumed openshift was messing with headers/env so the matching wasn't 
> working.  I don't have a non-openshift web2py site to play with to test my 
> assumption though.
> 
> 
> On Sunday, September 8, 2013 6:42:48 AM UTC-7, Massimo Di Pierro wrote:
> Please open a ticket pointing to this. I think we should support something 
> like this in routes.py but it needs some more thought.
> 
> On Sunday, 8 September 2013 00:00:03 UTC-5, Charles Law wrote:
> For completeness I have modified code in application:
> 
> application_web2py = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
>logfilename=WEB2PY_LOG,
>profilerfilename=None)
> 
> def application(environ, start_response):
> fw = environ.get('HTTP_X_FORWARDED_HOST')
> if isinstance(fw, basestring):
> if fw.startswith('rapydscript'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydscript' + environ['PATH_INFO']
> elif fw.startswith('rapydml'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydml' + environ['PATH_INFO']
> elif fw.startswith('rapydcss'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydcss' + environ['PATH_INFO']
> 
> return application_web2py(environ, start_response)
> 
> 
> 
> On Friday, September 6, 2013 9:01:50 AM UTC-7, Charles Law wrote:
> We have a site with a subdomain that correctly gets forwarded to web2py on 
> openshift, but the page it hits is our default home page.  We want the 
> subdomains to go ti different functions on our default controller, but we 
> can't figure out how to do that with routes.  Included below is the current 
> routes file we have.  We would like to have visitors going to 
> http(s)://rapydscript.pyjeon.com to visit our rapydscript function on the 
> default controller by default.  I tried looking at examples, and what I have 
> below I think should work, but users are just seeing the same content as 
> www.pyjeon.com under the rapydscript subdomain.  Is the file setup 
> incorrectly?  Does openshift do something odd?
> Thanks in advance for any help,
> Charles
> 
> routes.py:
> 
> default_application = 'pyjeon'# ordinarily set in base routes.py
> default_controller = 'default'  # ordinarily set in app-specific routes.py
> default_function = 'index'  # ordinarily set in app-specific routes.py
> 
> 
> BASE = ''  # optonal prefix for incoming URLs
> 
> myapp = 'pyjeon'
> 
> routes_in = (
> # reroute favicon and robots, use exable for lack of better choice
> ('/favicon.ico', '/static/favicon.png'),
> ('/robots.txt', '/pyjeon/static/robots.txt'),
> ('/sitemap.xml', '/pyjeon/static/sitemap.xml'),
> (('.*http://rapydscript.pyjeon.com', '/' + myapp + 
> '/default/rapydscript')),
> (('.*http://rapydscript.pyjeon.com/(?P.*)', '/' + myapp + 
> '/default/rapydscript/\g')),
> (BASE + '/', '/' + myapp + '/default/index'),
> # do not reroute admin unless you want to disable it
> (BASE + '/admin', '/admin/default/index'),
> (BASE + '/admin/$anything', '/admin/$anything'),
> #setup static
> (BASE + '/static/', '/' + myapp + '/static/index.html'),
> (BASE + '/static/$anything', '/' + myapp + '/static/$anything'),
> (BASE + '/appadmin', '/' + myapp + '/appadmin'),
> (BASE + '/pyjeon/appadmin/$anything', '/' + myapp + 
> '/appadmin/$anything'),
> (BASE + '/$app/$anything', '/' + myapp + '/default/$app/$anything'),
> (BASE + '/$app', '/' + myapp + '/default/$app'),
> # do other stuff
> # remove the BASE prefix
> (BASE + '/$anything', '/$anything'),
> )
> 
> # routes_out, like routes_in translates URL paths created with the web2py 
> URL()
> # function in the same manner that route_in translates inbound URL paths.
> #
> 
> routes_out = (
> # do not reroute admin unless you want to disable it
> ('/admin/$anything', BASE + '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
> # do not reroute static files
> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
> # do other stuff
> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
> (r'/app(?P.*)', r'\g'),
> # restore the BASE prefix
> ('/$anything', BASE + '/$anything'),
> )
> 
> 
> 
> -- 
>  



-- 

--- 
You received this message because you are subscribed to the Google Gro

[web2py] Re: SQLFORM.grid - Create from list of objects

2013-09-08 Thread Anthony
Not great if you need pagination, though (you'd need to fetch all the data 
from the API and put it in the temporary in-memory DB).

Perhaps another option would be to create a custom DAL adapter and override 
the .select() and .count() methods to pull data and counts from the API. 
Could get complicated, though.

Anthony

On Sunday, September 8, 2013 9:47:03 AM UTC-4, Massimo Di Pierro wrote:
>
> You cannot unless you first load the data in a database. You can use a 
> temporary in memory database like this:
>
> fields = [Field('one'), Field('two'), Field('three'), ...]
> temp_db = cache.ram('tmp_db',lambda: 
> DAL('sqlite:memory').define_table('mytable',*fields)._db, None)
>
> temp_db.mytable.truncate()
> temp_db.mytable.insert()
> form = SQLFORM.grid(temp_db.mytable)
>
>
> On Sunday, 8 September 2013 05:35:13 UTC-5, Gliese 581 g wrote:
>>
>> Hi Massimo,
>> I will try to be more specific.
>> I am developing a web2py application(APP1) which works on the data which 
>> it gets from another web2py application(APP2).
>> We do not have access to the database of APP2, we access their data 
>> through jsonrpc web services exposed by APP2.
>> Now, there is an API(get_objects) of APP2 which gives us a list of 
>> certain type of objects. APP2 internally fetch this data from its database 
>> and convert it to a list of specific type of objects.
>> I want it to be displayed in a table with sorting and paging 
>> capabilities. 
>> Can I use web2py's SQLFORM.grid to achieve this?
>> Please suggest me any solution.
>>
>> Thank you.
>>
>> On Friday, 6 September 2013 20:26:54 UTC+5:30, Gliese 581 g wrote:
>>>
>>>  **
>>>
>>> I am working on a project where we have a different subsystem whose API 
>>> returns a list of certain type of objects. 
>>>
>>> I want it to be displayed on my form. Can I use SQLForm.grid for this? 
>>> Please suggest.
>>>  
>>

-- 

--- 
You received this message because you are subscribed to the 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] Newby, can't connect to a Postgresl database

2013-09-08 Thread Sartglider
Hi,
I'm really new to web2py - less than 24 hours - 
Trying to follow this example 
http://web2py.com/books/default/chapter/29/03/overview#Say-hello
it worked fine with sqlite, so I try to connect to a postgresql database in 
another server:
the model is this one:
db = DAL("postgres://root:@192.168.0.98/teste")

db.define_table('equipments',
   Field('eq_id', unique=True),
   Field('eq_model'),
   Field('eq_aka'),
   format = '%(title)s')

db.equipments.eq_id.requires = IS_NOT_IN_DB(db, db.equipments.eq_model)
db.equipments.eq_model.requires = IS_IN_DB(db, db.equipments.eq_id, 
'%(title)s')

db.equipments.eq_id.writable = False

but I get no errors just the browser trying to connect.

Thank you in advance for your help.


Postgresq server: debian 6 & postgresql 8.4
web2Py server: debian 7, python 2.7

-- 

--- 
You received this message because you are subscribed to the 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: Newby, can't connect to a Postgresl database

2013-09-08 Thread Dragan Matic
Postgres probably doesn't have 'root' as user. Its root user is 'postgres'. 

After that check if your address is allowed to connect to postgres server 
in pg_hba.conf  and if server is listening on your network 
('listen_addresses' setting in postgresql.conf). It could also be a 
firewall issue, check is port 5432 is open. 

On Sunday, September 8, 2013 5:47:38 PM UTC+2, Sartglider wrote:
>
> Hi,
> I'm really new to web2py - less than 24 hours - 
> Trying to follow this example 
> http://web2py.com/books/default/chapter/29/03/overview#Say-hello
> it worked fine with sqlite, so I try to connect to a postgresql database 
> in another server:
> the model is this one:
> db = DAL("postgres://root:@192.168.0.98/teste")
>
> db.define_table('equipments',
>Field('eq_id', unique=True),
>Field('eq_model'),
>Field('eq_aka'),
>format = '%(title)s')
>
> db.equipments.eq_id.requires = IS_NOT_IN_DB(db, db.equipments.eq_model)
> db.equipments.eq_model.requires = IS_IN_DB(db, db.equipments.eq_id, 
> '%(title)s')
>
> db.equipments.eq_id.writable = False
>
> but I get no errors just the browser trying to connect.
>
> Thank you in advance for your help.
>
>
> Postgresq server: debian 6 & postgresql 8.4
> web2Py server: debian 7, python 2.7
>
>

-- 

--- 
You received this message because you are subscribed to the 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] Re: Newby, can't connect to a Postgresl database

2013-09-08 Thread starglider.dev
Actually it as a root user because all application connect to the server by
root, the other software is made with
python & pscopg2.

I try to connect by psql from the server that as web2py and it worked,
also create a model with this script:
https://github.com/phektus/cvstash/blob/master/scripts/extract_pgsql_models.py

and it try to connect endlessly.

Thank for your replay.




On 8 September 2013 21:56, Dragan Matic  wrote:

> Postgres probably doesn't have 'root' as user. Its root user is
> 'postgres'.
>
> After that check if your address is allowed to connect to postgres server
> in pg_hba.conf  and if server is listening on your network
> ('listen_addresses' setting in postgresql.conf). It could also be a
> firewall issue, check is port 5432 is open.
>
> On Sunday, September 8, 2013 5:47:38 PM UTC+2, Sartglider wrote:
>>
>> Hi,
>> I'm really new to web2py - less than 24 hours -
>> Trying to follow this example http://web2py.com/books/**
>> default/chapter/29/03/**overview#Say-hello
>> it worked fine with sqlite, so I try to connect to a postgresql database
>> in another server:
>> the model is this one:
>> db = DAL("postgres://root:<**password>@192.168.0.98/teste")
>>
>> db.define_table('equipments',
>>Field('eq_id', unique=True),
>>Field('eq_model'),
>>Field('eq_aka'),
>>format = '%(title)s')
>>
>> db.equipments.eq_id.requires = IS_NOT_IN_DB(db, db.equipments.eq_model)
>> db.equipments.eq_model.**requires = IS_IN_DB(db, db.equipments.eq_id,
>> '%(title)s')
>>
>> db.equipments.eq_id.writable = False
>>
>> but I get no errors just the browser trying to connect.
>>
>> Thank you in advance for your help.
>>
>>
>> Postgresq server: debian 6 & postgresql 8.4
>> web2Py server: debian 7, python 2.7
>>
>>  --
>
> ---
> You received this message because you are subscribed to the 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.


[web2py] Re: Newby, can't connect to a Postgresl database

2013-09-08 Thread Matheus Cardoso
This is odd. Normally, web2py flushes a html error saying that he tried to 
connect five times (i guess) but with no success. Have you tried to look 
the sql.log? And try check the params that Dragan described to you. 


Em domingo, 8 de setembro de 2013 12h47min38s UTC-3, Sartglider escreveu:
>
> Hi,
> I'm really new to web2py - less than 24 hours - 
> Trying to follow this example 
> http://web2py.com/books/default/chapter/29/03/overview#Say-hello
> it worked fine with sqlite, so I try to connect to a postgresql database 
> in another server:
> the model is this one:
> db = DAL("postgres://root:@192.168.0.98/teste")
>
> db.define_table('equipments',
>Field('eq_id', unique=True),
>Field('eq_model'),
>Field('eq_aka'),
>format = '%(title)s')
>
> db.equipments.eq_id.requires = IS_NOT_IN_DB(db, db.equipments.eq_model)
> db.equipments.eq_model.requires = IS_IN_DB(db, db.equipments.eq_id, 
> '%(title)s')
>
> db.equipments.eq_id.writable = False
>
> but I get no errors just the browser trying to connect.
>
> Thank you in advance for your help.
>
>
> Postgresq server: debian 6 & postgresql 8.4
> web2Py server: debian 7, python 2.7
>
>

-- 

--- 
You received this message because you are subscribed to the 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: github - please follow

2013-09-08 Thread Marcio Andrey Oliveira
done.

-- 

--- 
You received this message because you are subscribed to the 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: Example of web2py integration with an AJAX grid (preferably jquery based) which updates backend db ?

2013-09-08 Thread tomt
Simon,

I wanted to thank you for the answer you posted.
As a casual user of web2py, I would have never figured this out
on my own, but your clear example showing db, controller and view
made it easy for me to understand and to implement.

It would be great if the experienced users of web2py would
contribute similar small examples. I believe that would be
one way to help make web2py more popular.

ps. I had to modify the following to get update to work:
jQuery('.dog_name').editable("{{=URL('dogs', 
'upd_dog_name')}}",{  
to:
jQuery('.dog_name').editable("{{=URL('default', 
'upd_dog_name')}}",{  

- Tom


On Wednesday, September 4, 2013 11:25:49 PM UTC-6, Simon Ashley wrote:
>
> Download jeditable, 
> Install in the static/js folder.
>
> Include in layout.html i.e.
>   
>
>
> *Model*
> db.define_table('dogs',
> Field('dog_name','string'))
>
>
> *Controller:*
> def populate():
> db.dogs.truncate()
> db.fleas.truncate()
> db.dogs.insert(dog_name='dagwood')
> db.dogs.insert(dog_name='daisy')
> 
> def dogs():
> db.dogs.dog_name.represent = lambda value, row: DIV(value if value 
> else '-',_class='dog_name', _id=str(row.id)+'.dog_name')
> g = SQLFORM.grid(db.dogs, searchable=False, csv=False, user_signature=
> False)
> return dict(form = g)
>
>
> def upd_dog_name():
> id,column = request.post_vars.id.split('.')
> value = request.post_vars.value
> db(db.dogs.id == id).update(**{column:value})
> return value
>
>
> *View:*
> {{extend 'layout.html'}}
>
> 
> jQuery(document).ready(function(){
> jQuery('.dog_name').editable("{{=URL('dogs', 'upd_dog_name')}}",{ 
>   
> tooltip: "Click to edit, enter to save",
>  indicator : 'updating',
>  });})
> 
>
>
> 
> {{=form}}
> 
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the 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: smartgrid of grid and list of dictionary

2013-09-08 Thread Massimo Di Pierro
You can make is unique

unique_key = response.session_id+'.temptable'
db = cache.ram(unique_key,lambda:DAL('sqlite:memory'), None)


On Sunday, 8 September 2013 09:40:53 UTC-5, keiser1080 wrote:
>
> thanks 
> this kinfd of table is unique for each session or user?
>
> Le dimanche 8 septembre 2013 04:03:40 UTC+2, Massimo Di Pierro a écrit :
>>
>> You can make a fate table in ram or in cache (DAL('sqlite:memory') or 
>> MEMDB),
>>
>> On Saturday, 7 September 2013 16:49:12 UTC-5, Anthony wrote:
>>>
>>> I think he wants the list of dictionaries to be the data displayed in 
>>> the table, not to be used to construct a query.
>>>
>>> On Saturday, September 7, 2013 2:34:01 PM UTC-4, Massimo Di Pierro wrote:

 Something like this?

 def parse(table,d):
return reduce(lambda a,b:a&b,[table[k]==v for k,v in d.iteritems()])

 SQLFORM.smartgrid(parse(db.yourtable, {'name':'alex', 'age':'55'}))





 On Saturday, 7 September 2013 11:07:31 UTC-5, keiser1080 wrote:
>
> hi,
>
> It is possible tu use smartgrid with a list of dictionary in place of 
> a query?
> Can i do something like this?
>
> smartgrid
> (table, constraints=None, linked_tables=None, links=None, 
> links_in_grid=True, args=None,user_signature=True, divider='>', 
> breadcrumbs_class='', **kwargs)
>
> smartgrid([{'name':'alex', 'age':'55'},  {'name':'albert', 'age':'44'}
> ])
>
>
>
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the 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] Managing Greenlet Queues

2013-09-08 Thread archeaneon
For the purpose of managing greenlet queues, is there a safe way of 
globally (across web2py threads) maintaining a list of these?

-- 

--- 
You received this message because you are subscribed to the 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.