[web2py] Re: web2py built-in autocomplete widget

2016-01-29 Thread Anthony
See answer on Stack Overflow: http://stackoverflow.com/a/35086859/440323

On Thursday, January 28, 2016 at 4:52:11 PM UTC-5, Steven Zhou wrote:
>
> need a hint on web2py built-in autocomplete widget.
>
> in controller: db.otc_products.counterparty.widget = 
> SQLFORM.widgets.autocomplete(request, db.counterparty.Long_Name, 
> limitby=(0,10), min_length=2)
>
> in model:
>
> db.define_table('otc_products', Field('counterparty','reference 
> counterparty', widget = SQLFORM.widgets.autocomplete(request, 
> db.counterparty.Long_Name, id_field=db.counterparty.id, limitby=(0,20), 
> min_length=2 )), ...
>
> db.define_table('counterparty', Field('Long_Name'), ...
>
> The resulted sqlform.grid returns a grid which features the counterparty 
> field to be a regular table field instead of a widget, let alone 
> autocompelete widget.
>
> What is the configuration that needs to modify here to get a autocomplete 
> widget shown and work.
>
> thanks in advance ! check link above 
> for a snapshot of the grid.
>

-- 
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: Problem with sqlite3 and WAL

2016-01-29 Thread Niphlod
file permissions should be the issue because those files are not usual 
ones. 

On Friday, January 29, 2016 at 3:45:09 PM UTC+1, peter wrote:
>
> I am restating my problem with all that I now know.
>  
>
>> I have a version of sqlite3 that is 3.7...
>>
>> I have been having problems with the database being locked.
>>
>> So I tried
>> db.executesql("PRAGMA journal_mode=WAL;")
>>
>> (just once)
>>
>> I then cannot access the application without getting a 
>>
>> OperationalError: unable to open database file
>>
>>
> If I look in the databases folder, I see that there are two file 
> storage.sqlite-wal and 
> storage.sqlite-shm
>
> The first of these has 0 bytes as its size.
> Both of them have the 'wrong' permissions in that they do not include 
> group write permissions.
> If I change the permissions of the two files, then reload the page, it 
> works. 
> However I will soon again get the 'unable to open database error', and the 
> persmissions will need resetting.
>
> Does anyone have any idea why I am getting these permission issues with 
> the WAL file?
>
> I set up a very simple application and WAL worked okay on that, so WAL is 
> possible on my system.
>
> If I turn WAL off and go back to DELETE everything works fine, but I am at 
> risk of database locking. so I would prefer to be able to use Write Ahead 
> Logging.
>
> Thanks for any help
> Peter
>
>
>
>  
>

-- 
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 keep project separate from web2py itself?

2016-01-29 Thread Anthony
On Friday, January 29, 2016 at 3:00:47 AM UTC-5, Niphlod wrote:
>
> PS: didn't have time to read through all, but did you consider using 
> web2py.py -f /path/to/applications_directory ? I just fixed a couple of 
> issues in trunk but it works fine.
>

I think he wants to be able to put each individual application in a 
separate folder somewhere on the filesystem (as each is part of a larger 
project and ideally would be nested in the folder structure of its 
respective project).

Anthony 

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


[web2py] Re: examples using ADFS

2016-01-29 Thread Jason Solack
Thank you for the reply!  I will be chatting with our clients today, i will 
let you know if this works out!

On Tuesday, January 26, 2016 at 12:56:36 PM UTC-5, Massimo Di Pierro wrote:
>
> we support SAML2. I think ADFS can be accessed via SAML. would that work?
>
> On Tuesday, 26 January 2016 11:17:59 UTC-6, Jason Solack wrote:
>>
>> Hello everyone, I'm wondering if there are any examples of using web2py 
>> with ADFS.  We have a need to connect to allow users to sign in via ADFS 
>> and i'm not finding anything within the documentation!
>>
>> Thank you for any guidance, 
>>
>> Jason
>>
>

-- 
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: Problem with sqlite3 and WAL

2016-01-29 Thread peter
I am restating my problem with all that I now know.
 

> I have a version of sqlite3 that is 3.7...
>
> I have been having problems with the database being locked.
>
> So I tried
> db.executesql("PRAGMA journal_mode=WAL;")
>
> (just once)
>
> I then cannot access the application without getting a 
>
> OperationalError: unable to open database file
>
>
If I look in the databases folder, I see that there are two file 
storage.sqlite-wal and 
storage.sqlite-shm

The first of these has 0 bytes as its size.
Both of them have the 'wrong' permissions in that they do not include group 
write permissions.
If I change the permissions of the two files, then reload the page, it 
works. 
However I will soon again get the 'unable to open database error', and the 
persmissions will need resetting.

Does anyone have any idea why I am getting these permission issues with the 
WAL file?

I set up a very simple application and WAL worked okay on that, so WAL is 
possible on my system.

If I turn WAL off and go back to DELETE everything works fine, but I am at 
risk of database locking. so I would prefer to be able to use Write Ahead 
Logging.

Thanks for any help
Peter



 

-- 
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 keep project separate from web2py itself?

2016-01-29 Thread Niphlod
PS: didn't have time to read through all, but did you consider using 
web2py.py -f /path/to/applications_directory ? I just fixed a couple of 
issues in trunk but it works fine.

-- 
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] class 'psycopg2.ProgrammingError'> relation "auth_user" already exists

