[web2py] Action when file streaming finishes

2015-09-04 Thread desta
Hello,

When the client clicks on a specific link, a temporary file is created by a 
controller which is then downloaded (using the `response.stream`). I want 
to delete the file after the download finishes.

Could you please share any suggestions?

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] Action when file streaming finishes

2015-09-04 Thread desta
Thank you for the reply. I learned something new today! 
os.tmpfile() seems very useful but I don't think I can apply it in my 
situation.

The controller creates the file through an API call to a different server 
running on the system. As a response, the controller gets the file 
location. So it knows where the file is located and streams it to the 
client. From my understanding os.tmpfile() would work if I created the file 
within the controller.

Thank you.



On Friday, September 4, 2015 at 3:50:00 PM UTC+3, Yoel Benitez Fonseca 
wrote:
>
> if it a temporary file create by os.tmpfile() you don't need to care 
> about deleting it, the system will take care of everything for you. 
>
> -- 
> Yoel 
>
> 2015-09-04 8:32 GMT-04:00, desta : 
> > Hello, 
> > 
> > When the client clicks on a specific link, a temporary file is created 
> by a 
> > 
> > controller which is then downloaded (using the `response.stream`). I 
> want 
> > to delete the file after the download finishes. 
> > 
> > Could you please share any suggestions? 
> > 
> > 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+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
> > 
>
>
> -- 
> Msc. Yoel Benítez Fonseca 
> Especialista en TI 
> http://redevil.cubava.cu/ 
> Tel.: (53 32)284701 
>

-- 
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] fabric app

2015-09-04 Thread Carlos Cesar Caballero Díaz
Well not so much, I just join some snippets in my free time... I known 
fabric and is great, but I was looking for something more 
server-independent, it's slower than the Massimo request, but can work 
independently of the server configuration or OS.



El 03/09/15 a las 14:50, Richard Vézina escribió:
Nice Carlos, you should had work really hard... Do you know Fabric 
(http://www.fabfile.org/)?


I guess you had save some boiler plate...

:)

Richard

On Thu, Sep 3, 2015 at 2:21 PM, Carlos Cesar Caballero Díaz 
> wrote:


Hi massimo I took it as an exercise, and this is what I make:

https://github.com/cccaballero/app_deploy

can be used like:

python main.py https://github.com/myuser/repo.git
username:password@domain:/home/www-data/web2py/applications/estore3

the script make all the stuff locally, so nothing spacial need to
be installed in the server, only a sftp capable ssh server.

El 02/09/15 a las 00:02, Massimo Di Pierro escribió:

I would like an app that does this:

deploy https://github.com/mdipierro/estore3
username@domain:/home/www-data/web2py/applications/estore3

possibly based on fabric. Definitively written in Python.

the app "deply" should assume web2py is installed
1) clone locally https://github.com/mdipierro/estore3
2) zip it
3) copy it to
username@domain:/home/www-data/web2py/applications/estore3.zip