2016-01-29 Thread Tom Campbell
App is on pythonanywhere, using Postgres. Connect string is:

db = 
DAL('postgres://web2pydbadmin:mypassw...@memberable-96.postgres.pythonanywhere-services.com:10096/mydatabase')

Existing topics 
like https://groups.google.com/forum/#!topic/web2py/p740UJkR3Ao do not seem 
to have helpful info.

I admit I lost my temper and deleted everything in /databases out of range 
and frustration (and the same error appears). I figured web2py would just 
rebuild tables if necessary.

I seem to be an absolutely shit database administrator (gave up on GAE 
altogether) and would be happy to hire someone who has experienced this 
problem using postgresql on pythonanywhere.

-- 
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: class 'psycopg2.ProgrammingError'> relation "auth_user" already exists

2016-01-29 Thread Niphlod
web2py doesn't do database introspection.
it basically works like this.

whooo, someone defined a table in the model. are migrations turned on ? 
if yes
 is there a corresponding .table file ?
   if yes
   inspect the file and see if it matches table definition
   if matches table definition ?
   don't do anything
   if not mathes table definition alter the table accordingly
  if not
go ahead and create the table
if not
don't do anything

so. migrations turned on, tables created on the database you drop 
.table files --> web2py assumes it has to recreate those.
to fix the issue, set fake_migrate_all, which instructs web2py to do 
nothing on the backend and just recreate .table files.
then set fake_migrate_all=False and continue to play with the database.
once in production with no further playing with models, just set 
migrate=False. 



On Friday, January 29, 2016 at 9:27:57 AM UTC+1, Tom Campbell wrote:
>
> App is on pythonanywhere, using Postgres. Connect string is:
>
> db = DAL('postgres://
> web2pydbadmin:mypassw...@memberable-96.postgres.pythonanywhere-services.com:10096/mydatabase
> ')
>
> Existing topics like 
> https://groups.google.com/forum/#!topic/web2py/p740UJkR3Ao do not seem to 
> have helpful info.
>
> I admit I lost my temper and deleted everything in /databases out of range 
> and frustration (and the same error appears). I figured web2py would just 
> rebuild tables if necessary.
>
> I seem to be an absolutely shit database administrator (gave up on GAE 
> altogether) and would be happy to hire someone who has experienced this 
> problem using postgresql on pythonanywhere.
>

-- 
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: Where to find "old issues" that were in google code?

2016-01-29 Thread Anthony
On Thursday, January 28, 2016 at 11:24:16 PM UTC-5, Dave wrote:
>
> Actually, maybe this is a bug.   (or maybe just something that is not 
> supposed to work the way I am trying to use it...)
>
> If I turn off lazy_table support, everything works.  I get a multi-select 
> box with the file_name populated (text area that I can multi-select).
>

Actually, it is the reverse -- you get the multi-select box with 
lazy_tables=True, but not with lazy_tables=False.

Here is how it works. The multi-select widget is generated automatically 
whenever a field has an IS_IN_DB(..., multiple=True) validator. 
Furthermore, list:reference fields automatically get an IS_IN_DB validator, 
but only when lazy_tables=True. The reason is that the IS_IN_DB validator 
is created when the auto_validators() function is called, and that function 
only assigns validators to reference fields if the referenced table name is 
in db.tables. Here is the order of operations in each case:

lazy_tables=True:

   1. At the end of db.define_table(), the new "tablename" is added to 
   db.tables.
   2. Sometime later, when db.tablename is accessed, the table is fully 
   defined via db.lazy_define_table.
   3. db.lazy_define_table calls auto_validators, which adds the IS_IN_DB 
   validator because "tablename" is in db.tables (see #1).

lazy_tables=False:

   1. Before the end of db.define_table(), db.lazy_define_table is called 
   (prior to the new "tablename" being added to db.tables).
   2. db.lazy_define_table calls auto_validators, which does *not* add the 
   IS_IN_DB validator because "tablename" is *not *yet in db.tables (see 
   #1).
   
I'm not sure I would call it a bug, but I think we may be able to adjust 
the code to make it work in either case (possibly by simply adding the new 
tablename to db.tables *before* db.lazy_define_table is called within 
db.define_table -- though I'm not sure if that will introduce some other 
problem).

Maybe open a Github issue and link to this thread.

If you do not want to use lazy tables, there is a simple workaround -- just 
explicitly define the validator yourself:

Field('children', 'list:reference file_entry',
  requires=IS_IN_DB(db, 'file_entry.id', '%(file_name)s', multiple=True
))

It appears you tried to do that, but you did not use the keyword argument 
"requires" and instead passed the validator as the third positional 
argument (which is actually the "length" argument).

Note, the same issue exists with the default "represent" attribute of the 
list:reference field -- you will need to use lazy tables or otherwise 
explicitly specify that attribute as well.

Anthony

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


[web2py] Re: Problem with sqlite3 and WAL

2016-01-29 Thread peter
The strange thing is that it works okay with another app. So what I can I 
do about permissions. The permissions for the databases folder are okay. If 
I change the permissions on those files the changes are non persistent. So 
I am stuck.


On Friday, 29 January 2016 14:58:26 UTC, Niphlod wrote:
>
> file permissions should be the issue because those files are not usual 
> ones. 
>
> On Friday, January 29, 2016 at 3:45:09 PM UTC+1, peter wrote:
>>
>> I am restating my problem with all that I now know.
>>  
>>
>>> I have a version of sqlite3 that is 3.7...
>>>
>>> I have been having problems with the database being locked.
>>>
>>> So I tried
>>> db.executesql("PRAGMA journal_mode=WAL;")
>>>
>>> (just once)
>>>
>>> I then cannot access the application without getting a 
>>>
>>> OperationalError: unable to open database file
>>>
>>>
>> If I look in the databases folder, I see that there are two file 
>> storage.sqlite-wal and 
>> storage.sqlite-shm
>>
>> The first of these has 0 bytes as its size.
>> Both of them have the 'wrong' permissions in that they do not include 
>> group write permissions.
>> If I change the permissions of the two files, then reload the page, it 
>> works. 
>> However I will soon again get the 'unable to open database error', and 
>> the persmissions will need resetting.
>>
>> Does anyone have any idea why I am getting these permission issues with 
>> the WAL file?
>>
>> I set up a very simple application and WAL worked okay on that, so WAL is 
>> possible on my system.
>>
>> If I turn WAL off and go back to DELETE everything works fine, but I am 
>> at risk of database locking. so I would prefer to be able to use Write 
>> Ahead Logging.
>>
>> Thanks for any help
>> Peter
>>
>>
>>
>>  
>>
>

-- 
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: How do I make my web2py app able to use the device hardwares like camera?

2016-01-29 Thread Jason (spot) Brower
Actually you can record video and take picture by using the right kind of
html tags. It will involve the camera app and have it ready to upload. Do
it in one of my apps all the time.

On Fri, Jan 22, 2016, 11:51 Dave S  wrote:

> On Sunday, January 17, 2016 at 9:05:50 AM UTC-8, henryj...@gmail.com
> wrote:
>>
>> How do I make my web2py app able to use the device hardwares like
>>
>>  camera?  also how to make it able to use some other apps on the device?
>>
>
> For the camera, you probably want to run an external command by launching
> a process.  If the external command is likely to take a long time, you will
> want to use the scheduler for this.  Running other applications is done the
> same way.  Interactive applications will not work well this way, but
> anything that can be invoked from bash with no input besides command line
> args should work.  I've done the external commands, but I haven't done
> hardware control.
>
> The answer changes a little if you want to use the camera as a source of
> live streaming video.  You will probably be using cStreamIO calls, perhaps
> to read a file the camera is dumping data to.  I haven't done this at all,
> but there are some posts in the archives that I've noticed and are about
> streaming audio.
>
> /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.
>

-- 
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 move Postgres apps?

2016-01-29 Thread Alex Glaros
worked! your last line sums up my feelings :-)

-- 
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: Good Practices - Custom Auth (default table) VS. Defining Own Auth Tables (for different user level)

2016-01-29 Thread Marcelo Theodoro
See [1].
I'm working on a project that needs seller/buyer logins, where the seller
needs to input information about the store and the buyer must provide and
address.  But instead of be using the auth_user table to store that
information, I'm using db.store and db.address, and then after the
user(seller/buyer) sign up he is redirected to a controller that provides a
form to input the address/store. The good part about his method is to be
possible to have more than one address and more than one store by the same
user.


[1]
https://stackoverflow.com/questions/17380476/web2py-authenticating-two-types-of-profile

Em sex, 29 de jan de 2016 às 19:58, Ron Chatterjee 
escreveu:

> Is there an example of how to split the auth_user in two tables that
> allows people to sign up using the same way but allowing in creating two
> profiles (lets say one for seller and one as a buyer)? Anyone did something
> like that?
>
>
>
> On Saturday, February 28, 2015 at 8:07:03 AM UTC-5, Jon M. wrote:
>>
>> Currently working only with the 'auth_user' table, and I must say that I
>> works like expected.  Following the advices from Mr. Di Pierro, won't make
>> any split of types of users or something like that, and will keep working
>> and improving the use of this table and database in general. Thanks a
>> lot!!! :D
>>
> --
> 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] Re: Good Practices - Custom Auth (default table) VS. Defining Own Auth Tables (for different user level)

2016-01-29 Thread Ron Chatterjee
Thank you. Web2py group rocks! 

On Friday, January 29, 2016 at 5:37:02 PM UTC-5, Marcelo Theodoro wrote:
>
> See [1].
> I'm working on a project that needs seller/buyer logins, where the seller 
> needs to input information about the store and the buyer must provide and 
> address.  But instead of be using the auth_user table to store that 
> information, I'm using db.store and db.address, and then after the 
> user(seller/buyer) sign up he is redirected to a controller that provides a 
> form to input the address/store. The good part about his method is to be 
> possible to have more than one address and more than one store by the same 
> user.
>
>
> [1] 
> https://stackoverflow.com/questions/17380476/web2py-authenticating-two-types-of-profile
>
> Em sex, 29 de jan de 2016 às 19:58, Ron Chatterjee  > escreveu:
>
>> Is there an example of how to split the auth_user in two tables that 
>> allows people to sign up using the same way but allowing in creating two 
>> profiles (lets say one for seller and one as a buyer)? Anyone did something 
>> like that?
>>
>>
>>
>> On Saturday, February 28, 2015 at 8:07:03 AM UTC-5, Jon M. wrote:
>>>
>>> Currently working only with the 'auth_user' table, and I must say that I 
>>> works like expected.  Following the advices from Mr. Di Pierro, won't make 
>>> any split of types of users or something like that, and will keep working 
>>> and improving the use of this table and database in general. Thanks a 
>>> lot!!! :D
>>>
>> -- 
>> 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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Good Practices - Custom Auth (default table) VS. Defining Own Auth Tables (for different user level)

2016-01-29 Thread Ron Chatterjee
Is there an example of how to split the auth_user in two tables that allows 
people to sign up using the same way but allowing in creating two profiles 
(lets say one for seller and one as a buyer)? Anyone did something like 
that?



On Saturday, February 28, 2015 at 8:07:03 AM UTC-5, Jon M. wrote:
>
> Currently working only with the 'auth_user' table, and I must say that I 
> works like expected.  Following the advices from Mr. Di Pierro, won't make 
> any split of types of users or something like that, and will keep working 
> and improving the use of this table and database in general. Thanks a 
> lot!!! :D
>

-- 
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] Form created using helper - load image