4) unzip it into
username@domain:/home/www-data/web2py/applications/estore3-tmp/
5) if username@domain:/home/www-data/web2py/applications/estore3
does not exist skip to 11)
6) zip
username@domain:/home/www-data/web2py/applications/estore3-.zip
username@domain:/home/www-data/web2py/applications/estore3/*
7) create a file
username@domain:/home/www-data/web2py/applications/estore3/DISABLED
containing the current datetime
8) stop the web server (apache and or nginx)
9) copy all files and folders from estore3/ to estore3-tmp/
 except models, views, controllers, modules, sessions
10) remove estore3/
11) rename estore-tmp3/ as estore/
12) restarts the web server

There should also be an option:

deploy -revert 
username@domain:/home/www-data/web2py/applications/estore3
that restores the content of
username@domain:/home/www-data/web2py/applications/estore3-.zip

should work with any git web2py app (not just estore3 which was
an example) and MUST WORK with private github repo.

It is OK to assume that the current user has ssh keys to access
both the git repo and the remote server.

I will pay $100 if you can send it to me in the next 2 days. Feel
free to discuss here if you understand it and think we can do
this better.

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.


-- 
Resources:

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


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

For more options, visit https://groups.google.com/d/optout.




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- 

Re: [web2py] 'module' object has no attribute 'startswith'

2015-09-04 Thread Richard Vézina
Could it be possible that you upgrade web2py but not the appadmin
controller?

Richard

On Thu, Sep 3, 2015 at 3:01 AM, Johann Spies  wrote:

> We have an app working with a database on another server through an
> ssh-tunnel.
>
> The app is working.  But the admin app which worked previously suddenly
> throws an error when one try to we tries the "database administration"
> button - but only for this app.
>
> The traceback is this:
>
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/js/web2py/applications/wos_2015_3/views/appadmin.html" 
> , 
> line 93, in 
> {{tablename=request.args[1]}}
>   File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 899, in 
> __getitem__
> return self.__getattr__(str(key))
>   File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 905, in 
> __getattr__
> return self.lazy_define_table(tablename, *fields, **args)
>   File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 845, in 
> lazy_define_table
> field.represent = auto_represent(field)
>   File "/home/js/web2py/gluon/packages/dal/pydal/helpers/methods.py", line 
> 286, in auto_represent
> if field.db and field.type.startswith('reference') and \
> AttributeError: 'module' object has no attribute 'startswith'
>
>
> How do I debug this?
>
> migrate = False for all the tables with fake_migrate on for the
> auth_related tables.
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] Action when file streaming finishes

2015-09-04 Thread Yoel Benitez Fonseca
if it a temporary file create by os.tmpfile() you don't need to care
about deleting it, the system will take care of everything for you.

--
Yoel

2015-09-04 8:32 GMT-04:00, desta :
> Hello,
>
> When the client clicks on a specific link, a temporary file is created by a
>
> controller which is then downloaded (using the `response.stream`). I want
> to delete the file after the download finishes.
>
> Could you please share any suggestions?
>
> 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.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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] Action when file streaming finishes

2015-09-04 Thread Niphlod
the problem with any approach is that the http hasn't really an event that 
signals that the file has been downloaded (and completed) successfully. 
The usual workaround is to put the location of the file on some list and 
remove it later by cycling the aforementioned list (say, every day or so).

On Friday, September 4, 2015 at 2:56:53 PM UTC+2, desta wrote:
>
> Thank you for the reply. I learned something new today! 
> os.tmpfile() seems very useful but I don't think I can apply it in my 
> situation.
>
> The controller creates the file through an API call to a different server 
> running on the system. As a response, the controller gets the file 
> location. So it knows where the file is located and streams it to the 
> client. From my understanding os.tmpfile() would work if I created the file 
> within the controller.
>
> Thank you.
>
>
>
> On Friday, September 4, 2015 at 3:50:00 PM UTC+3, Yoel Benitez Fonseca 
> wrote:
>>
>> if it a temporary file create by os.tmpfile() you don't need to care 
>> about deleting it, the system will take care of everything for you. 
>>
>> -- 
>> Yoel 
>>
>> 2015-09-04 8:32 GMT-04:00, desta : 
>> > Hello, 
>> > 
>> > When the client clicks on a specific link, a temporary file is created 
>> by a 
>> > 
>> > controller which is then downloaded (using the `response.stream`). I 
>> want 
>> > to delete the file after the download finishes. 
>> > 
>> > Could you please share any suggestions? 
>> > 
>> > 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+un...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/d/optout. 
>> > 
>>
>>
>> -- 
>> Msc. Yoel Benítez Fonseca 
>> Especialista en TI 
>> http://redevil.cubava.cu/ 
>> Tel.: (53 32)284701 
>>
>

-- 
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] SQL query equivalent in DAL

2015-09-04 Thread P T

Hello Forum,

Please help me in getting the equivalent DAL query for the following SQL 
query. I intend to pass this on to SQLFORM.grid

Select * from db.pc where db.pc.id not in (select unique 
db.assigned.computer from db.assigned)

Web2Py Version
2.9.12-stable+timestamp.2015.02.15.23.04.25
(Running on Rocket 1.2.6, Python 2.7.9) 

db.define_table('staff',
Field('name', 'string', unique=True),
   format='%(name)s')

db.define_table('pc',
Field('csi', 'string', unique=True),
   format='%(csi)s')

db.define_table('assigned',
Field('staff', db.staff),
Field('computer', db.pc))

Thanks,
PT

-- 
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] SQL query equivalent in DAL

2015-09-04 Thread Richard Vézina
db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id
)).select(db.pc.ALL)

Richard



On Fri, Sep 4, 2015 at 3:35 PM, P T  wrote:

>
> Hello Forum,
>
> Please help me in getting the equivalent DAL query for the following SQL
> query. I intend to pass this on to SQLFORM.grid
>
> Select * from db.pc where db.pc.id not in (select unique
> db.assigned.computer from db.assigned)
>
> Web2Py Version
> 2.9.12-stable+timestamp.2015.02.15.23.04.25
> (Running on Rocket 1.2.6, Python 2.7.9)
>
> db.define_table('staff',
> Field('name', 'string', unique=True),
>format='%(name)s')
>
> db.define_table('pc',
> Field('csi', 'string', unique=True),
>format='%(csi)s')
>
> db.define_table('assigned',
> Field('staff', db.staff),
> Field('computer', db.pc))
>
> Thanks,
> PT
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Display value from reference fields and not ids in SQLFORM.grid

2015-09-04 Thread LoveWeb2py
I've been struggling with this for hours! 

db.define_table('table1',
  Field('field1', 'string'),
  Field('field2','date'),
  format='%(field1)s %(field2)s', migrate=False)

db.define_table('table2',
 Field('field1','reference table1'),
 Field('field2','reference table1'),
 migrate=False)

I'm trying to show table2 in a SQLFORM, but it only shows the field 1 
values, for both fields. I want to show field 2 values  in table 1 for 
table 2. In SQLFORM.grid it only returns the id instead of the grid.

I'm so frustrated! 

I've tried:
https://groups.google.com/forum/#!topic/web2py/bO1N4r2j0Dg
http://stackoverflow.com/questions/1012179/how-to-generate-a-many-to-many-relationship-form-in-web2py
http://markmail.org/message/usmvxp5zctssog7d

Any advice is greatly appreciated. I'm sure it's something simple, but I 
just can't seem to find it.

-- 
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] SQL query equivalent in DAL

2015-09-04 Thread Dave S


On Friday, September 4, 2015 at 1:37:07 PM UTC-7, Anthony wrote:
>
>
> (see, no "Field('name', 'reference othertable', ...)")
>>
>  
> Field('computer', db.pc) 
>
> This is a reference to the "pc" table.
>
>  
Ooops! 

/dps "Location, location, location"


-- 
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] SQL query equivalent in DAL

2015-09-04 Thread P T
Thank you Richard, your expression returns ROWS and can't be used in 
SQLFORM.grid. When I removed the last select 

db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id))

then I get 

File "E:\web2py 2.9.12\gluon\sqlhtml.py", line 2139, in grid
 field_id = tables[0]._id
IndexError: list index out of range


Dave, the tables are related. e.g. the table "assigned" has a field "computer" 
of type db.pc



Thanks,
PT


On Friday, September 4, 2015 at 3:23:47 PM UTC-5, Dave S wrote:
>
> I'm puzzled about the why ...
>
> On Friday, September 4, 2015 at 12:42:32 PM UTC-7, Richard wrote:
>>
>> db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id
>> )).select(db.pc.ALL)
>>
>> Richard
>>
>>
>>
>> On Fri, Sep 4, 2015 at 3:35 PM, P T  wrote:
>>
>>>
>>> Hello Forum,
>>>
>>> Please help me in getting the equivalent DAL query for the following SQL 
>>> query. I intend to pass this on to SQLFORM.grid
>>>
>>> Select * from db.pc where db.pc.id not in (select unique 
>>> db.assigned.computer from db.assigned)
>>>
>>>
> when there's no reference between tables:
>
>
>  
>
>> Web2Py Version
>>> 2.9.12-stable+timestamp.2015.02.15.23.04.25
>>> (Running on Rocket 1.2.6, Python 2.7.9) 
>>>
>>> db.define_table('staff',
>>> Field('name', 'string', unique=True),
>>>format='%(name)s')
>>>
>>> db.define_table('pc',
>>> Field('csi', 'string', unique=True),
>>>format='%(csi)s')
>>>
>>> db.define_table('assigned',
>>> Field('staff', db.staff),
>>> Field('computer', db.pc))
>>>
>>> Thanks,
>>> PT
>>>
>>>
>>
> (see, no "Field('name', 'reference othertable', ...)")
>
> /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] Re: Display value from reference fields and not ids in SQLFORM.grid

2015-09-04 Thread LoveWeb2py
And of course I find it within a minute of posting... lol

Here is my solution:


in model:
db.define_table('table2',
 Field('field1','reference table1'),
 Field('field2','reference table1', requires=IS_IN_DB(db, 
db.table1.id, '%(field2)s')),
 migrate=False)

in controller:
db.table2.field2.represent = lambda s,r: s.field2
grid=SQLFORM.smartgrid(table2)
return dict(grid=grid)

Hope this helps someone in the future. Time for beer!




On Friday, September 4, 2015 at 4:49:31 PM UTC-4, LoveWeb2py wrote:
>
> I've been struggling with this for hours! 
>
> db.define_table('table1',
>   Field('field1', 'string'),
>   Field('field2','date'),
>   format='%(field1)s %(field2)s', migrate=False)
>
> db.define_table('table2',
>  Field('field1','reference table1'),
>  Field('field2','reference table1'),
>  migrate=False)
>
> I'm trying to show table2 in a SQLFORM, but it only shows the field 1 
> values, for both fields. I want to show field 2 values  in table 1 for 
> table 2. In SQLFORM.grid it only returns the id instead of the grid.
>
> I'm so frustrated! 
>
> I've tried:
> https://groups.google.com/forum/#!topic/web2py/bO1N4r2j0Dg
>
> http://stackoverflow.com/questions/1012179/how-to-generate-a-many-to-many-relationship-form-in-web2py
> http://markmail.org/message/usmvxp5zctssog7d
>
 

>
> Any advice is greatly appreciated. I'm sure it's something simple, but I 
> just can't seem to find it.
>

-- 
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] SQL query equivalent in DAL

2015-09-04 Thread Dave S
I'm puzzled about the why ...

On Friday, September 4, 2015 at 12:42:32 PM UTC-7, Richard wrote:
>
> db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id
> )).select(db.pc.ALL)
>
> Richard
>
>
>
> On Fri, Sep 4, 2015 at 3:35 PM, P T  
> wrote:
>
>>
>> Hello Forum,
>>
>> Please help me in getting the equivalent DAL query for the following SQL 
>> query. I intend to pass this on to SQLFORM.grid
>>
>> Select * from db.pc where db.pc.id not in (select unique 
>> db.assigned.computer from db.assigned)
>>
>>
when there's no reference between tables:


 

> Web2Py Version
>> 2.9.12-stable+timestamp.2015.02.15.23.04.25
>> (Running on Rocket 1.2.6, Python 2.7.9) 
>>
>> db.define_table('staff',
>> Field('name', 'string', unique=True),
>>format='%(name)s')
>>
>> db.define_table('pc',
>> Field('csi', 'string', unique=True),
>>format='%(csi)s')
>>
>> db.define_table('assigned',
>> Field('staff', db.staff),
>> Field('computer', db.pc))
>>
>> Thanks,
>> PT
>>
>>
>
(see, no "Field('reference', ...)")

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


Re: [web2py] SQL query equivalent in DAL

2015-09-04 Thread Anthony


> (see, no "Field('name', 'reference othertable', ...)")
>
 
Field('computer', db.pc) 

This is a reference to the "pc" table.

Anthony

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


Re: [web2py] SQL query equivalent in DAL

2015-09-04 Thread P T
Got it. I need to remove the initial db to make that into a query

(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id))




On Friday, September 4, 2015 at 3:37:50 PM UTC-5, P T wrote:
>
> Thank you Richard, your expression returns ROWS and can't be used in 
> SQLFORM.grid. When I removed the last select 
>
> db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id))
>
> then I get 
>
> File "E:\web2py 2.9.12\gluon\sqlhtml.py", line 2139, in grid
>  field_id = tables[0]._id
> IndexError: list index out of range
>
>
> Dave, the tables are related. e.g. the table "assigned" has a field 
> "computer" of type db.pc
>
>
>
> Thanks,
> PT
>
>
> On Friday, September 4, 2015 at 3:23:47 PM UTC-5, Dave S wrote:
>>
>> I'm puzzled about the why ...
>>
>> On Friday, September 4, 2015 at 12:42:32 PM UTC-7, Richard wrote:
>>>
>>> db(~db.pc.id.belongs(db(db.assigned.id > 0)._select(db.assigned.id
>>> )).select(db.pc.ALL)
>>>
>>> Richard
>>>
>>>
>>>
>>> On Fri, Sep 4, 2015 at 3:35 PM, P T  wrote:
>>>

 Hello Forum,

 Please help me in getting the equivalent DAL query for the following 
 SQL query. I intend to pass this on to SQLFORM.grid

 Select * from db.pc where db.pc.id not in (select unique 
 db.assigned.computer from db.assigned)


>> when there's no reference between tables:
>>
>>
>>  
>>
>>> Web2Py Version
 2.9.12-stable+timestamp.2015.02.15.23.04.25
 (Running on Rocket 1.2.6, Python 2.7.9) 

 db.define_table('staff',
 Field('name', 'string', unique=True),
format='%(name)s')

 db.define_table('pc',
 Field('csi', 'string', unique=True),
format='%(csi)s')

 db.define_table('assigned',
 Field('staff', db.staff),
 Field('computer', db.pc))

 Thanks,
 PT


>>>
>> (see, no "Field('name', 'reference othertable', ...)")
>>
>> /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] Re: Web2py Restfull API Token authentication

2015-09-04 Thread Dave S
On Wednesday, September 2, 2015 at 1:15:48 AM UTC-7, Niphlod wrote:
>
> I'm back from holidays, JWT support is on the way to master repo. Stay 
> tuned, also because I have some experience with js frameworks but not with 
> Angular. We may tune the code for JWT to make Angular integration easy. If 
> a slice comes out detailing the integration process wouldn't hurt :-P 
>

Ah, another expansion of the reading list.   I'm skimming RFC 7515 right 
now.

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


Re: [web2py] fabric app

2015-09-04 Thread Niphlod
Btw, The fabric script is already complete and was sent to 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.