2016-01-29 Thread isi_jca
Hi!!!

I have a form created using Helper HTML, It is has manye field

form = FORM(TABLE(

TR(TD(LABEL("Foto 1:",_class="label_foto5"),
INPUT(_class="upload",_id="foto5",_name="foto5", _type="file",

_onchange="leerarchivobin('foto5','loadfoto5')")),
  TD(LABEL("Foto 
2:",_class="label_foto6"),INPUT(_class="upload",_id="foto6",_name="foto6", 
_type="file",

_onchange="leerarchivobin('foto6','loadfoto6')")),
  TD(LABEL("Foto 
3:",_class="label_foto7"),INPUT(_class="upload",_id="foto7",_name="foto7", 
_type="file",

_onchange="leerarchivobin('foto7','loadfoto7')")),
  TD(LABEL("Foto 
4:",_class="label_foto8"),INPUT(_class="upload",_id="foto8",_name="foto8", 
_type="file",

_onchange="leerarchivobin('foto8','loadfoto8')")),),

   TR(TD(IMG(_id="loadfoto5")),
TD(IMG(_id="loadfoto6",_height="300px")),
TD(IMG(_id="loadfoto7")),
TD(IMG(_id="loadfoto8"))
)))


When I retrieve data from database I set data in the form this manner.

form.vars.campo_1 = item.campo_1


form.vars.campo_n = item.campo_n

¿How do I to set image in field type upload?.  For example, in my table I 
have next definition:

Field('foto1', 'upload',label=T('Foto 1 - Cliente'))

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] Re: Where to find "old issues" that were in google code?

2016-01-29 Thread Dave S


On Thursday, January 28, 2016 at 7:19:31 PM UTC-8, Dave wrote:
>
> Thanks Anthony. I looked for the issue number from the original poster, 
> but the ticket that came up wasn't related to list: reference... There 
> doesn't seem to be any other context in the post. Any idea what else I can 
> search on? I spent a good couple hours searching through not only the 
> ticket list but this group. Lots of posts about list: ref, but only did I 
> find the one about referencing the same table


My poking at the issues search turned up 4 for "list:reference" (3 of which 
were imported), 2 for "common_filters", none for "common_type" (as in the 
quoted post by H Sunyoto), and none for "382".  Picking an imported issue 
at random (sort of), there seems to be a typical line about "Original 
issue" that has the GC.bug.id number, and putting that id number in the 
issues search box gets back to the imported issue.  My guess is that #382 
got lost and wasn't imported, or maybe the import process wasn't able to 
 log that particular "original issue".

Since we don't know what terms were in the original issue, the correct 
search terms are a matter of inspiration and perspiration.

/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: Where to find "old issues" that were in google code?

2016-01-29 Thread Dave
Thanks Anthony.

Yes, actually I am looking now and I see that it was late and Yes, it 
started working when I set lazy_tables to True, not False.  

And omitting requires= was a mistake.  I will test it without the entire 
IS_IN_DB string now.  I expect it will work just fine.  Sometimes it's hard 
to see the forest for the trees.  Thanks for pointing that out.

On Friday, January 29, 2016 at 11:15:13 AM UTC-5, Anthony wrote:
>
> On Thursday, January 28, 2016 at 11:24:16 PM UTC-5, Dave wrote:
>>
>> Actually, maybe this is a bug.   (or maybe just something that is not 
>> supposed to work the way I am trying to use it...)
>>
>> If I turn off lazy_table support, everything works.  I get a multi-select 
>> box with the file_name populated (text area that I can multi-select).
>>
>
> Actually, it is the reverse -- you get the multi-select box with 
> lazy_tables=True, but not with lazy_tables=False.
>
> Here is how it works. The multi-select widget is generated automatically 
> whenever a field has an IS_IN_DB(..., multiple=True) validator. 
> Furthermore, list:reference fields automatically get an IS_IN_DB validator, 
> but only when lazy_tables=True. The reason is that the IS_IN_DB validator 
> is created when the auto_validators() function is called, and that function 
> only assigns validators to reference fields if the referenced table name is 
> in db.tables. Here is the order of operations in each case:
>
> lazy_tables=True:
>
>1. At the end of db.define_table(), the new "tablename" is added to 
>db.tables.
>2. Sometime later, when db.tablename is accessed, the table is fully 
>defined via db.lazy_define_table.
>3. db.lazy_define_table calls auto_validators, which adds the IS_IN_DB 
>validator because "tablename" is in db.tables (see #1).
>
> lazy_tables=False:
>
>1. Before the end of db.define_table(), db.lazy_define_table is called 
>(prior to the new "tablename" being added to db.tables).
>2. db.lazy_define_table calls auto_validators, which does *not* add 
>the IS_IN_DB validator because "tablename" is *not *yet in db.tables 
>(see #1).
>3. The new "tablename" is added to db.tables *after* 
>db.lazy_define_table and auto_validators have already run.
>
> I'm not sure I would call it a bug, but I think we may be able to adjust 
> the code to make it work in either case (possibly by simply adding the new 
> tablename to db.tables *before* db.lazy_define_table is called within 
> db.define_table -- though I'm not sure if that will introduce some other 
> problem).
>
> Maybe open a Github issue and link to this thread.
>
> If you do not want to use lazy tables, there is a simple workaround -- 
> just explicitly define the validator yourself:
>
> Field('children', 'list:reference file_entry',
>   requires=IS_IN_DB(db, 'file_entry.id', '%(file_name)s', multiple=
> True))
>
> It appears you tried to do that, but you did not use the keyword argument 
> "requires" and instead passed the validator as the third positional 
> argument (which is actually the "length" argument).
>
> Note, the same issue exists with the default "represent" attribute of the 
> list:reference field -- you will need to use lazy tables or otherwise 
> explicitly specify that attribute as well.
>
> Anthony
>
>

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


[web2py] Re: How to move Postgres apps?

2016-01-29 Thread Anthony
Keep in mind that when using SQLite, the database moves with the app 
because the SQLite database file is stored in the app's /databases folder. 
This is not the case for any other databases.

Anthony

On Friday, January 29, 2016 at 4:07:02 PM UTC-5, Alex Glaros wrote:
>
> I move my app back and forth between different development PCs and when I 
> pack the app on site #1 and upload to site #2 there is no data in it.
>
> Transferring worked with sqLite as the database but I can't get PostGres 
> version to work. Tried many combinations of migrate, fake_migrate, true, 
> false, etc.
>
> Export/Import didn't work either 
> (db.import_from_csv_file(open('somefile6.csv', 'rb'))). Raised constraint 
> error which should be impossible because data came directly from parent app 
> that was just cloned in the pack operation.
>
> Any tips on moving a Postgres-based app?
>
> thanks,
>
> Alex Glaros
>

-- 
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: Login App engine

2016-01-29 Thread Charles tenorio
cool it was the *tbl(tbl auth_event, aut_group, auth_membership, auth_user)* 
tbl were created but were not created  (auth_cas, auth_permission) ?
when I try to log of this error



Traceback (most recent call last):
  File 
"/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/gluon/main.py", line 
480, in wsgibase
session._try_store_in_cookie_or_file(request, response)
  File 
"/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/gluon/globals.py", 
line 1181, in _try_store_in_cookie_or_file
return self._try_store_in_file(request, response)
  File 
"/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/gluon/globals.py", 
line 1196, in _try_store_in_file
os.mkdir(session_folder)
OSError: [Errno 38] Function not implemented: 
'/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/applications/jogosweb/sessions'




Em terça-feira, 26 de janeiro de 2016 15:50:34 UTC-3, Charles tenorio 
escreveu:
>
> good afternoon I need your help in the app engine can not use part of the 
> web2py login when I call a menu that has an @ in the controller 
> auth.requires_login (), it opens the login screen, you register a new user, 
> but this new user does not save the datastored
>

-- 
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 keep project separate from web2py itself?

2016-01-29 Thread Dave S


On Friday, January 29, 2016 at 6:27:36 AM UTC-8, Anthony wrote:
>
> On Friday, January 29, 2016 at 3:00:47 AM UTC-5, Niphlod wrote:
>>
>> PS: didn't have time to read through all, but did you consider using 
>> web2py.py -f /path/to/applications_directory ? I just fixed a couple of 
>> issues in trunk but it works fine.
>>
>
> I think he wants to be able to put each individual application in a 
> separate folder somewhere on the filesystem (as each is part of a larger 
> project and ideally would be nested in the folder structure of its 
> respective project).
>

With Git and Mercurial, he can have a repo in his project tree and sync it 
to the repo in the applications folder.  Slightly more complicated than a 
symbolic link, but still pretty easy-peasy.  (I've done that sort of thing.)

/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: class 'psycopg2.ProgrammingError'> relation "auth_user" already exists

2016-01-29 Thread Dave S


On Friday, January 29, 2016 at 2:11:38 AM UTC-8, Niphlod wrote:
>
> web2py doesn't do database introspection.
> it basically works like this.
>
> whooo, someone defined a table in the model. are migrations turned on 
> ? 
> if yes
>  is there a corresponding .table file ?
>if yes
>inspect the file and see if it matches table definition
>if matches table definition ?
>don't do anything
>if not mathes table definition alter the table accordingly
>   if not
> go ahead and create the table
> if not
> don't do anything
>
> so. migrations turned on, tables created on the database you drop 
> .table files --> web2py assumes it has to recreate those.
> to fix the issue, set fake_migrate_all, which instructs web2py to do 
> nothing on the backend and just recreate .table files.
> then set fake_migrate_all=False and continue to play with the database.
> once in production with no further playing with models, just set 
> migrate=False. 
>
>
>

I've put a star on this one for my own use, as I think it's the best 
explanation I've seen yet.

 /dps


> On Friday, January 29, 2016 at 9:27:57 AM UTC+1, Tom Campbell wrote:
>>
>> App is on pythonanywhere, using Postgres. Connect string is:
>>
>> db = DAL('postgres://
>> web2pydbadmin:mypassw...@memberable-96.postgres.pythonanywhere-services.com:10096/mydatabase
>> ')
>>
>> Existing topics like 
>> https://groups.google.com/forum/#!topic/web2py/p740UJkR3Ao do not seem 
>> to have helpful info.
>>
>> I admit I lost my temper and deleted everything in /databases out of 
>> range and frustration (and the same error appears). I figured web2py would 
>> just rebuild tables if necessary.
>>
>> I seem to be an absolutely shit database administrator (gave up on GAE 
>> altogether) and would be happy to hire someone who has experienced this 
>> problem using postgresql on pythonanywhere.
>>
>

-- 
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: How do I make my web2py app able to use the device hardwares like camera?

2016-01-29 Thread Dave S
On Friday, January 29, 2016 at 10:02:58 AM UTC-8, Encompass solutions wrote:
>
> Actually you can record video and take picture by using the right kind of 
> html tags. It will involve the camera app and have it ready to upload. Do 
> it in one of my apps all the time.
>

Ooooh, I was assuming "camera on server" (like the Raspberry Pi people do). 
 Having the camera on the client, and having the webpage snap a picture 
sounds interesting (with appropriate privacy considerations, asking 
permission first).  The CoS situation isn't that different, except the file 
can be considered to already be uploaded, and you'd be invoking the 
external app with python tools instead of javascript.

/dps

 

>
> On Fri, Jan 22, 2016, 11:51 Dave S  
> wrote:
>
>> On Sunday, January 17, 2016 at 9:05:50 AM UTC-8, henryj...@gmail.com 
>> wrote:
>>>
>>> How do I make my web2py app able to use the device hardwares like 
>>>
>>>  camera?  also how to make it able to use some other apps on the device?
>>>
>>  
>> For the camera, you probably want to run an external command by launching 
>> a process.  If the external command is likely to take a long time, you will 
>> want to use the scheduler for this.  Running other applications is done the 
>> same way.  Interactive applications will not work well this way, but 
>> anything that can be invoked from bash with no input besides command line 
>> args should work.  I've done the external commands, but I haven't done 
>> hardware control.
>>
>> The answer changes a little if you want to use the camera as a source of 
>> live streaming video.  You will probably be using cStreamIO calls, perhaps 
>> to read a file the camera is dumping data to.  I haven't done this at all, 
>> but there are some posts in the archives that I've noticed and are about 
>> streaming audio.
>>
>> /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: SQLFORM changing the column of record

2016-01-29 Thread Dave S


On Thursday, January 28, 2016 at 8:36:47 AM UTC-8, Lucas Schreiber wrote:
>
> Hi,
> ist there a way to change the column of the record in an SQLFORM?
>
> For example, my code looks like this:
>
> module
> dba.define_table('test_table',
> Field('field_1', 'integer'),
> Field('field_2', 'integer'))
>
> controller
>
> def index():
>
> record = 1
>
> form=SQLFORM(dba.test_table, record, submit_button='test')
>
> return dict (b=form)
>
>
>
> When i understand it correctly, the record matches the autocreated id Field 
> of the table, is there a way to match it with the field_1, for example?
>
>
>
Wouldn't that just be a db query?   Your example always uses '1' for the 
record, which I think leves out a step, but the examples in the book all 
use 

record = db.test_table(1)   # or, more often, request.args(0)


to select a record, and doing

record = db(db.test_table.field_1 == request.args(0)).select()

would get the record(s) where field_1 matches the input.

/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: Problem with sqlite3 and WAL

2016-01-29 Thread Dave S


On Friday, January 29, 2016 at 7:34:57 AM UTC-8, peter wrote:
>
> The strange thing is that it works okay with another app. So what I can I 
> do about permissions. The permissions for the databases folder are okay. If 
> I change the permissions on those files the changes are non persistent. So 
> I am stuck.
>

You need to find out what's creating those files, and have it do the job 
correctly.

/dps
 

>
>
> On Friday, 29 January 2016 14:58:26 UTC, Niphlod wrote:
>>
>> file permissions should be the issue because those files are not usual 
>> ones. 
>>
>> On Friday, January 29, 2016 at 3:45:09 PM UTC+1, peter wrote:
>>>
>>> I am restating my problem with all that I now know.
>>>  
>>>
 I have a version of sqlite3 that is 3.7...

 I have been having problems with the database being locked.

 So I tried
 db.executesql("PRAGMA journal_mode=WAL;")

 (just once)

 I then cannot access the application without getting a 

 OperationalError: unable to open database file


>>> If I look in the databases folder, I see that there are two file 
>>> storage.sqlite-wal and 
>>> storage.sqlite-shm
>>>
>>> The first of these has 0 bytes as its size.
>>> Both of them have the 'wrong' permissions in that they do not include 
>>> group write permissions.
>>> If I change the permissions of the two files, then reload the page, it 
>>> works. 
>>> However I will soon again get the 'unable to open database error', and 
>>> the persmissions will need resetting.
>>>
>>> Does anyone have any idea why I am getting these permission issues with 
>>> the WAL file?
>>>
>>> I set up a very simple application and WAL worked okay on that, so WAL 
>>> is possible on my system.
>>>
>>> If I turn WAL off and go back to DELETE everything works fine, but I am 
>>> at risk of database locking. so I would prefer to be able to use Write 
>>> Ahead Logging.
>>>
>>> Thanks for any help
>>> Peter
>>>
>>>
>>>
>>>  
>>>
>>

-- 
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 built-in autocomplete widget

2016-01-29 Thread Dave S
On Friday, January 29, 2016 at 6:26:05 AM UTC-8, Anthony wrote:
>
> See answer on Stack Overflow: http://stackoverflow.com/a/35086859/440323
>

That would make a good sidebar in the book.  (The book doesn't presently 
include any sidebars, does it?  Perhaps a "tips and tricks" chapter, then.)

/dps
 

>
>
> On Thursday, January 28, 2016 at 4:52:11 PM UTC-5, Steven Zhou wrote:
>>
>> need a hint on web2py built-in autocomplete widget.
>>
>> in controller: db.otc_products.counterparty.widget = 
>> SQLFORM.widgets.autocomplete(request, db.counterparty.Long_Name, 
>> limitby=(0,10), min_length=2)
>>
>> in model:
>>
>> db.define_table('otc_products', Field('counterparty','reference 
>> counterparty', widget = SQLFORM.widgets.autocomplete(request, 
>> db.counterparty.Long_Name, id_field=db.counterparty.id, limitby=(0,20), 
>> min_length=2 )), ...
>>
>> db.define_table('counterparty', Field('Long_Name'), ...
>>
>> The resulted sqlform.grid returns a grid which features the counterparty 
>> field to be a regular table field instead of a widget, let alone 
>> autocompelete widget.
>>
>> What is the configuration that needs to modify here to get a autocomplete 
>> widget shown and work.
>>
>> thanks in advance ! check link above 
>> for a snapshot of the grid.
>>
>

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


[web2py] Re: SQLFORM changing the column of record

2016-01-29 Thread Anthony
So just to clarify, the "record" argument to SQLFORM can either be the id 
of the desired record, or it can be a Row object containing the record 
(i.e., the result of querying the database to retrieve the record).

record = db(db.test_table.field_1 == request.args(0)).select()
>

We want a Row object, so this should be:

record = db(db.test_table.field_1 == request.args(0)).select().first()
>
 
Anthony

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


[web2py] Re: SQLFORM changing the column of record

2016-01-29 Thread Dave S


On Friday, January 29, 2016 at 12:11:07 PM UTC-8, Anthony wrote:
>
> So just to clarify, the "record" argument to SQLFORM can either be the id 
> of the desired record, or it can be a Row object containing the record 
> (i.e., the result of querying the database to retrieve the record).
>

Ah, I should have looked a little closer at the prototype. 

>
> Also, here:
>
> record = db(db.test_table.field_1 == request.args(0)).select()
>>
>
> we want a Row object, so it should be:
>
> record = db(db.test_table.field_1 == request.args(0)).select().first()
>  
>

I thought of pointing out that I was assuming 1 match, but I suppose that 
would still have given a Rows (the wrapper) object, but of len == 1.

/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: Problem with sqlite3 and WAL

2016-01-29 Thread peter
I imagine it is sqlite3 itself that is creating them. How one can get it to 
change the way it does things I do not know. As I say it seems to work ok 
with another app that is in the same setup. So why sqlite should behave in 
an app specific way I do not know.

Peter

-- 
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 move Postgres apps?

2016-01-29 Thread Niphlod
set migrate=False.
do a backup (pgdump) on #1
do a restore on #2
live happy.

On Friday, January 29, 2016 at 10:07:02 PM UTC+1, Alex Glaros wrote:
>
> I move my app back and forth between different development PCs and when I 
> pack the app on site #1 and upload to site #2 there is no data in it.
>
> Transferring worked with sqLite as the database but I can't get PostGres 
> version to work. Tried many combinations of migrate, fake_migrate, true, 
> false, etc.
>
> Export/Import didn't work either 
> (db.import_from_csv_file(open('somefile6.csv', 'rb'))). Raised constraint 
> error which should be impossible because data came directly from parent app 
> that was just cloned in the pack operation.
>
> Any tips on moving a Postgres-based app?
>
> thanks,
>
> Alex Glaros
>

-- 
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 move Postgres apps?

2016-01-29 Thread Alex Glaros
I move my app back and forth between different development PCs and when I 
pack the app on site #1 and upload to site #2 there is no data in it.

Transferring worked with sqLite as the database but I can't get PostGres 
version to work. Tried many combinations of migrate, fake_migrate, true, 
false, etc.

Export/Import didn't work either 
(db.import_from_csv_file(open('somefile6.csv', 'rb'))). Raised constraint 
error which should be impossible because data came directly from parent app 
that was just cloned in the pack operation.

Any tips on moving a Postgres-based app?

thanks,

Alex Glaros

-- 
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: class 'psycopg2.ProgrammingError'> relation "auth_user" already exists

2016-01-29 Thread Niphlod
Thanks pal, it's not my first, probably won't be not my last, and surely 
it's not my best. 
The book 
has 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Migration-control-summary
 
. 
This is one of the areas that I can't explain better probably because to me 
it's straightforward, but less experienced users have a hard time with it.
Feel free to send a PR on the book if you figure out a better rephrasing: 
from someone that didn't know it and recently grasped it it may come 
something that is more useful to people stuck with it.

On Friday, January 29, 2016 at 8:12:56 PM UTC+1, Dave S wrote:
>
>
>
> On Friday, January 29, 2016 at 2:11:38 AM UTC-8, Niphlod wrote:
>>
>> web2py doesn't do database introspection.
>> it basically works like this.
>>
>> whooo, someone defined a table in the model. are migrations turned on 
>> ? 
>> if yes
>>  is there a corresponding .table file ?
>>if yes
>>inspect the file and see if it matches table definition
>>if matches table definition ?
>>don't do anything
>>if not mathes table definition alter the table accordingly
>>   if not
>> go ahead and create the table
>> if not
>> don't do anything
>>
>> so. migrations turned on, tables created on the database you drop 
>> .table files --> web2py assumes it has to recreate those.
>> to fix the issue, set fake_migrate_all, which instructs web2py to do 
>> nothing on the backend and just recreate .table files.
>> then set fake_migrate_all=False and continue to play with the database.
>> once in production with no further playing with models, just set 
>> migrate=False. 
>>
>>
>>
>
> I've put a star on this one for my own use, as I think it's the best 
> explanation I've seen yet.
>
>  /dps
>
>
>> On Friday, January 29, 2016 at 9:27:57 AM UTC+1, Tom Campbell wrote:
>>>
>>> App is on pythonanywhere, using Postgres. Connect string is:
>>>
>>> db = DAL('postgres://
>>> web2pydbadmin:mypassw...@memberable-96.postgres.pythonanywhere-services.com:10096/mydatabase
>>> ')
>>>
>>> Existing topics like 
>>> https://groups.google.com/forum/#!topic/web2py/p740UJkR3Ao do not seem 
>>> to have helpful info.
>>>
>>> I admit I lost my temper and deleted everything in /databases out of 
>>> range and frustration (and the same error appears). I figured web2py would 
>>> just rebuild tables if necessary.
>>>
>>> I seem to be an absolutely shit database administrator (gave up on GAE 
>>> altogether) and would be happy to hire someone who has experienced this 
>>> problem using postgresql on pythonanywhere.
>>>
>>

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