[web2py] Re: Can I simulate multiple user logins to web2py from a single computer?

2014-05-05 Thread Robert Kooij
Or if you want to keep it even simpler, just use multiple (different) 
browsers, each browser keep track of their own session. 

I assume, as a web developer you have Chrome, Firefox and Safari installed 
anyway? Should be able to simulate 3 different user to start with. :)


On Monday, May 5, 2014 1:35:56 AM UTC+2, Rufus wrote:

 Web2py'ers:

 I am trying to create a back end for a multiple user game, including, for 
 instance, a chat room function.
 However, when I try to do this locally, all windows change over to the 
 most recent login.

 That is to say, I open up another window to the app, sign in with a 
 different user id, and type.into
 the chat app, and get the new message.  But if I go to one of the other 
 formerly signed in windows
 and try to chat, it submits as most recently logged in user.

 Can I have multiple sessions/log ins from a single computer?

 This may be a security issue, but would be useful for testing if it could 
 be overridden, even temporarily.

 Rufus



-- 
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 table as dictionary

2014-05-05 Thread Greg Vaughan
tyvm Massimo exactly what I was looking for... it works perfectly and now 
the rest of my code works :)

On Monday, 5 May 2014 14:46:19 UTC+10, Massimo Di Pierro wrote:

 fields = db(db.address.business==4L).select().first().as_dict()

 On Sunday, 4 May 2014 16:59:34 UTC-5, Greg Vaughan wrote:


 The following code

 fields = db(db.address.business==4L).select().as_dict()

 returns a dictionary of dictionaries

 {1L: {'street_name': 'Another', 'postcode': '4888', 'id': 1L, 'unit': 
 False, 'building_name': '', 'city': 'Deadsville', 'lot_section': None, 
 'sub_building': '', 'street_suffix': None, 'unit_type': None, 
 'cross_type': None, 'level_floor': False, 'is_corner': False, 
 'unit_number': '', 'lot': False, 'business': 4L, 'add_state': 'Qld', 
 'floor_number': '', 'street_type': 'STREET', 'cross_name': '', 'building'
 : False, 'street_number': 111L, 'cross_suffix': None, 'country': None, 
 'floor_type': None}}

 How do I return just the inner dictionary?

 {'street_name': 'Another', 'postcode': '4888', 'id': 1L, 'unit': False, 
 'building_name': '', 'city': 'Deadsville', 'lot_section': None, 
 'sub_building': '', 'street_suffix': None, 'unit_type': None, 
 'cross_type': None, 'level_floor': False, 'is_corner': False, 
 'unit_number': '', 'lot': False, 'business': 4L, 'add_state': 'Qld', 
 'floor_number': '', 'street_type': 'STREET', 'cross_name': '', 'building'
 : False, 'street_number': 111L, 'cross_suffix': None, 'country': None, 
 'floor_type': None} 



-- 
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] strange problem with DAL

2014-05-05 Thread Marin Pranjić
Well, nothing unusual with my table definitions. Everything by the specs.
I just removed all .table files and started with new sqlite file, and that
problem is gone.
(i still have copies)

Seems that files were stuck in some state.

However, main.message error still confuses me, because sql query that's
created by DAL is valid.
And this happens even after migrations are fixed.

So it's probably SQLite that's broken/corrupted and I'm not sure if those
issues are somehow related.

Marin




On Sun, May 4, 2014 at 8:58 PM, Niphlod niph...@gmail.com wrote:

 how are your table defined ? the fact that 'main.message' gets into the
 error seems a little weird for a table named message_receiver. Also, that
 success repeated into sql.log means that something really strange is
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić marin@gmail.comwrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's like
 production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for ex. in
 appadmin) it works, but when I try to insert something (appadmin or in-app)
 i get the following error:

 OperationalError: no such table: main.message



 I got the actual SQL query from the error ticket:



 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);



 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database file. It 
 has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every request 
 but nothing changes in .table files.



 There are 6 tables that are affected by migration but I don't see a pattern.

 Can someone suggest how to trace/debug this?

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


-- 
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] strange problem with DAL

2014-05-05 Thread Marin Pranjić
I copied broken database locally so I can test it.
I also added print
herehttps://github.com/web2py/web2py/blob/master/gluon/dal.py#L1353to
get actual queries.

Queries are fine. Actually if I just c/p those queries into SQLite Database
Browser, it works (on the same database file).

So it's not web2py, it's not sqlite, but it doesn't work.

-__-



On Mon, May 5, 2014 at 9:05 AM, Marin Pranjić marin.pran...@gmail.comwrote:

 Well, nothing unusual with my table definitions. Everything by the specs.
 I just removed all .table files and started with new sqlite file, and that
 problem is gone.
 (i still have copies)

 Seems that files were stuck in some state.

 However, main.message error still confuses me, because sql query that's
 created by DAL is valid.
 And this happens even after migrations are fixed.

 So it's probably SQLite that's broken/corrupted and I'm not sure if those
 issues are somehow related.

 Marin




 On Sun, May 4, 2014 at 8:58 PM, Niphlod niph...@gmail.com wrote:

 how are your table defined ? the fact that 'main.message' gets into the
 error seems a little weird for a table named message_receiver. Also, that
 success repeated into sql.log means that something really strange is
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić marin@gmail.comwrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's like
 production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for ex.
 in appadmin) it works, but when I try to insert something (appadmin or
 in-app) i get the following error:

 OperationalError: no such table: main.message




 I got the actual SQL query from the error ticket:




 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);




 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database file. It 
 has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every request 
 but nothing changes in .table files.




 There are 6 tables that are affected by migration but I don't see a 
 pattern.

 Can someone suggest how to trace/debug this?

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




-- 
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] Querying Tables from Private Folder

2014-05-05 Thread Marin Pranjić
The command written in previous message is meant to be run along with
web2py server, not instead.

If that's what you mean by isolation. Not sure if I understand the question.


Marin



On Sun, May 4, 2014 at 5:35 PM, jaw...@gmail.com wrote:

 Thanks Marin

 Is there any way to tun the script in isolation so that it can detect
 the tables?

 My current setup is that I have the web2py.py server already running and
 then running each Private script in isolation (general web scraping).


 On Sunday, 4 May 2014 09:58:38 UTC+2, Marin Pranjić wrote:

 Tables are in there but if you don't call db.define_table(...) DAL will
 not know about them.

 How are you running the script in private?


 You can do something like this:
 python web2py.py -S appname -M -R applications/appname/private/
 scriptname.py

 This will run your models before running the script, so scriptname.py
 will have access to DAL and everything.
 Of course, this expects table definitions in application's model files.

 Marin


 On Sat, May 3, 2014 at 2:03 PM, jaw...@gmail.com wrote:

  I'm trying to query my tables from the private folder:

 from gluon.tools import DAL

 db = DAL(sqlite://../databases/storage.sqlite)
 print db.tables

 However none of my tables can be seen.

 The idea is to have a better manner of extracting data rather than the
 old-school:

 with sqlite3.connect('../databases/storage.sqlite') as conn:
 c = conn.cursor()
 etc

 What am I missing?

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


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

2014-05-05 Thread DucVa
Ok. Thank you so much. But I think that last version of web2py should 
implement a function to solve the issue.

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


[web2py] Re: SQLFORM.grid pagination problem

2014-05-05 Thread Elcimar
I started adding @cache on my functions without thinking the consequences. 
For example, I have a function that returns that grid. So caching that 
function would be a bad idea. =/ 

Em domingo, 4 de maio de 2014 15h59min11s UTC-3, Niphlod escreveu:

 what do you mean by a wrong implementation of cache ?

 On Sunday, May 4, 2014 2:14:40 PM UTC+2, Elcimar wrote:

 I will keep testing it for sure.
 I also was wondering if a wrong implementation of cache would cause this. 
  



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


[web2py] SQLFORM.grid search with custom request.vars

2014-05-05 Thread Paolo Valleri
Dear all,
I've implemented a method which uses SQLFORM.grid to show a subset of a 
given table. The query that defines the subset is built using a variable 
passed to the method through request.vars.*.
Everything works as expected but search, namely when I type search for 
something all former request.vars are erased.
Actually the action url of the form is correct it has all request.vars 
variable plus the signature, when I type search all of them are replaced by 
the variable 'keywords'
Is this the expected behavior for SQLFORM.grid search?

Regards
Paolo

-- 
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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
Richard/Niphold,

Thank you so much. It's almost done. Just getting attribute error now but I 
am going to try to fix that with exception handling. 

type 'exceptions.AttributeError' 'str' object has no attribute 'year'

I have a modified_on field which is set to datetime. WHen I comment that 
out it transfers to the next page with no problem. Any thoughts on how I 
could fix?

On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So, 

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com javascript:wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ... 
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
  

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v 
 ... 
 a 1
 b 2

  

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: and 
 then says too many values to unpack. 

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

  -- 
 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 javascript:.
 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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
Also, 

When I click the submit button in {{=form}} it doesn't actually submit 
anything. It just doubles the values that are already in the fields and 
puts them into a list. I think I need to do something like db.insert with a 
new ID number for the submit button.

On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error now but 
 I am going to try to fix that with exception handling. 

 type 'exceptions.AttributeError' 'str' object has no attribute 'year'

 I have a modified_on field which is set to datetime. WHen I comment that 
 out it transfers to the next page with no problem. Any thoughts on how I 
 could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So, 

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ... 
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
  

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v 
 ... 
 a 1
 b 2

  

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: and 
 then says too many values to unpack. 

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

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


Re: [web2py] Re: Create a copy record button in SQLFORM?

2014-05-05 Thread Richard Vézina
Please show code!!

Richard


On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayloru...@gmail.com wrote:

 Also,

 When I click the submit button in {{=form}} it doesn't actually submit
 anything. It just doubles the values that are already in the fields and
 puts them into a list. I think I need to do something like db.insert with a
 new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error now but
 I am going to try to fix that with exception handling.

 type 'exceptions.AttributeError' 'str' object has no attribute 'year'

 I have a modified_on field which is set to datetime. WHen I comment that
 out it transfers to the next page with no problem. Any thoughts on how I
 could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So,

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ...
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
 

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v
 ...
 a 1
 b 2

 

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: and
 then says too many values to unpack.

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

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


-- 
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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
Hi Richard,

Here is what I have so far:

Controllers:
def user_list():
 grid=SQLFORM.smartgrid(db.users, paginate=20, links_placement='left', 
_href=URL('transition_form', vars=dict((f, row[f]) for f in 
db.users.fields], user_signature=True)
 return dict(grid=grid)

def transition_form():
 for f, v in request.vars:
 db.table[f].default = v
 form = SQLFORM(db.table, user_signature=True)
return dict(form=form)

View:
user_list.html
{{=form}}

This properly populates the values. but it isn't submitting properly. After 
the form submits I would like it to return to the database and show me the 
user that was just added. Also, I set my database to autoincrement the ID 
which should solve the id problem

I was thinking I could set something in my transition_form function that if 
form.process().accepted: redirect(URL('user_list')), but I get an error 
saying table object has no attribute '_formkey' does this mean I need to do 
some type of form validation?

On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 Also, 

 When I click the submit button in {{=form}} it doesn't actually submit 
 anything. It just doubles the values that are already in the fields and 
 puts them into a list. I think I need to do something like db.insert with a 
 new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error now 
 but I am going to try to fix that with exception handling. 

 type 'exceptions.AttributeError' 'str' object has no attribute 'year'

 I have a modified_on field which is set to datetime. WHen I comment that 
 out it transfers to the next page with no problem. Any thoughts on how I 
 could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So, 

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ... 
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
  

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v 
 ... 
 a 1
 b 2

  

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: and 
 then says too many values to unpack. 

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

  -- 
 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+un...@googlegroups.com javascript:.
 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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
Sorry forgot to add .iteritems(): this is the most updated version.

On Monday, May 5, 2014 10:01:46 AM UTC-4, LoveWeb2py wrote:

 Hi Richard,

 Here is what I have so far:

 Controllers:
 def user_list():
  grid=SQLFORM.smartgrid(db.users, paginate=20, links_placement='left', 
 _href=URL('transition_form', vars=dict((f, row[f]) for f in 
 db.users.fields], user_signature=True)
  return dict(grid=grid)

 def transition_form():
  for f, v in request.vars.iteritems():
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 View:
 user_list.html
 {{=form}}

 This properly populates the values. but it isn't submitting properly. 
 After the form submits I would like it to return to the database and show 
 me the user that was just added. Also, I set my database to autoincrement 
 the ID which should solve the id problem

 I was thinking I could set something in my transition_form function that 
 if form.process().accepted: redirect(URL('user_list')), but I get an error 
 saying table object has no attribute '_formkey' does this mean I need to do 
 some type of form validation?

 On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.com wrote:

 Also, 

 When I click the submit button in {{=form}} it doesn't actually submit 
 anything. It just doubles the values that are already in the fields and 
 puts them into a list. I think I need to do something like db.insert with a 
 new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error now 
 but I am going to try to fix that with exception handling. 

 type 'exceptions.AttributeError' 'str' object has no attribute 'year'

 I have a modified_on field which is set to datetime. WHen I comment 
 that out it transfers to the next page with no problem. Any thoughts on 
 how 
 I could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So, 

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ... 
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
  

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v 
 ... 
 a 1
 b 2

  

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: and 
 then says too many values to unpack. 

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

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


Re: [web2py] Re: Create a copy record button in SQLFORM?

2014-05-05 Thread Richard Vézina
That what I thought!

How do you validate your form??

Please read the book a bit more about form submission...



http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM

def display_form():
   form = SQLFORM(db.person)
   if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
   response.flash = 'form has errors'
   else:
   response.flash = 'please fill out the form'
   return dict(form=form)


You need to process the form, see if it validate... You shouldn't have to
insert manually your data if you don't need facy thing and
form.process().accepted should handle everything for you.

Richard



On Mon, May 5, 2014 at 10:03 AM, LoveWeb2py atayloru...@gmail.com wrote:

 Sorry forgot to add .iteritems(): this is the most updated version.


 On Monday, May 5, 2014 10:01:46 AM UTC-4, LoveWeb2py wrote:

 Hi Richard,

 Here is what I have so far:

 Controllers:
 def user_list():
  grid=SQLFORM.smartgrid(db.users, paginate=20,
 links_placement='left', _href=URL('transition_form', vars=dict((f, row[f])
 for f in db.users.fields], user_signature=True)
  return dict(grid=grid)

 def transition_form():
  for f, v in request.vars.iteritems():

  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 View:
 user_list.html
 {{=form}}

 This properly populates the values. but it isn't submitting properly.
 After the form submits I would like it to return to the database and show
 me the user that was just added. Also, I set my database to autoincrement
 the ID which should solve the id problem

 I was thinking I could set something in my transition_form function that
 if form.process().accepted: redirect(URL('user_list')), but I get an error
 saying table object has no attribute '_formkey' does this mean I need to do
 some type of form validation?

 On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.com wrote:

 Also,

 When I click the submit button in {{=form}} it doesn't actually submit
 anything. It just doubles the values that are already in the fields and
 puts them into a list. I think I need to do something like db.insert with a
 new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error now
 but I am going to try to fix that with exception handling.

 type 'exceptions.AttributeError' 'str' object has no attribute 'year'

 I have a modified_on field which is set to datetime. WHen I comment
 that out it transfers to the next page with no problem. Any thoughts on 
 how
 I could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So,

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ...
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
 

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v
 ...
 a 1
 b 2

 

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars:
 and then says too many values to unpack.

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

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

Re: [web2py] Re: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
I've read that, Richard.

When using this I get that error:
def transition_form():
for f, v in request.vars.iteritems():
db.users[f].default = v
form = SQLFORM(db.users, user_signature=True)
if form.process().accepted:
response.flash = 'form accepted'
return dict(form=form)

Still get the same error :
type 'exceptions.AttributeError' 'Table' object has no attribute 
'_formkey'

On Monday, May 5, 2014 10:34:28 AM UTC-4, Richard wrote:

 That what I thought!

 How do you validate your form??

 Please read the book a bit more about form submission...



 http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM

 def display_form():
form = SQLFORM(db.person)
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form)


 You need to process the form, see if it validate... You shouldn't have to 
 insert manually your data if you don't need facy thing and 
 form.process().accepted should handle everything for you.

 Richard



 On Mon, May 5, 2014 at 10:03 AM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 Sorry forgot to add .iteritems(): this is the most updated version.


 On Monday, May 5, 2014 10:01:46 AM UTC-4, LoveWeb2py wrote:

 Hi Richard,

 Here is what I have so far:

 Controllers:
 def user_list():
  grid=SQLFORM.smartgrid(db.users, paginate=20, 
 links_placement='left', _href=URL('transition_form', vars=dict((f, row[f]) 
 for f in db.users.fields], user_signature=True)
  return dict(grid=grid)

 def transition_form():
  for f, v in request.vars.iteritems():

  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 View:
 user_list.html
 {{=form}}

 This properly populates the values. but it isn't submitting properly. 
 After the form submits I would like it to return to the database and show 
 me the user that was just added. Also, I set my database to autoincrement 
 the ID which should solve the id problem

 I was thinking I could set something in my transition_form function that 
 if form.process().accepted: redirect(URL('user_list')), but I get an error 
 saying table object has no attribute '_formkey' does this mean I need to do 
 some type of form validation?

 On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.com wrote:

 Also, 

 When I click the submit button in {{=form}} it doesn't actually submit 
 anything. It just doubles the values that are already in the fields and 
 puts them into a list. I think I need to do something like db.insert with 
 a 
 new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error now 
 but I am going to try to fix that with exception handling. 

 type 'exceptions.AttributeError' 'str' object has no attribute 
 'year'

 I have a modified_on field which is set to datetime. WHen I comment 
 that out it transfers to the next page with no problem. Any thoughts on 
 how 
 I could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So, 

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ... 
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
  

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v 
 ... 
 a 1
 b 2

  

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: 
 and then says too many values to unpack. 

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

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

Re: [web2py] Re: Create a copy record button in SQLFORM?

2014-05-05 Thread Richard Vézina
You miss this part in what you show me :

   if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
   response.flash = 'form has errors'
   else:
   response.flash = 'please fill out the form'



Avoid using user_signature at the begining, and you can add this more
secure thing latter on.

Richard



On Mon, May 5, 2014 at 10:40 AM, LoveWeb2py atayloru...@gmail.com wrote:

 I've read that, Richard.

 When using this I get that error:

 def transition_form():
 for f, v in request.vars.iteritems():
 db.users[f].default = v
 form = SQLFORM(db.users, user_signature=True)

 if form.process().accepted:
 response.flash = 'form accepted'
 return dict(form=form)

 Still get the same error :
 type 'exceptions.AttributeError' 'Table' object has no attribute
 '_formkey'


 On Monday, May 5, 2014 10:34:28 AM UTC-4, Richard wrote:

 That what I thought!

 How do you validate your form??

 Please read the book a bit more about form submission...



 http://web2py.com/books/default/chapter/29/07/forms-
 and-validators#SQLFORM

 def display_form():
form = SQLFORM(db.person)
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form)


 You need to process the form, see if it validate... You shouldn't have to
 insert manually your data if you don't need facy thing and
 form.process().accepted should handle everything for you.

 Richard



 On Mon, May 5, 2014 at 10:03 AM, LoveWeb2py atayl...@gmail.com wrote:

 Sorry forgot to add .iteritems(): this is the most updated version.


 On Monday, May 5, 2014 10:01:46 AM UTC-4, LoveWeb2py wrote:

 Hi Richard,

 Here is what I have so far:

 Controllers:
 def user_list():
  grid=SQLFORM.smartgrid(db.users, paginate=20,
 links_placement='left', _href=URL('transition_form', vars=dict((f, row[f])
 for f in db.users.fields], user_signature=True)
  return dict(grid=grid)

 def transition_form():
  for f, v in request.vars.iteritems():

  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 View:
 user_list.html
 {{=form}}

 This properly populates the values. but it isn't submitting properly.
 After the form submits I would like it to return to the database and show
 me the user that was just added. Also, I set my database to autoincrement
 the ID which should solve the id problem

 I was thinking I could set something in my transition_form function
 that if form.process().accepted: redirect(URL('user_list')), but I get an
 error saying table object has no attribute '_formkey' does this mean I need
 to do some type of form validation?

 On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.com wrote:

 Also,

 When I click the submit button in {{=form}} it doesn't actually
 submit anything. It just doubles the values that are already in the 
 fields
 and puts them into a list. I think I need to do something like db.insert
 with a new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error
 now but I am going to try to fix that with exception handling.

 type 'exceptions.AttributeError' 'str' object has no attribute
 'year'

 I have a modified_on field which is set to datetime. WHen I comment
 that out it transfers to the next page with no problem. Any thoughts on 
 how
 I could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So,

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ...
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
 

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v
 ...
 a 1
 b 2

 

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars:
 and then says too many values to unpack.

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

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

Re: [web2py] Re: Can I simulate multiple user logins to web2py from a single computer?

2014-05-05 Thread Rufus Smith

Hi Robert,

I noticed that!  I fired up Chrome, and it started a different 
session.   Haven't tried with IE, and until now haven't worked with 
Safari on my desktop. (but on my iphone, yeah).  As the project gets 
closer to a beta stage,  I'll look at compatibility...


Rufus

On 5/5/2014 2:19 AM, Robert Kooij wrote:
Or if you want to keep it even simpler, just use multiple (different) 
browsers, each browser keep track of their own session.


I assume, as a web developer you have Chrome, Firefox and Safari 
installed anyway? Should be able to simulate 3 different user to start 
with. :)



On Monday, May 5, 2014 1:35:56 AM UTC+2, Rufus wrote:

Web2py'ers:

I am trying to create a back end for a multiple user game,
including, for instance, a chat room function.
However, when I try to do this locally, all windows change over to
the most recent login.

That is to say, I open up another window to the app, sign in with
a different user id, and type.into
the chat app, and get the new message.  But if I go to one of the
other formerly signed in windows
and try to chat, it submits as most recently logged in user.

Can I have multiple sessions/log ins from a single computer?

This may be a security issue, but would be useful for testing if
it could be overridden, even temporarily.

Rufus

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the 
Google Groups web2py-users group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/web2py/kT6TxT3XSzo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
web2py+unsubscr...@googlegroups.com 
mailto: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] SQLFORM.grid search with custom request.vars

2014-05-05 Thread Richard Vézina
Maybe there is a need for vars property that could work similarily as args
of SQLFORM.grid?

Richard


On Mon, May 5, 2014 at 8:28 AM, Paolo Valleri paolo.vall...@gmail.comwrote:

 Dear all,
 I've implemented a method which uses SQLFORM.grid to show a subset of a
 given table. The query that defines the subset is built using a variable
 passed to the method through request.vars.*.
 Everything works as expected but search, namely when I type search for
 something all former request.vars are erased.
 Actually the action url of the form is correct it has all request.vars
 variable plus the signature, when I type search all of them are replaced by
 the variable 'keywords'
 Is this the expected behavior for SQLFORM.grid search?

 Regards
 Paolo

 --
 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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
Still doesn't work. Says I'm missing _formkey. Also worth noting right 
when I get to the form it says 'please fill out the form' as in its 
processing the else already before it even accepts the data...

On Monday, May 5, 2014 11:13:09 AM UTC-4, Richard wrote:

 You miss this part in what you show me :

if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'



 Avoid using user_signature at the begining, and you can add this more 
 secure thing latter on.

 Richard



 On Mon, May 5, 2014 at 10:40 AM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 I've read that, Richard.

 When using this I get that error:

 def transition_form():
 for f, v in request.vars.iteritems():
 db.users[f].default = v
 form = SQLFORM(db.users, user_signature=True)

 if form.process().accepted:
 response.flash = 'form accepted'
 return dict(form=form)

 Still get the same error :
 type 'exceptions.AttributeError' 'Table' object has no attribute 
 '_formkey'


 On Monday, May 5, 2014 10:34:28 AM UTC-4, Richard wrote:

 That what I thought!

 How do you validate your form??

 Please read the book a bit more about form submission...



 http://web2py.com/books/default/chapter/29/07/forms-
 and-validators#SQLFORM

 def display_form():
form = SQLFORM(db.person)
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form)


 You need to process the form, see if it validate... You shouldn't have 
 to insert manually your data if you don't need facy thing and 
 form.process().accepted should handle everything for you.

 Richard



 On Mon, May 5, 2014 at 10:03 AM, LoveWeb2py atayl...@gmail.com wrote:

 Sorry forgot to add .iteritems(): this is the most updated version.


 On Monday, May 5, 2014 10:01:46 AM UTC-4, LoveWeb2py wrote:

 Hi Richard,

 Here is what I have so far:

 Controllers:
 def user_list():
  grid=SQLFORM.smartgrid(db.users, paginate=20, 
 links_placement='left', _href=URL('transition_form', vars=dict((f, 
 row[f]) 
 for f in db.users.fields], user_signature=True)
  return dict(grid=grid)

 def transition_form():
  for f, v in request.vars.iteritems():

  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 View:
 user_list.html
 {{=form}}

 This properly populates the values. but it isn't submitting properly. 
 After the form submits I would like it to return to the database and show 
 me the user that was just added. Also, I set my database to autoincrement 
 the ID which should solve the id problem

 I was thinking I could set something in my transition_form function 
 that if form.process().accepted: redirect(URL('user_list')), but I get an 
 error saying table object has no attribute '_formkey' does this mean I 
 need 
 to do some type of form validation?

 On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.comwrote:

 Also, 

 When I click the submit button in {{=form}} it doesn't actually 
 submit anything. It just doubles the values that are already in the 
 fields 
 and puts them into a list. I think I need to do something like 
 db.insert 
 with a new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error 
 now but I am going to try to fix that with exception handling. 

 type 'exceptions.AttributeError' 'str' object has no attribute 
 'year'

 I have a modified_on field which is set to datetime. WHen I comment 
 that out it transfers to the next page with no problem. Any thoughts 
 on how 
 I could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So, 

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ... 
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
  

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v 
 ... 
 a 1
 b 2

  

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in request.vars: 
 and then says too many values to unpack. 

 my function is def transition_form():
  for f, v in request.vars:
  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 Should I have extra values in the dict method?

  -- 
 

[web2py] Re: Admin is disabled because insecure channel error Hosting web2py app on Amazon EC2 Linux server

2014-05-05 Thread Martin Lohner
Hi...

try this:
request.is_local=True
in 
web2py\applications\admin\models\access.py  (on line 21) resp. before  this 
code:

*if request.env.http_x_forwarded_for or request.is_https:*
*session.secure()*
*elif not request.is_local and not DEMO_MODE:*
*raise HTTP(200, T('Admin is disabled because insecure channel'))*


ml

Dne neděle, 20. dubna 2014 20:52:28 UTC+2 Pawan Gupta napsal(a):

 Hi Everyone

 We are having serious problem with our website 911india.com. We have 
 hosted it on Amazon EC2 server and there is a ticket that is issued which 
 redirects us to the admin interface that shows Admin is disabled because 
 insecure channel 

 I tried searching on the website but nothing seems to make sense probably 
 because we are somewhat beginners. 

 Can someone please help us with what could be done to resolve this.


 Cheers

 Pawan


-- 
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: Create a copy record button in SQLFORM?

2014-05-05 Thread Richard Vézina
Would you please show the exact code, the one for the SQLFORM.grid funciton
and the one for the SQLFORM function...

Richard


On Mon, May 5, 2014 at 11:33 AM, LoveWeb2py atayloru...@gmail.com wrote:

 Still doesn't work. Says I'm missing _formkey. Also worth noting right
 when I get to the form it says 'please fill out the form' as in its
 processing the else already before it even accepts the data...


 On Monday, May 5, 2014 11:13:09 AM UTC-4, Richard wrote:

 You miss this part in what you show me :

if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'



 Avoid using user_signature at the begining, and you can add this more
 secure thing latter on.

 Richard



 On Mon, May 5, 2014 at 10:40 AM, LoveWeb2py atayl...@gmail.com wrote:

 I've read that, Richard.

 When using this I get that error:

 def transition_form():
 for f, v in request.vars.iteritems():
 db.users[f].default = v
 form = SQLFORM(db.users, user_signature=True)

 if form.process().accepted:
 response.flash = 'form accepted'
 return dict(form=form)

 Still get the same error :
 type 'exceptions.AttributeError' 'Table' object has no attribute
 '_formkey'


 On Monday, May 5, 2014 10:34:28 AM UTC-4, Richard wrote:

 That what I thought!

 How do you validate your form??

 Please read the book a bit more about form submission...



 http://web2py.com/books/default/chapter/29/07/forms-and-
 validators#SQLFORM

 def display_form():
form = SQLFORM(db.person)
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form)


 You need to process the form, see if it validate... You shouldn't have
 to insert manually your data if you don't need facy thing and
 form.process().accepted should handle everything for you.

 Richard



 On Mon, May 5, 2014 at 10:03 AM, LoveWeb2py atayl...@gmail.com wrote:

 Sorry forgot to add .iteritems(): this is the most updated version.


 On Monday, May 5, 2014 10:01:46 AM UTC-4, LoveWeb2py wrote:

 Hi Richard,

 Here is what I have so far:

 Controllers:
 def user_list():
  grid=SQLFORM.smartgrid(db.users, paginate=20,
 links_placement='left', _href=URL('transition_form', vars=dict((f, 
 row[f])
 for f in db.users.fields], user_signature=True)
  return dict(grid=grid)

 def transition_form():
  for f, v in request.vars.iteritems():

  db.table[f].default = v
  form = SQLFORM(db.table, user_signature=True)
 return dict(form=form)

 View:
 user_list.html
 {{=form}}

 This properly populates the values. but it isn't submitting properly.
 After the form submits I would like it to return to the database and show
 me the user that was just added. Also, I set my database to autoincrement
 the ID which should solve the id problem

 I was thinking I could set something in my transition_form function
 that if form.process().accepted: redirect(URL('user_list')), but I get an
 error saying table object has no attribute '_formkey' does this mean I 
 need
 to do some type of form validation?

 On Monday, May 5, 2014 9:53:38 AM UTC-4, Richard wrote:

 Please show code!!

 Richard


 On Mon, May 5, 2014 at 8:50 AM, LoveWeb2py atayl...@gmail.comwrote:

 Also,

 When I click the submit button in {{=form}} it doesn't actually
 submit anything. It just doubles the values that are already in the 
 fields
 and puts them into a list. I think I need to do something like 
 db.insert
 with a new ID number for the submit button.


 On Monday, May 5, 2014 8:46:25 AM UTC-4, LoveWeb2py wrote:

 Richard/Niphold,

 Thank you so much. It's almost done. Just getting attribute error
 now but I am going to try to fix that with exception handling.

 type 'exceptions.AttributeError' 'str' object has no attribute
 'year'

 I have a modified_on field which is set to datetime. WHen I
 comment that out it transfers to the next page with no problem. Any
 thoughts on how I could fix?

 On Sunday, May 4, 2014 9:10:55 AM UTC-4, Richard wrote:

 Sorry for miss leading, Niphold is true...

 So,

 for f, v in request.vars.iteritmes():
  db.table[f].default = v


 On Sat, May 3, 2014 at 8:47 AM, Niphlod nip...@gmail.com wrote:

 request.vars is like a dict. Surely you're hitting that issue :-P

  test = dict(a=1,b=2)
  for k,v in test:
 ...print k, v
 ...
 Traceback (most recent call last):
   File stdin, line 1, in module
 ValueError: need more than 1 value to unpack
 

 Add an iteritems() and you're good to go

  for k,v in test.iteritems():
 ... print k,v
 ...
 a 1
 b 2

 

 On Friday, May 2, 2014 11:20:40 PM UTC+2, LoveWeb2py wrote:

 Web2py admin console has a red line at for f, v in
 request.vars: and then says too many values to unpack.

 my function is def transition_form():
  for f, v in request.vars:
 

[web2py] web2py conference - online talks

2014-05-05 Thread Massimo Di Pierro
Please find below the links to the video of the first web2py conference. 
Videos are not broken into talks. 
There is no audio for the first 2minutes but no talk either, only service 
announcements.


*Part #1 (from start to lunch break)*

https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183272

10:00-10:10! Conference Opening

10:10-10:20! “What's New with the PSF” by Brian Curtin

10:20-11:00! “History of web2py” by Massimo Di Pierro

11:00-11:40! Learn web2py the Really Hard Way by Anthony Bastardi 
11:40-12:20! Stereodose by Mark Li

12:20-12:30! Planet Host by Jason Burosh

*Part #2 (from tutorial to coffee break)*

https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183273

13:00:13:40! hands-on web2py tutorial by Clifford Williams

13:40-14:20! Angular and web2py by Amber Doctor

14:20-14:40 ! Stitching together the tree of life with web2py by Richard 
Ree 1

4:40-15:00! ShipElf: Automated Fulfillment with Web2Py by Peter 
Szczepanski 

15:00-15:20! MyIRE - What is Open Source Science? by Mark Graves 

15:20-15:40! Introduction to Mongodb by Marco Chou

*Part #3 (from coffee break to end)*

https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183274

16:00-16:20! Introduction to OpenShift by Craig Brott

16:20-16:40! Introduction to Hypermedia API by Bryan Barnard 

16:40-17:00! web2py and the Semantic web by Chris Baron 

17:00-17-20! Teaching an old dog new tricks by Don O'Hara 

17:20-17:30! Conference Closing

-- 
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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
Controllers:
@auth.requires_login()
def users_list():
grid=SQLFROM.smartgrid(db.users, paginate=20, links_placement='left',
 links=[dict(header='', body=lambda row: A(I(_class='icon retweet 
icon-retweet'),
 _href=URL('transition_form', vars=dict((f, row[f]) for f in 
db.users.fields], user_signature=True)
return dict(grid=grid)

@auth.requires_login()
def transition_form():
for f, v in request.vars.iteritems():
   db.users[f].default = v
form = SQLFORM(db.users)
if form.process().accepted:
   response.flash = 'form accepted'
elif form.errors:
response.flash = 'errors on page'
else:
response.flash = 'facepalm'

return dict(form=form)

It populates the transition_form properly it just doesn't insert the new 
record when I click submit. It just doubles the record and returns the 
response in the view. Also, when loading the transition_form page it 
automatically flashes with 'facepalm' which means its processing the form 
on load.

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


[web2py] Re: web2py conference - online talks

2014-05-05 Thread Omi Chiba
Thank your for sharing the link. It was the best conference ever! I was so 
excited and arrived around 8:20am. No body was there just me, which makes 
me the first attendee for the first web2py conference : ) 

Sorry. I have to leave after lunch to take care my family but I will check 
the videos this afternoon. It was really fun because everyone talk about 
web2py and it's really cool I can meet Anthony who help me A LOT in this 
online forum. 

On Monday, May 5, 2014 10:55:28 AM UTC-5, Massimo Di Pierro wrote:

 Please find below the links to the video of the first web2py conference. 
 Videos are not broken into talks. 
 There is no audio for the first 2minutes but no talk either, only service 
 announcements.


 *Part #1 (from start to lunch break)*

 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183272

 10:00-10:10! Conference Opening

 10:10-10:20! “What's New with the PSF” by Brian Curtin

 10:20-11:00! “History of web2py” by Massimo Di Pierro

 11:00-11:40! Learn web2py the Really Hard Way by Anthony Bastardi 
 11:40-12:20! Stereodose by Mark Li

 12:20-12:30! Planet Host by Jason Burosh

 *Part #2 (from tutorial to coffee break)*

 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183273

 13:00:13:40! hands-on web2py tutorial by Clifford Williams

 13:40-14:20! Angular and web2py by Amber Doctor

 14:20-14:40 ! Stitching together the tree of life with web2py by Richard 
 Ree 1

 4:40-15:00! ShipElf: Automated Fulfillment with Web2Py by Peter 
 Szczepanski 

 15:00-15:20! MyIRE - What is Open Source Science? by Mark Graves 

 15:20-15:40! Introduction to Mongodb by Marco Chou

 *Part #3 (from coffee break to end)*

 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183274

 16:00-16:20! Introduction to OpenShift by Craig Brott

 16:20-16:40! Introduction to Hypermedia API by Bryan Barnard 

 16:40-17:00! web2py and the Semantic web by Chris Baron 

 17:00-17-20! Teaching an old dog new tricks by Don O'Hara 

 17:20-17:30! Conference Closing


-- 
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: Create a copy record button in SQLFORM?

2014-05-05 Thread Richard Vézina
You got 'facepalm' because it's not process the form when you get
redirected... Since you don't redirect once the form get accepted and
process web2py return the same function once the form validate and get
process. Now maybe you should delete the request.vars once you have assign
them as default value... An other issue maybe related to the fact that your
vars names are the same of form.vars... I had issue with name collision in
the pass deleting the request.vars after iteratio on it may help.

Richard


On Mon, May 5, 2014 at 11:57 AM, LoveWeb2py atayloru...@gmail.com wrote:

 Controllers:
 @auth.requires_login()
 def users_list():
 grid=SQLFROM.smartgrid(db.users, paginate=20, links_placement='left',
  links=[dict(header='', body=lambda row: A(I(_class='icon retweet
 icon-retweet'),

  _href=URL('transition_form', vars=dict((f, row[f]) for f in
 db.users.fields], user_signature=True)
 return dict(grid=grid)

 @auth.requires_login()

 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)

 if form.process().accepted:
response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 It populates the transition_form properly it just doesn't insert the new
 record when I click submit. It just doubles the record and returns the
 response in the view. Also, when loading the transition_form page it
 automatically flashes with 'facepalm' which means its processing the form
 on load.

 --
 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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
I tried adding
def transition_form():
for f, v in request.vars.iteritems():
   db.users[f].default = v
form = SQLFORM(db.users)
response.vars = ''
if form.process().accepted:
   response.flash = 'form accepted'
   redirect(URL('users_list'))
elif form.errors:
response.flash = 'errors on page'
else:
response.flash = 'facepalm'

return dict(form=form)

but the same issue of 'Table' object has no attribute '_formkey' still 
exist. I checked with firebug and the _formkey is under hidden values so it 
is posting, but for some reason the page isn't picking it up... 

On Monday, May 5, 2014 12:12:29 PM UTC-4, Richard wrote:

 You got 'facepalm' because it's not process the form when you get 
 redirected... Since you don't redirect once the form get accepted and 
 process web2py return the same function once the form validate and get 
 process. Now maybe you should delete the request.vars once you have assign 
 them as default value... An other issue maybe related to the fact that your 
 vars names are the same of form.vars... I had issue with name collision in 
 the pass deleting the request.vars after iteratio on it may help.

 Richard


 On Mon, May 5, 2014 at 11:57 AM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 Controllers:
 @auth.requires_login()
 def users_list():
 grid=SQLFROM.smartgrid(db.users, paginate=20, links_placement='left',
  links=[dict(header='', body=lambda row: A(I(_class='icon retweet 
 icon-retweet'),

  _href=URL('transition_form', vars=dict((f, row[f]) for f in 
 db.users.fields], user_signature=True)
 return dict(grid=grid)

 @auth.requires_login()

 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)

 if form.process().accepted:
response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 It populates the transition_form properly it just doesn't insert the new 
 record when I click submit. It just doubles the record and returns the 
 response in the view. Also, when loading the transition_form page it 
 automatically flashes with 'facepalm' which means its processing the form 
 on load.
  
 -- 
 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 javascript:.
 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: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
I created a clean function and removed the  for f, v in 
request.vars.iteritems():db.users[f].default = v and the form works fine 
and properly redirects upon submit. So it has to be something with the for 
loop?
def transition_form():
form = SQLFORM(db.users)
response.vars = ''
if form.process().accepted:
   response.flash = 'form accepted'
   redirect(URL('users_list'))
elif form.errors:
response.flash = 'errors on page'
else:
response.flash = 'facepalm'

return dict(form=form)

On Monday, May 5, 2014 12:21:29 PM UTC-4, LoveWeb2py wrote:

 I tried adding
 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)
 response.vars = ''
 if form.process().accepted:
response.flash = 'form accepted'
redirect(URL('users_list'))
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 but the same issue of 'Table' object has no attribute '_formkey' still 
 exist. I checked with firebug and the _formkey is under hidden values so it 
 is posting, but for some reason the page isn't picking it up... 

 On Monday, May 5, 2014 12:12:29 PM UTC-4, Richard wrote:

 You got 'facepalm' because it's not process the form when you get 
 redirected... Since you don't redirect once the form get accepted and 
 process web2py return the same function once the form validate and get 
 process. Now maybe you should delete the request.vars once you have assign 
 them as default value... An other issue maybe related to the fact that your 
 vars names are the same of form.vars... I had issue with name collision in 
 the pass deleting the request.vars after iteratio on it may help.

 Richard


 On Mon, May 5, 2014 at 11:57 AM, LoveWeb2py atayl...@gmail.com wrote:

 Controllers:
 @auth.requires_login()
 def users_list():
 grid=SQLFROM.smartgrid(db.users, paginate=20, links_placement='left',
  links=[dict(header='', body=lambda row: A(I(_class='icon 
 retweet icon-retweet'),

  _href=URL('transition_form', vars=dict((f, row[f]) for f in 
 db.users.fields], user_signature=True)
 return dict(grid=grid)

 @auth.requires_login()

 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)

 if form.process().accepted:
response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 It populates the transition_form properly it just doesn't insert the new 
 record when I click submit. It just doubles the record and returns the 
 response in the view. Also, when loading the transition_form page it 
 automatically flashes with 'facepalm' which means its processing the form 
 on load.
  
 -- 
 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.


Re: [web2py] Re: Create a copy record button in SQLFORM?

2014-05-05 Thread LoveWeb2py
I figured it out, but its not the most pythonic way of doing things. I had 
to specify db.users['dictKey'].default = request.vars['dictKey] for all 20 
fields. 

Again it works, just not sure why the for loop was throwing it off. Thanks 
so much for your help, Richard!!

On Monday, May 5, 2014 12:27:16 PM UTC-4, LoveWeb2py wrote:

 I created a clean function and removed the  for f, v in 
 request.vars.iteritems():db.users[f].default = v and the form works fine 
 and properly redirects upon submit. So it has to be something with the for 
 loop?
 def transition_form():
 form = SQLFORM(db.users)
 response.vars = ''
 if form.process().accepted:
response.flash = 'form accepted'
redirect(URL('users_list'))
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 On Monday, May 5, 2014 12:21:29 PM UTC-4, LoveWeb2py wrote:

 I tried adding
 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)
 response.vars = ''
 if form.process().accepted:
response.flash = 'form accepted'
redirect(URL('users_list'))
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 but the same issue of 'Table' object has no attribute '_formkey' still 
 exist. I checked with firebug and the _formkey is under hidden values so it 
 is posting, but for some reason the page isn't picking it up... 

 On Monday, May 5, 2014 12:12:29 PM UTC-4, Richard wrote:

 You got 'facepalm' because it's not process the form when you get 
 redirected... Since you don't redirect once the form get accepted and 
 process web2py return the same function once the form validate and get 
 process. Now maybe you should delete the request.vars once you have assign 
 them as default value... An other issue maybe related to the fact that your 
 vars names are the same of form.vars... I had issue with name collision in 
 the pass deleting the request.vars after iteratio on it may help.

 Richard


 On Mon, May 5, 2014 at 11:57 AM, LoveWeb2py atayl...@gmail.com wrote:

 Controllers:
 @auth.requires_login()
 def users_list():
 grid=SQLFROM.smartgrid(db.users, paginate=20, 
 links_placement='left',
  links=[dict(header='', body=lambda row: A(I(_class='icon 
 retweet icon-retweet'),

  _href=URL('transition_form', vars=dict((f, row[f]) for f in 
 db.users.fields], user_signature=True)
 return dict(grid=grid)

 @auth.requires_login()

 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)

 if form.process().accepted:
response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 It populates the transition_form properly it just doesn't insert the 
 new record when I click submit. It just doubles the record and returns the 
 response in the view. Also, when loading the transition_form page it 
 automatically flashes with 'facepalm' which means its processing the form 
 on load.
  
 -- 
 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.


Re: [web2py] Re: Create a copy record button in SQLFORM?

2014-05-05 Thread Richard Vézina
do request.vars.clear() instead of response.vars = ''

Richard




On Mon, May 5, 2014 at 12:59 PM, LoveWeb2py atayloru...@gmail.com wrote:

 I figured it out, but its not the most pythonic way of doing things. I had
 to specify db.users['dictKey'].default = request.vars['dictKey] for all 20
 fields.

 Again it works, just not sure why the for loop was throwing it off. Thanks
 so much for your help, Richard!!


 On Monday, May 5, 2014 12:27:16 PM UTC-4, LoveWeb2py wrote:

 I created a clean function and removed the  for f, v in
 request.vars.iteritems():db.users[f].default = v and the form works
 fine and properly redirects upon submit. So it has to be something with the
 for loop?
 def transition_form():
 form = SQLFORM(db.users)
 response.vars = ''
 if form.process().accepted:
response.flash = 'form accepted'
redirect(URL('users_list'))
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 On Monday, May 5, 2014 12:21:29 PM UTC-4, LoveWeb2py wrote:

 I tried adding
 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)
 response.vars = ''
 if form.process().accepted:
response.flash = 'form accepted'
redirect(URL('users_list'))
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 but the same issue of 'Table' object has no attribute '_formkey' still
 exist. I checked with firebug and the _formkey is under hidden values so it
 is posting, but for some reason the page isn't picking it up...

 On Monday, May 5, 2014 12:12:29 PM UTC-4, Richard wrote:

 You got 'facepalm' because it's not process the form when you get
 redirected... Since you don't redirect once the form get accepted and
 process web2py return the same function once the form validate and get
 process. Now maybe you should delete the request.vars once you have assign
 them as default value... An other issue maybe related to the fact that your
 vars names are the same of form.vars... I had issue with name collision in
 the pass deleting the request.vars after iteratio on it may help.

 Richard


 On Mon, May 5, 2014 at 11:57 AM, LoveWeb2py atayl...@gmail.com wrote:

 Controllers:
 @auth.requires_login()
 def users_list():
 grid=SQLFROM.smartgrid(db.users, paginate=20,
 links_placement='left',
  links=[dict(header='', body=lambda row: A(I(_class='icon
 retweet icon-retweet'),

  _href=URL('transition_form', vars=dict((f, row[f]) for f in
 db.users.fields], user_signature=True)
 return dict(grid=grid)

 @auth.requires_login()

 def transition_form():
 for f, v in request.vars.iteritems():
db.users[f].default = v
 form = SQLFORM(db.users)

 if form.process().accepted:
response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'errors on page'
 else:
 response.flash = 'facepalm'

 return dict(form=form)

 It populates the transition_form properly it just doesn't insert the
 new record when I click submit. It just doubles the record and returns the
 response in the view. Also, when loading the transition_form page it
 automatically flashes with 'facepalm' which means its processing the form
 on load.

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


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


[web2py] Re: web2py conference - online talks

2014-05-05 Thread Massimo Di Pierro
I forgot. Here is the opening video:

https://www.youtube.com/watch?v=RVSRnCxSuUk

-- 
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: Howto deploy web2py on a shared host?

2014-05-05 Thread jansende
Thanks for the suggestion NeoToren. However I'm already paying my provider 
and don't consider changing 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.


[web2py] Upload image using RESTful api

2014-05-05 Thread iw3ijq
Hi!

I have a SQLFORM with some filelds and an image (like example here: 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM).

I have to populate the database using a python script. So I made a generic 
restful api:

@request.restful()
def api():
response.view = 'generic.'+request.extension
def GET(*args,**vars):
patterns = [':auto[products]',
'/products/code/{products.code}',
'/products/code/{products.code}/:field',
'/products/image_filename/{products.image_filename}',

'/products/image_filename/{products.image_filename}/:field',
   ]
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
def POST(table_name,**vars):
return db[table_name].validate_and_insert(**vars)
def PUT(table_name,record_id,**vars):
return db(db[table_name]._id==record_id).validate_and_update(**vars)
def DELETE(table_name,record_id):
return db(db[table_name]._id==record_id).delete()
return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)

On python script  I use requests.post and genercs fields are ok.
I used sintax from here ( 
http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
 
). /
This upload generally work but I have a big problem:
uploading file from browser I find on DB the encoded name of file, and dhe 
file on filesystem.
Uploading from restful I find on db, instead of encoded file name, this:

'FieldStorage(''image'', ''test_image.jpg'', ''...binary data of image'')'

What's the correct way to upload a file using restful api?

-- 
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] extract file from blob/bytea to store it on file system

2014-05-05 Thread Richard Vézina
Not elegant, but finally works :

rows = db().select(db.mytable.id, db.mytable.upload_field,
db.mytable.upload_field_blob)
for i, row in enumerate(rows):
if row.upload_field != '' and row.upload_field is not None:
file = cStringIO.StringIO()
file.write(row.upload_field_blob)
db(db.mytable.id == row.id).update(
upload_field_upload=db.mytable.upload_field_upload.store(
file=file,

filename=db.mytable.upload_field.retrieve(row.upload_field)[0],
path=None))
db.commit()

filename =
db.mytable.upload_field_upload.retrieve(db.mytable(row.id).upload_field_upload,
nameonly=True)[1].split('/')[-1]
separate_folder_name =
db.mytable.upload_field_upload.retrieve(db.mytable(row.id
).upload_field_upload,

nameonly=True)[1].split('/')[-1].split('.')[2][:2]
path_tuple = (request.folder, 'uploads',
str(db.mytable.upload_field_upload), separate_folder_name)
path = os.path.join(*path_tuple)
if not os.path.exists(path):
os.makedirs(path)

f = open(os.path.join(path, filename), 'w')
f.write(row.upload_field_blob)
f.close()

Can't figure it out why file don't get wrote by .store() method... I mean
files get create with 0K, and I have to overwrite them with the code below
the db.commit()

:(

At least it works, if I can find why file don't get wrote in the first
place I may consider making a slice, but now it is to hacky... I get the
work done at least...

:)

Richard


On Sun, May 4, 2014 at 3:56 PM, Richard Vézina
ml.richard.vez...@gmail.comwrote:

 In [16]: db.mytable.fieldname_field.retrieve(row.fieldname_field,
 nameonly=True)[1]
 Out[16]: cStringIO.StringI at 0x48cf9f0

 In [17]: db.mytable.fieldname_field.retrieve(row.fieldname_field)[1]
 Out[17]: cStringIO.StringI at 0x48cf9f0

 Idem :(

 Richard


 On Sun, May 4, 2014 at 3:49 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I saw the StringIO content of the blob. I had write a file manually with
 that blob content... I may have not look carefully... I will have another
 look.

 Richard


 On Sun, May 4, 2014 at 2:51 PM, Niphlod niph...@gmail.com wrote:

 not sure what you want to accomplish but


 http://web2py.readthedocs.org/en/latest/dal.html#gluon.dal.DAL.Field.retrieve

 you're using nameonly, that explicitely doesn't return any content.


 On Sunday, May 4, 2014 7:58:03 PM UTC+2, Richard wrote:

 Hello,

 I try to extract file from upload field of type blob to store my files
 on file system instead.

 I get there so far :

 rows = db().select(db.mytable.id, db.mytable.filename_field,
 db.mytable.blob_field)
 for i, row in enumerate(rows):
 if row.filename_field != '' and row.filename_field is not None:
 db(db.mytable.id == row.id).update(
 new_field_upload=db.mytable.filename_field.store(
 db.mytable.filename_field.retrieve(row.filename_field,
 nameonly=True)[1],  # Blob content, the file
 db.mytable.filename_field.retrieve(row.filename_field,
 nameonly=True)[0],  # Filename
 None
 ))
 if i % 10 == 0:
 db.commit()

 db.commit()


 The filename get created and sotered correctly in  new_field_upload,
 but the file from the blob content don't get write in
 uploads/mytable.new_field_upload/HERE_IN_SUB_RANDOM_FOLDER_NAMES

 Notting get write to disk... Is .store() method not suppose to doing
 just that?

 I will make a slice about that if I can get it to work properly.

 I was despointed this snippet wasn't there already.

 :(

 Thanks

 Richard

  --
 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: web2py conference - online talks

2014-05-05 Thread Richard Vézina
+1, reallly funny stuff...

Richard


On Mon, May 5, 2014 at 1:37 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 I forgot. Here is the opening video:

 https://www.youtube.com/watch?v=RVSRnCxSuUk

 --
 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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
I had a list of addresses I was using on my user db and when I switched the 
field from string to string.list it truncated all of my values. I have over 
1000 customers in there. 

Is there an explanation for this? It cut off the first and last character 
for example: 123 field road is now 23 field roa

Is there any way to roll back???!

-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
If you didn't backup db before makee your change I guess no...

Rollback as notting to do there, it is a migration matter and the way
web2py handle this process...

If were create a new field, the old field would stay there, because web2py
migration don't delete field, but since you change field type, web2py had
try to make it best to handle the situation...

Which DBMS do you use?

If you have the data somewhere else, just reload them.

Richard




On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayloru...@gmail.com wrote:

 I had a list of addresses I was using on my user db and when I switched
 the field from string to string.list it truncated all of my values. I have
 over 1000 customers in there.

 Is there an explanation for this? It cut off the first and last character
 for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

  --
 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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
I am using MYSQL. So it actually didn't affect the database itself. What it 
did was just change the way the data is represented in SQLFORM. Very 
interesting. How could I properly represent it?

On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the way 
 web2py handle this process... 

 If were create a new field, the old field would stay there, because web2py 
 migration don't delete field, but since you change field type, web2py had 
 try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




 On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 I had a list of addresses I was using on my user db and when I switched 
 the field from string to string.list it truncated all of my values. I have 
 over 1000 customers in there. 

 Is there an explanation for this? It cut off the first and last character 
 for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

  -- 
 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 javascript:.
 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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
Are you talking about field type or representation or requires that all
differents?

Without code can't help...

Sorry.

Richard


On Mon, May 5, 2014 at 2:21 PM, LoveWeb2py atayloru...@gmail.com wrote:

 I am using MYSQL. So it actually didn't affect the database itself. What
 it did was just change the way the data is represented in SQLFORM. Very
 interesting. How could I properly represent it?


 On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the way
 web2py handle this process...

 If were create a new field, the old field would stay there, because
 web2py migration don't delete field, but since you change field type,
 web2py had try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




 On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.com wrote:

 I had a list of addresses I was using on my user db and when I switched
 the field from string to string.list it truncated all of my values. I have
 over 1000 customers in there.

 Is there an explanation for this? It cut off the first and last
 character for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

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


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


Re: [web2py] web2py conference - online talks

2014-05-05 Thread Marco Mansilla
Is there any chance to download this videos to watch offline?, that
would be awesome.

Marco.

 Please find below the links to the video of the first web2py
 conference. Videos are not broken into talks. 
 There is no audio for the first 2minutes but no talk either, only
 service announcements.
 
 
 *Part #1 (from start to lunch break)*
 
 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183272
 
 10:00-10:10! Conference Opening
 
 10:10-10:20! “What's New with the PSF” by Brian Curtin
 
 10:20-11:00! “History of web2py” by Massimo Di Pierro
 
 11:00-11:40! Learn web2py the Really Hard Way by Anthony Bastardi 
 11:40-12:20! Stereodose by Mark Li
 
 12:20-12:30! Planet Host by Jason Burosh
 
 *Part #2 (from tutorial to coffee break)*
 
 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183273
 
 13:00:13:40! hands-on web2py tutorial by Clifford Williams
 
 13:40-14:20! Angular and web2py by Amber Doctor
 
 14:20-14:40 ! Stitching together the tree of life with web2py by
 Richard Ree 1
 
 4:40-15:00! ShipElf: Automated Fulfillment with Web2Py by Peter 
 Szczepanski 
 
 15:00-15:20! MyIRE - What is Open Source Science? by Mark Graves 
 
 15:20-15:40! Introduction to Mongodb by Marco Chou
 
 *Part #3 (from coffee break to end)*
 
 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183274
 
 16:00-16:20! Introduction to OpenShift by Craig Brott
 
 16:20-16:40! Introduction to Hypermedia API by Bryan Barnard 
 
 16:40-17:00! web2py and the Semantic web by Chris Baron 
 
 17:00-17-20! Teaching an old dog new tricks by Don O'Hara 
 
 17:20-17:30! Conference Closing
 

-- 
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] Can't find file_blob

2014-05-05 Thread St. Pirsch
Hi, 
I'm trying to catch image data on upload to GAE, in order to store it in 
the google cloud. 

My model: 
db.define_table('fragen',
...
Field('bild','upload'),
...
As far as I understand, web2py generates a blob field automatically on GAE 
enviroment, so I didn't implement it in the model.


My cloud-upload controller looks like this:
def cloudupload(form):
from google.appengine.api import app_identity
bucket_name = os.environ.get('BUCKET_NAME', 
app_identity.get_default_gcs_bucket_name())
bucket = '/' + bucket_name
filename = bucket + '/'+ str(form.vars.bild)
from gluon import contenttype
mime = contenttype.contenttype(form.vars.bild)
my_default_retry_params = gcs.RetryParams(initial_delay=0.2,
  max_delay=5.0,
  backoff_factor=2,
  max_retry_period=15)
gcs.set_default_retry_params(my_default_retry_params)
write_retry_params = gcs.RetryParams(backoff_factor=1.1)
gcs_file = gcs.open(filename,
'w',
content_type= mime,
retry_params=write_retry_params)
gcs_file.write(form.vars.bild_blob)
gcs_file.close()
return()

I'm calling it from a form a grid. I have tried 'onvalidate= first', but 
the fieldstorage doesn't provide me with the filename web2py is storing 
finally in the image field. So I employed oncreate. 

def fragen_cms():
'''
Eingabe für die Fragen
'''
grid = SQLFORM.smartgrid(db.fragen, orderby=db.fragen.contents, 
oncreate=cloudupload)
return dict(grid=grid)

Image name is fine, cloud upload works as well, but it seems that there is 
no data in file_blob, nor in file_data. Is there a way to retrieve the file 
from the form?

Thanks for Your help,
Stephan

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


Re: [web2py] Can't find file_blob

2014-05-05 Thread Richard Vézina
Why not implement your own create and update form with SQLFORM and once the
record get create you can just copy the file form googlestore to your
google could?

You can retrieve the original file name with
db.table.field_upload.retrieve(db.table(id).field_upload)

And you should be able to get your file db.table(id).field_upload_blob

Not sure all the particularities of googlestore thought...

You can have a look at the code of the gluon/dal.py .store(), .retrieve(),
.retrieve_file_properties method.

Hope it helps

Richard


On Mon, May 5, 2014 at 2:37 PM, St. Pirsch spir...@gmail.com wrote:

 Hi,
 I'm trying to catch image data on upload to GAE, in order to store it in
 the google cloud.

 My model:
 db.define_table('fragen',
 ...
 Field('bild','upload'),
 ...
 As far as I understand, web2py generates a blob field automatically on GAE
 enviroment, so I didn't implement it in the model.


 My cloud-upload controller looks like this:
 def cloudupload(form):
 from google.appengine.api import app_identity
 bucket_name = os.environ.get('BUCKET_NAME',
 app_identity.get_default_gcs_bucket_name())
 bucket = '/' + bucket_name
 filename = bucket + '/'+ str(form.vars.bild)
 from gluon import contenttype
 mime = contenttype.contenttype(form.vars.bild)
 my_default_retry_params = gcs.RetryParams(initial_delay=0.2,
   max_delay=5.0,
   backoff_factor=2,
   max_retry_period=15)
 gcs.set_default_retry_params(my_default_retry_params)
 write_retry_params = gcs.RetryParams(backoff_factor=1.1)
 gcs_file = gcs.open(filename,
 'w',
 content_type= mime,
 retry_params=write_retry_params)
 gcs_file.write(form.vars.bild_blob)
 gcs_file.close()
 return()

 I'm calling it from a form a grid. I have tried 'onvalidate= first', but
 the fieldstorage doesn't provide me with the filename web2py is storing
 finally in the image field. So I employed oncreate.

 def fragen_cms():
 '''
 Eingabe für die Fragen
 '''
 grid = SQLFORM.smartgrid(db.fragen, orderby=db.fragen.contents,
 oncreate=cloudupload)
 return dict(grid=grid)

 Image name is fine, cloud upload works as well, but it seems that there is
 no data in file_blob, nor in file_data. Is there a way to retrieve the file
 from the form?

 Thanks for Your help,
 Stephan

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


-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
Richard,

My db.define_table('users',
Field('address',list:string')

use to be Field('address','string')

Soon as I changed it to list:string it truncated all of the addresses in 
the DAL. When I iterate through the database 

users_list = db(db.users_id!=None).select()

for row in users:
 print row.address

brings back truncated addresses. Even if I switch the field back to string 
it still is truncated. However when I go to the database and look at the 
addresses they're not truncated at all.

On Monday, May 5, 2014 2:32:16 PM UTC-4, Richard wrote:

 Are you talking about field type or representation or requires that all 
 differents?

 Without code can't help...

 Sorry.

 Richard


 On Mon, May 5, 2014 at 2:21 PM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 I am using MYSQL. So it actually didn't affect the database itself. What 
 it did was just change the way the data is represented in SQLFORM. Very 
 interesting. How could I properly represent it?


 On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the way 
 web2py handle this process... 

 If were create a new field, the old field would stay there, because 
 web2py migration don't delete field, but since you change field type, 
 web2py had try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




  On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.com wrote:

 I had a list of addresses I was using on my user db and when I switched 
 the field from string to string.list it truncated all of my values. I have 
 over 1000 customers in there. 

 Is there an explanation for this? It cut off the first and last 
 character for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

  -- 
 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+un...@googlegroups.com javascript:.
 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: Display table as dictionary

2014-05-05 Thread Dave S


On Sunday, May 4, 2014 10:04:06 PM UTC-7, Jonathan Lundell wrote:

 On 4 May 2014, at 9:46 PM, Massimo Di Pierro 
 massimo@gmail.comjavascript: 
 wrote:

 fields = db(db.address.business==4L).select().first().as_dict()


 AttributeError: 'NoneType' object has no attribute 'as_dict'

 (just sayin'...)



Sounds like your select had no entries for first() to find.

/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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
You have typo below :

db.define_table('users',
Field('address', *'*list:string')

It truncate the end?

How do you determine it is truncate? In the grid? If in grid() try to set
greater then 20 to maxtextlength parameters of the grid...

Richard




On Mon, May 5, 2014 at 3:34 PM, LoveWeb2py atayloru...@gmail.com wrote:

 Richard,

 My db.define_table('users',
 Field('address',list:string')

 use to be Field('address','string')

 Soon as I changed it to list:string it truncated all of the addresses in
 the DAL. When I iterate through the database

 users_list = db(db.users_id!=None).select()

 for row in users:
  print row.address

 brings back truncated addresses. Even if I switch the field back to string
 it still is truncated. However when I go to the database and look at the
 addresses they're not truncated at all.


 On Monday, May 5, 2014 2:32:16 PM UTC-4, Richard wrote:

 Are you talking about field type or representation or requires that all
 differents?

 Without code can't help...

 Sorry.

 Richard


 On Mon, May 5, 2014 at 2:21 PM, LoveWeb2py atayl...@gmail.com wrote:

 I am using MYSQL. So it actually didn't affect the database itself. What
 it did was just change the way the data is represented in SQLFORM. Very
 interesting. How could I properly represent it?


 On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the way
 web2py handle this process...

 If were create a new field, the old field would stay there, because
 web2py migration don't delete field, but since you change field type,
 web2py had try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




  On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.com wrote:

 I had a list of addresses I was using on my user db and when I
 switched the field from string to string.list it truncated all of my
 values. I have over 1000 customers in there.

 Is there an explanation for this? It cut off the first and last
 character for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

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


-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
When I connect to my table through python web2py.py -S myapp -M

and type:

users_list = db(db.users_id!=None).select()

for row in users:
 print row.address

it shows truncated addresses in a list the first and last character are 
missing.

When I click on the record in the grid, it shows the record spread out 
across 10 fields within the list for example: 123 home st. looks like
1
2
3

h
o
m
e

s
t


On Monday, May 5, 2014 3:44:57 PM UTC-4, Richard wrote:

 You have typo below :

 db.define_table('users',
 Field('address', *'*list:string')

 It truncate the end?

 How do you determine it is truncate? In the grid? If in grid() try to set 
 greater then 20 to maxtextlength parameters of the grid...

 Richard




 On Mon, May 5, 2014 at 3:34 PM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 Richard,

 My db.define_table('users',
 Field('address',list:string')

 use to be Field('address','string')

 Soon as I changed it to list:string it truncated all of the addresses in 
 the DAL. When I iterate through the database 

 users_list = db(db.users_id!=None).select()

 for row in users:
  print row.address

 brings back truncated addresses. Even if I switch the field back to 
 string it still is truncated. However when I go to the database and look at 
 the addresses they're not truncated at all.


 On Monday, May 5, 2014 2:32:16 PM UTC-4, Richard wrote:

 Are you talking about field type or representation or requires that all 
 differents?

 Without code can't help...

 Sorry.

 Richard


 On Mon, May 5, 2014 at 2:21 PM, LoveWeb2py atayl...@gmail.com wrote:

 I am using MYSQL. So it actually didn't affect the database itself. 
 What it did was just change the way the data is represented in SQLFORM. 
 Very interesting. How could I properly represent it?


 On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the way 
 web2py handle this process... 

 If were create a new field, the old field would stay there, because 
 web2py migration don't delete field, but since you change field type, 
 web2py had try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




  On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.comwrote:

 I had a list of addresses I was using on my user db and when I 
 switched the field from string to string.list it truncated all of my 
 values. I have over 1000 customers in there. 

 Is there an explanation for this? It cut off the first and last 
 character for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

  -- 
 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+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+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




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


[web2py] Re: Admin is disabled because insecure channel error Hosting web2py app on Amazon EC2 Linux server

2014-05-05 Thread Dave S
This should only be done for testing purposes, right?  Because the point of 
the check of is_local is to prevent unknown users from getting to the admin 
app.

/dps


On Monday, May 5, 2014 7:21:37 AM UTC-7, Martin Lohner wrote:

 Hi...

 try this:
 request.is_local=True
 in 
 web2py\applications\admin\models\access.py  (on line 21) resp. before 
  this code:

 *if request.env.http_x_forwarded_for or request.is_https:*
 *session.secure()*
 *elif not request.is_local and not DEMO_MODE:*
 *raise HTTP(200, T('Admin is disabled because insecure channel'))*


 ml

 Dne neděle, 20. dubna 2014 20:52:28 UTC+2 Pawan Gupta napsal(a):

 Hi Everyone

 We are having serious problem with our website 911india.com. We have 
 hosted it on Amazon EC2 server and there is a ticket that is issued which 
 redirects us to the admin interface that shows Admin is disabled 
 because insecure channel 

 I tried searching on the website but nothing seems to make sense probably 
 because we are somewhat beginners. 

 Can someone please help us with what could be done to resolve this.


 Cheers

 Pawan



-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
Did you restart your terminal instance of web2py after change the type of
your field?

Models get load only when you start the session I think...

Richard


On Mon, May 5, 2014 at 3:51 PM, LoveWeb2py atayloru...@gmail.com wrote:

 When I connect to my table through python web2py.py -S myapp -M

 and type:


 users_list = db(db.users_id!=None).select()

 for row in users:
  print row.address

 it shows truncated addresses in a list the first and last character are
 missing.

 When I click on the record in the grid, it shows the record spread out
 across 10 fields within the list for example: 123 home st. looks like
 1
 2
 3

 h
 o
 m
 e

 s
 t



 On Monday, May 5, 2014 3:44:57 PM UTC-4, Richard wrote:

 You have typo below :

 db.define_table('users',
 Field('address', *'*list:string')

 It truncate the end?

 How do you determine it is truncate? In the grid? If in grid() try to set
 greater then 20 to maxtextlength parameters of the grid...

 Richard




 On Mon, May 5, 2014 at 3:34 PM, LoveWeb2py atayl...@gmail.com wrote:

 Richard,

 My db.define_table('users',
 Field('address',list:string')

 use to be Field('address','string')

 Soon as I changed it to list:string it truncated all of the addresses in
 the DAL. When I iterate through the database

 users_list = db(db.users_id!=None).select()

 for row in users:
  print row.address

 brings back truncated addresses. Even if I switch the field back to
 string it still is truncated. However when I go to the database and look at
 the addresses they're not truncated at all.


 On Monday, May 5, 2014 2:32:16 PM UTC-4, Richard wrote:

 Are you talking about field type or representation or requires that all
 differents?

 Without code can't help...

 Sorry.

 Richard


 On Mon, May 5, 2014 at 2:21 PM, LoveWeb2py atayl...@gmail.com wrote:

 I am using MYSQL. So it actually didn't affect the database itself.
 What it did was just change the way the data is represented in SQLFORM.
 Very interesting. How could I properly represent it?


 On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the way
 web2py handle this process...

 If were create a new field, the old field would stay there, because
 web2py migration don't delete field, but since you change field type,
 web2py had try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




  On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.comwrote:

 I had a list of addresses I was using on my user db and when I
 switched the field from string to string.list it truncated all of my
 values. I have over 1000 customers in there.

 Is there an explanation for this? It cut off the first and last
 character for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

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


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

Re: [web2py] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
yes... going to try and reboot the whole computer in case I missed a 
process. I am running on httpd with wsgi I  normally just restart httpd and 
it works okay, but we'll see what happens after a full reboot.

On Monday, May 5, 2014 3:57:14 PM UTC-4, Richard wrote:

 Did you restart your terminal instance of web2py after change the type of 
 your field?

 Models get load only when you start the session I think...

 Richard


 On Mon, May 5, 2014 at 3:51 PM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 When I connect to my table through python web2py.py -S myapp -M

 and type:


 users_list = db(db.users_id!=None).select()

 for row in users:
  print row.address

 it shows truncated addresses in a list the first and last character are 
 missing.

 When I click on the record in the grid, it shows the record spread out 
 across 10 fields within the list for example: 123 home st. looks like
 1
 2
 3

 h
 o
 m
 e

 s
 t



 On Monday, May 5, 2014 3:44:57 PM UTC-4, Richard wrote:

 You have typo below :

 db.define_table('users',
 Field('address', *'*list:string')

 It truncate the end?

 How do you determine it is truncate? In the grid? If in grid() try to 
 set greater then 20 to maxtextlength parameters of the grid...

 Richard




 On Mon, May 5, 2014 at 3:34 PM, LoveWeb2py atayl...@gmail.com wrote:

 Richard,

 My db.define_table('users',
 Field('address',list:string')

 use to be Field('address','string')

 Soon as I changed it to list:string it truncated all of the addresses 
 in the DAL. When I iterate through the database 

 users_list = db(db.users_id!=None).select()

 for row in users:
  print row.address

 brings back truncated addresses. Even if I switch the field back to 
 string it still is truncated. However when I go to the database and look 
 at 
 the addresses they're not truncated at all.


 On Monday, May 5, 2014 2:32:16 PM UTC-4, Richard wrote:

 Are you talking about field type or representation or requires that 
 all differents?

 Without code can't help...

 Sorry.

 Richard


 On Mon, May 5, 2014 at 2:21 PM, LoveWeb2py atayl...@gmail.com wrote:

 I am using MYSQL. So it actually didn't affect the database itself. 
 What it did was just change the way the data is represented in SQLFORM. 
 Very interesting. How could I properly represent it?


 On Monday, May 5, 2014 2:11:28 PM UTC-4, Richard wrote:

 If you didn't backup db before makee your change I guess no...

 Rollback as notting to do there, it is a migration matter and the 
 way web2py handle this process... 

 If were create a new field, the old field would stay there, because 
 web2py migration don't delete field, but since you change field type, 
 web2py had try to make it best to handle the situation...

 Which DBMS do you use?

 If you have the data somewhere else, just reload them.

 Richard




  On Mon, May 5, 2014 at 2:02 PM, LoveWeb2py atayl...@gmail.comwrote:

 I had a list of addresses I was using on my user db and when I 
 switched the field from string to string.list it truncated all of my 
 values. I have over 1000 customers in there. 

 Is there an explanation for this? It cut off the first and last 
 character for example: 123 field road is now 23 field roa

 Is there any way to roll back???!

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

Re: [web2py] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py

Rebooted and the address shows up in one field now (not spread across 10), 
but it is still truncated. If I switch the field back to string and reboot 
the ip address appears fine... I really need it in a list form if possible, 
but if I can't i'll deal with a string

-- 
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: Custom Form Widget Question

2014-05-05 Thread Jim S
Maybe a dropdown isn't the right control for this situation.  Have you 
considered an autocomplete widget?  How many rows are in your dropdown?

-Jim


On Saturday, May 3, 2014 3:13:40 PM UTC-5, Mark Billion wrote:

 How can I set the width of the dropdown menu for an input?  The thing is 
 way too long because its trying to be longer than the textsorry, I know 
 its dumb, but I cant find anything


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


Re: [web2py] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
list:string field type is not for displaying record in list format. There
is SQLFORM.grid() for this or you can start with crud.select() it mays be
easier..

Richard


On Mon, May 5, 2014 at 4:05 PM, LoveWeb2py atayloru...@gmail.com wrote:


 Rebooted and the address shows up in one field now (not spread across 10),
 but it is still truncated. If I switch the field back to string and reboot
 the ip address appears fine... I really need it in a list form if possible,
 but if I can't i'll deal with a string

 --
 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: Can I simulate multiple user logins to web2py from a single computer?

2014-05-05 Thread 黄祥
web2py itself have an impersonate function, not sure is it suitable in your 
case or not.
e.g.
# user
db.auth_user.bulk_insert([{first_name : Admin, last_name : Admin, 
   email : ad...@a.com, username : admin, 
   password : 
db.auth_user.password.validate(password)[0] }, 
  {first_name : User, last_name : User, 
   email : u...@a.com, username : user, 
   password : 
db.auth_user.password.validate(password)[0] } ] )

# permission (admin impersonate user)
auth.add_permission(1, impersonate, auth_user, 2)

after that please access, default/user/impersonate

best regards,
stifan

-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
Derek,

I want to be able to add multiple addresses for one customer using the 
dropdown instead of having to create another new record.

On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is 
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string



-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
and by dropdown I mean clicking the + field that you get when you use the 
+- list:string field type

On Monday, May 5, 2014 4:17:02 PM UTC-4, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the 
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is 
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string



-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
You need a relation for this!!

one table clients and a list:reference field call address_id and another
table call address...

Then you will need to create a custome form that let you add new address
for a given client with a component maybe...

Richard


On Mon, May 5, 2014 at 4:17 PM, LoveWeb2py atayloru...@gmail.com wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the
 dropdown instead of having to create another new record.


 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across
 10), but it is still truncated. If I switch the field back to string and
 reboot the ip address appears fine... I really need it in a list form if
 possible, but if I can't i'll deal with a string

  --
 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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
Richard,

This is actually for editing fields that are already in the SQLFORM.grid()

I checked my error log and I'm getting 

Warning: Truncated incorrect DOUBLE value: 'T'
ret = self.cursor.execute(*a, **b)

Could this be causing it?

On Monday, May 5, 2014 4:17:47 PM UTC-4, LoveWeb2py wrote:

 and by dropdown I mean clicking the + field that you get when you use the 
 +- list:string field type

 On Monday, May 5, 2014 4:17:02 PM UTC-4, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the 
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is 
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string



-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Richard Vézina
I understand what you may need, but you seems to think that things work
differently that they actually do...

Sorry, I have to go now. May help again later.

Richard


On Mon, May 5, 2014 at 4:22 PM, LoveWeb2py atayloru...@gmail.com wrote:

 Richard,

 This is actually for editing fields that are already in the SQLFORM.grid()

 I checked my error log and I'm getting

 Warning: Truncated incorrect DOUBLE value: 'T'
 ret = self.cursor.execute(*a, **b)

 Could this be causing it?


 On Monday, May 5, 2014 4:17:47 PM UTC-4, LoveWeb2py wrote:

 and by dropdown I mean clicking the + field that you get when you use the
 +- list:string field type

 On Monday, May 5, 2014 4:17:02 PM UTC-4, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that
 is used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across
 10), but it is still truncated. If I switch the field back to string and
 reboot the ip address appears fine... I really need it in a list form if
 possible, but if I can't i'll deal with a string

  --
 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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Derek
Why are you doing this? Are you just trying to change the widget that is 
used to display and edit?

On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 10), 
 but it is still truncated. If I switch the field back to string and reboot 
 the ip address appears fine... I really need it in a list form if possible, 
 but if I can't i'll deal with a string


-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
No problem, Richard. Really appreciate all of the help from you and the 
rest of the community!

On Monday, May 5, 2014 4:25:03 PM UTC-4, Richard wrote:

 I understand what you may need, but you seems to think that things work 
 differently that they actually do...

 Sorry, I have to go now. May help again later.

 Richard


 On Mon, May 5, 2014 at 4:22 PM, LoveWeb2py atayl...@gmail.comjavascript:
  wrote:

 Richard,

 This is actually for editing fields that are already in the SQLFORM.grid()

 I checked my error log and I'm getting 

 Warning: Truncated incorrect DOUBLE value: 'T'
 ret = self.cursor.execute(*a, **b)

 Could this be causing it?


 On Monday, May 5, 2014 4:17:47 PM UTC-4, LoveWeb2py wrote:

 and by dropdown I mean clicking the + field that you get when you use 
 the +- list:string field type

 On Monday, May 5, 2014 4:17:02 PM UTC-4, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the 
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that 
 is used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string

  -- 
 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 javascript:.
 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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Anthony
Internally, when you store a list of items in a list:string field, web2py 
converts the list to a single string, with list items separated by the | 
character. If you convert to a list:string field, you will need to modify 
all of the existing records by wrapping them in | characters. So, for 
example, 123 Home St. should be changed to |123 Home St.|.

Please try this on a dev copy of the db before messing around with the 
production database, though.

Anthony

On Monday, May 5, 2014 4:17:02 PM UTC-4, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the 
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is 
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string



-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread LoveWeb2py
Solved it!! Thank you so much everyone! 

UPDATE YourTable SET YourColumn = CONCAT('|', YourColumn, '|');


Here is the SQL query if you're using MYSQL:



On Monday, May 5, 2014 4:36:56 PM UTC-4, Anthony wrote:

 Internally, when you store a list of items in a list:string field, web2py 
 converts the list to a single string, with list items separated by the | 
 character. If you convert to a list:string field, you will need to modify 
 all of the existing records by wrapping them in | characters. So, for 
 example, 123 Home St. should be changed to |123 Home St.|.

 Please try this on a dev copy of the db before messing around with the 
 production database, though.

 Anthony

 On Monday, May 5, 2014 4:17:02 PM UTC-4, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the 
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is 
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string



-- 
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] string:list truncated all of my values!! PLEASE HELP

2014-05-05 Thread Derek
This may be too late, but in any case, you may want to take a look at my 
web2pyslice here:

http://www.web2pyslices.com/slice/show/1612/ajax-adding-child-records-to-parent

It's about adding addresses to person records, using ajax.


On Monday, May 5, 2014 1:17:02 PM UTC-7, LoveWeb2py wrote:

 Derek,

 I want to be able to add multiple addresses for one customer using the 
 dropdown instead of having to create another new record.

 On Monday, May 5, 2014 4:15:00 PM UTC-4, Derek wrote:

 Why are you doing this? Are you just trying to change the widget that is 
 used to display and edit?

 On Monday, May 5, 2014 1:05:38 PM UTC-7, LoveWeb2py wrote:


 Rebooted and the address shows up in one field now (not spread across 
 10), but it is still truncated. If I switch the field back to string and 
 reboot the ip address appears fine... I really need it in a list form if 
 possible, but if I can't i'll deal with a string



-- 
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] strange problem with DAL

2014-05-05 Thread Derek
What I've read says that you need to specify the full path to the sqlite 
data file or you will get this error. What's your db.py look like?

On Monday, May 5, 2014 12:31:35 AM UTC-7, Marin Pranjić wrote:

 I copied broken database locally so I can test it.
 I also added print 
 herehttps://github.com/web2py/web2py/blob/master/gluon/dal.py#L1353to get 
 actual queries.

 Queries are fine. Actually if I just c/p those queries into SQLite 
 Database Browser, it works (on the same database file).

 So it's not web2py, it's not sqlite, but it doesn't work.

 -__-



 On Mon, May 5, 2014 at 9:05 AM, Marin Pranjić 
 marin@gmail.comjavascript:
  wrote:

 Well, nothing unusual with my table definitions. Everything by the specs.
 I just removed all .table files and started with new sqlite file, and 
 that problem is gone.
 (i still have copies)

 Seems that files were stuck in some state.

 However, main.message error still confuses me, because sql query that's 
 created by DAL is valid.
 And this happens even after migrations are fixed.

 So it's probably SQLite that's broken/corrupted and I'm not sure if those 
 issues are somehow related.

 Marin




 On Sun, May 4, 2014 at 8:58 PM, Niphlod nip...@gmail.com 
 javascript:wrote:

 how are your table defined ? the fact that 'main.message' gets into the 
 error seems a little weird for a table named message_receiver. Also, that 
 success repeated into sql.log means that something really strange is 
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić marin@gmail.comwrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's like 
 production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for ex. 
 in appadmin) it works, but when I try to insert something (appadmin or 
 in-app) i get the following error:

 OperationalError: no such table: main.message





 I got the actual SQL query from the error ticket:





 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);





 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database file. 
 It has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every request 
 but nothing changes in .table files.





 There are 6 tables that are affected by migration but I don't see a 
 pattern.

 Can someone suggest how to trace/debug this?

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+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+un...@googlegroups.com javascript:.
 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] Using Date Fields in Compute Field Causes Error on CSV Upload

2014-05-05 Thread Kyle Flanagan
I'm encountering an error when uploading a CSV file when dates are involved 
in a computed field. Using sqlite, web2py version: 
2.8.2-stable+timestamp.2013.11.28.13.54.07 (also tested on 
2.9.5-stable+timestamp.2014.03.16.02.35.39).

E.g., consider the following table definition in a model:

db.define_table('POC2',
Field('poc_date', 'date', required=True),
Field('ten_days_before_poc_date', 'date', compute = lambda 
r: r['poc_date'] - datetime.timedelta(10))
)


Now, use appadmin to manage the POC2 table and insert a new record. This 
works as expected. 

Now, try uploading the following CSV file and importing it into the table:

POC2.id,POC2.poc_date
1,2014-05-30

The following error appears:

unable to parse csv file

unsupported operand type(s) for -: 'str' and 'datetime.timedelta'



It appears that r['poc_date'] is passed to the lambda as a string when 
uploading via CSV, but as a date when going through appadmin. Is this the 
designed behavior, and is it documented anywhere? 

I can always test the datatype of r['poc_date'] and convert it to a 
datetime explicitly, but I don't want to make my code any messier than 
needed if I'm missing something regarding computed fields and CSV imports.

-- 
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] strange problem with DAL

2014-05-05 Thread Marin Pranjić
default DAL configuration that is shipped with welcome app.
I also searched for solution but didn't find anything.

sqlite path is fine. There are at least 10 queries in the same transaction
before this one breaks.
i have no idea what's wrong...


On Mon, May 5, 2014 at 11:40 PM, Derek sp1d...@gmail.com wrote:

 What I've read says that you need to specify the full path to the sqlite
 data file or you will get this error. What's your db.py look like?


 On Monday, May 5, 2014 12:31:35 AM UTC-7, Marin Pranjić wrote:

 I copied broken database locally so I can test it.
 I also added print 
 herehttps://github.com/web2py/web2py/blob/master/gluon/dal.py#L1353to get 
 actual queries.

 Queries are fine. Actually if I just c/p those queries into SQLite
 Database Browser, it works (on the same database file).

 So it's not web2py, it's not sqlite, but it doesn't work.

 -__-



 On Mon, May 5, 2014 at 9:05 AM, Marin Pranjić marin@gmail.comwrote:

 Well, nothing unusual with my table definitions. Everything by the specs.
  I just removed all .table files and started with new sqlite file, and
 that problem is gone.
 (i still have copies)

 Seems that files were stuck in some state.

 However, main.message error still confuses me, because sql query that's
 created by DAL is valid.
 And this happens even after migrations are fixed.

 So it's probably SQLite that's broken/corrupted and I'm not sure if
 those issues are somehow related.

 Marin




 On Sun, May 4, 2014 at 8:58 PM, Niphlod nip...@gmail.com wrote:

 how are your table defined ? the fact that 'main.message' gets into the
 error seems a little weird for a table named message_receiver. Also, that
 success repeated into sql.log means that something really strange is
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić marin@gmail.comwrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's like
 production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for ex.
 in appadmin) it works, but when I try to insert something (appadmin or
 in-app) i get the following error:

 OperationalError: no such table: main.message






 I got the actual SQL query from the error ticket:






 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);






 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database file. 
 It has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every 
 request but nothing changes in .table files.






 There are 6 tables that are affected by migration but I don't see a 
 pattern.

 Can someone suggest how to trace/debug this?

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


-- 
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] strange problem with DAL

2014-05-05 Thread Derek
well, it will be fine until it can't find the file, creates it again blank.

http://stackoverflow.com/questions/14262771/why-am-i-suddenly-getting-operationalerror-no-such-table

On Monday, May 5, 2014 3:12:31 PM UTC-7, Marin Pranjić wrote:

 default DAL configuration that is shipped with welcome app.
 I also searched for solution but didn't find anything.

 sqlite path is fine. There are at least 10 queries in the same transaction 
 before this one breaks.
 i have no idea what's wrong...


 On Mon, May 5, 2014 at 11:40 PM, Derek sp1...@gmail.com javascript:wrote:

 What I've read says that you need to specify the full path to the sqlite 
 data file or you will get this error. What's your db.py look like?


 On Monday, May 5, 2014 12:31:35 AM UTC-7, Marin Pranjić wrote:

 I copied broken database locally so I can test it.
 I also added print 
 herehttps://github.com/web2py/web2py/blob/master/gluon/dal.py#L1353to get 
 actual queries.

 Queries are fine. Actually if I just c/p those queries into SQLite 
 Database Browser, it works (on the same database file).

 So it's not web2py, it's not sqlite, but it doesn't work.

 -__-



 On Mon, May 5, 2014 at 9:05 AM, Marin Pranjić marin@gmail.comwrote:

 Well, nothing unusual with my table definitions. Everything by the 
 specs.
  I just removed all .table files and started with new sqlite file, and 
 that problem is gone.
 (i still have copies)

 Seems that files were stuck in some state.

 However, main.message error still confuses me, because sql query that's 
 created by DAL is valid.
 And this happens even after migrations are fixed.

 So it's probably SQLite that's broken/corrupted and I'm not sure if 
 those issues are somehow related.

 Marin




 On Sun, May 4, 2014 at 8:58 PM, Niphlod nip...@gmail.com wrote:

 how are your table defined ? the fact that 'main.message' gets into 
 the error seems a little weird for a table named message_receiver. 
 Also, 
 that success repeated into sql.log means that something really strange 
 is 
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić 
 marin@gmail.comwrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's like 
 production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for 
 ex. in appadmin) it works, but when I try to insert something (appadmin 
 or 
 in-app) i get the following error:

 OperationalError: no such table: main.message







 I got the actual SQL query from the error ticket:







 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);







 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database file. 
 It has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every 
 request but nothing changes in .table files.







 There are 6 tables that are affected by migration but I don't see a 
 pattern.

 Can someone suggest how to trace/debug this?

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

Re: [web2py] strange problem with DAL

2014-05-05 Thread Marin Pranjić
File can't just dissapear in the middle of transaction :)
And my table is not called main.message anyway.
And it's not blank, I have data stored in there that I can read.
I can't write into one specific table. Other tables work.

Marin


On Tue, May 6, 2014 at 12:21 AM, Derek sp1d...@gmail.com wrote:

 well, it will be fine until it can't find the file, creates it again blank.


 http://stackoverflow.com/questions/14262771/why-am-i-suddenly-getting-operationalerror-no-such-table


 On Monday, May 5, 2014 3:12:31 PM UTC-7, Marin Pranjić wrote:

 default DAL configuration that is shipped with welcome app.
 I also searched for solution but didn't find anything.

 sqlite path is fine. There are at least 10 queries in the same
 transaction before this one breaks.
 i have no idea what's wrong...


 On Mon, May 5, 2014 at 11:40 PM, Derek sp1...@gmail.com wrote:

 What I've read says that you need to specify the full path to the sqlite
 data file or you will get this error. What's your db.py look like?


 On Monday, May 5, 2014 12:31:35 AM UTC-7, Marin Pranjić wrote:

 I copied broken database locally so I can test it.
 I also added print 
 herehttps://github.com/web2py/web2py/blob/master/gluon/dal.py#L1353to 
 get actual queries.

 Queries are fine. Actually if I just c/p those queries into SQLite
 Database Browser, it works (on the same database file).

 So it's not web2py, it's not sqlite, but it doesn't work.

 -__-



 On Mon, May 5, 2014 at 9:05 AM, Marin Pranjić marin@gmail.comwrote:

 Well, nothing unusual with my table definitions. Everything by the
 specs.
  I just removed all .table files and started with new sqlite file, and
 that problem is gone.
 (i still have copies)

 Seems that files were stuck in some state.

 However, main.message error still confuses me, because sql query
 that's created by DAL is valid.
 And this happens even after migrations are fixed.

 So it's probably SQLite that's broken/corrupted and I'm not sure if
 those issues are somehow related.

 Marin




 On Sun, May 4, 2014 at 8:58 PM, Niphlod nip...@gmail.com wrote:

 how are your table defined ? the fact that 'main.message' gets into
 the error seems a little weird for a table named message_receiver. 
 Also,
 that success repeated into sql.log means that something really strange 
 is
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić 
 marin@gmail.comwrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's like
 production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for
 ex. in appadmin) it works, but when I try to insert something 
 (appadmin or
 in-app) i get the following error:

 OperationalError: no such table: main.message








 I got the actual SQL query from the error ticket:








 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);








 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database 
 file. It has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every 
 request but nothing changes in .table files.








 There are 6 tables that are affected by migration but I don't see a 
 pattern.

 Can someone suggest how to trace/debug this?

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

[web2py] Re: Pages that only their author can view

2014-05-05 Thread Derek
Probably handle that in the view.


On Sunday, May 4, 2014 2:28:57 AM UTC-7, Sidney Rubidge wrote:

 I am trying to create a site where users can create pages. The user has a 
 wall which lists all the pages that they have created. They can then view 
 any of the pages that they have created. I am trying to set an 
 authorisation so that only the page author can view the respective page.

 What I have done follows:


 In my model I create a table called pages. Each page that is created has 
 a reference key to the author that created it.

 db.define_table('pages',
 Field('user_id', 'reference auth_user', default=auth.user_id),
 Field('name', 'string', required=True),
 Field('created_on', 'datetime', default=request.now))


 The wall method in the controller shows that each user has a wall that 
 lists all the pages that they have created. They can then click on an item 
 in the list and be directed to the relevant page by passing the page pk in 
 the url.

 @auth.requires_login()
 def wall():
 pages = db(db.pages.user_id == auth.user.id).select(db.pages.ALL)
 return dict(pages = pages)


 I have tried two different decorators above the page method (seen as 
 comments) in an attempt to make these pages only viewable by their 
 respective authors. The decorators that I have tried do only let their 
 creator view them but they cause the rest of the site to return a 404 page. 
 I am not sure why.

 #@auth.requires(auth.user_id==db.pages(request.args(0, cast = 
 int)).user_id, requires_login=True)
 #@auth.requires_membership('user_' + str(db.pages(request.args(0, cast = 
 int)).user_id))
 def page():
 this_page = db.pages(request.args(0, cast = int)) or redirect(URL(
 'wall'))
 ...
 return ...

 What is the best method to give only the creator of a page permission to 
 view 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.


[web2py] Re: Upload image using RESTful api

2014-05-05 Thread samuel bonill
i use postman(http://www.getpostman.com/) for test restful api and works 
grate...

El lunes, 5 de mayo de 2014 11:49:50 UTC-5, iw3...@gmail.com escribió:

 Hi!

 I have a SQLFORM with some filelds and an image (like example here: 
 http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM).

 I have to populate the database using a python script. So I made a generic 
 restful api:

 @request.restful()
 def api():
 response.view = 'generic.'+request.extension
 def GET(*args,**vars):
 patterns = [':auto[products]',
 '/products/code/{products.code}',
 '/products/code/{products.code}/:field',
 '/products/image_filename/{products.image_filename}',
 
 '/products/image_filename/{products.image_filename}/:field',
]
 parser = db.parse_as_rest(patterns,args,vars)
 if parser.status == 200:
 return dict(content=parser.response)
 else:
 raise HTTP(parser.status,parser.error)
 def POST(table_name,**vars):
 return db[table_name].validate_and_insert(**vars)
 def PUT(table_name,record_id,**vars):
 return db(db[table_name]._id==record_id).validate_and_update(**
 vars)
 def DELETE(table_name,record_id):
 return db(db[table_name]._id==record_id).delete()
 return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)

 On python script  I use requests.post and genercs fields are ok.
 I used sintax from here ( 
 http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
  
 ).
 This upload generally work but I have a big problem:
 uploading file from browser I find on DB the encoded name of file, and dhe 
 file on filesystem.
 Uploading from restful I find on db, instead of encoded file name, this:

 'FieldStorage(''image'', ''test_image.jpg'', ''...binary data of image'')'

 What's the correct way to upload a file using restful api?


-- 
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: Translate inside javascript function with javascript variable

2014-05-05 Thread Derek
well, you are using that quite wrong.
You are trying to have javascript call a web2py built in function. Not a 
way to do that without writing a function around that and then is it even 
worth it?
Why exactly do you want to get the translated text via javascript? web2py 
doesn't automatically translate anything that isn't defined beforehand.

On Sunday, May 4, 2014 8:01:40 AM UTC-7, lula bad wrote:

 Hi,

 i have the following problem.

 I have a javascript funktion inside a script Tag inside the index.html
 Function is:

 var set_info_text = function (txt) {
 $('#info_text').innerHTML = '{{=T(txt)}}';
 };

 usage is: 

 set_info_text('number peers online');


 I get this errormessage:

 Traceback (most recent call last):
  File 
 C:\Users\afieg\PycharmProjects\web2py_projekte\web2py\gluon\restricted.py, 
 line 220, in restricted
  exec ccode in environment
  File 
 C:\Users\afieg\PycharmProjects\web2py_projekte\web2py\applications\yacystats2\views\default/index.html,
  line 40, in module
  input id=search_peer class=form-control input-lg type=search 
 placeholder=Name or Hash/
 NameError: name 'txt' is not defined

 I didnt found any solution yet, or is there another way to translate?

 Thanks.



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


[web2py] Re: Translate inside javascript function with javascript variable

2014-05-05 Thread Anthony


 var set_info_text = function (txt) {
 $('#info_text').innerHTML = '{{=T(txt)}}';
 };

 Keep in mind that the web2py template syntax is Python that gets executed 
on the sever in order to generate the HTML page. On the other hand, any 
JavaScript in the page gets executed in the browser, after the HTML has 
been generated on the server. You cannot mix JavaScript and Python as if 
they will be executed in the same context.

In the above, the {{=T(txt)}} will be executed only once on the server when 
the HTML page is generated. The problem is that the txt variable passed 
to T() doesn't actually exist in Python on the server, so you are getting 
that error.

If you need to use JS to dynamically insert web2py translations into the 
page, you would have to make Ajax calls to the server to request and 
receive the translated strings. Hard to say whether that's actually a good 
idea without knowing more about what you are trying to do.

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: Hide actions in navbar

2014-05-05 Thread Carlos Correia
Hi,

It seems no one is interested on this subject...

Is there any kind of workaround that survives upgrades?

Best regards,

Carlos

Quinta-feira, 16 de Maio de 2013 8:17:28 UTC+1, Carlos Correia escreveu:

 -BEGIN PGP SIGNED MESSAGE- 
 Hash: SHA1 

 Hi, 

 I needed to hide registering from navbar, but still be able to use the 
 link 
 (app/default/user/register) if I call it explicitly. 

 I tried first: 
 auth.settings.actions_disabled=['register'] 

 but then, I got a 404 error on that link, so I've added an extra parameter 
 to 
 Auth.navbar() that accepts an array of actions to hide. 

 I attach the patch from [Version 2.3.2 (2012-12-17 08:59:58) stable] with 
 the 
 changes. 

 - -- 
 Com os melhores cumprimentos, 

 Carlos Correia 
 = 
 MEMÓRIA PERSISTENTE 
 Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762 
 e-mail: ge...@memoriapersistente.pt - URL: 
 http://www.memoriapersistente.pt 
 Jabber: m...@jabber.org 
 GnuPG: wwwkeys.eu.pgp.net 
 URL Suporte: https://t5.m16e.com/gps 
 -BEGIN PGP SIGNATURE- 
 Version: GnuPG v1.4.12 (GNU/Linux) 
 Comment: Using GnuPG with undefined - http://www.enigmail.net/ 

 iEYEARECAAYFAlGUiAgACgkQ90uzwjA1SJVHGQCdGebSos1BbEWTHYmNyu3zkmkl 
 ltIAn3FEqjSHU0owCAfRqWLptZ6LGShR 
 =g7B7 
 -END PGP SIGNATURE- 


-- 
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: Hide actions in navbar

2014-05-05 Thread Anthony
I don't object to the patch (maybe submit it as a pull request on Github), 
but in the meantime, you can do:

navbar = auth.navbar()
del navbar[2:4]

Or do:

navbar_dict = auth.navbar(mode='bare')

which gives you a dictionary from which you can build your own navbar.

Anthony

On Monday, May 5, 2014 9:36:29 PM UTC-4, Carlos Correia wrote:

 Hi,

 It seems no one is interested on this subject...

 Is there any kind of workaround that survives upgrades?

 Best regards,

 Carlos

 Quinta-feira, 16 de Maio de 2013 8:17:28 UTC+1, Carlos Correia escreveu:

 -BEGIN PGP SIGNED MESSAGE- 
 Hash: SHA1 

 Hi, 

 I needed to hide registering from navbar, but still be able to use the 
 link 
 (app/default/user/register) if I call it explicitly. 

 I tried first: 
 auth.settings.actions_disabled=['register'] 

 but then, I got a 404 error on that link, so I've added an extra 
 parameter to 
 Auth.navbar() that accepts an array of actions to hide. 

 I attach the patch from [Version 2.3.2 (2012-12-17 08:59:58) stable] with 
 the 
 changes. 

 - -- 
 Com os melhores cumprimentos, 

 Carlos Correia 
 = 
 MEMÓRIA PERSISTENTE 
 Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762 
 e-mail: ge...@memoriapersistente.pt - URL: 
 http://www.memoriapersistente.pt 
 Jabber: m...@jabber.org 
 GnuPG: wwwkeys.eu.pgp.net 
 URL Suporte: https://t5.m16e.com/gps 
 -BEGIN PGP SIGNATURE- 
 Version: GnuPG v1.4.12 (GNU/Linux) 
 Comment: Using GnuPG with undefined - http://www.enigmail.net/ 

 iEYEARECAAYFAlGUiAgACgkQ90uzwjA1SJVHGQCdGebSos1BbEWTHYmNyu3zkmkl 
 ltIAn3FEqjSHU0owCAfRqWLptZ6LGShR 
 =g7B7 
 -END PGP SIGNATURE- 



-- 
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: Howto deploy web2py on a shared host?

2014-05-05 Thread Carlos Alba
Is Linux based server? What access do you have ? You must count with a 
terminal access in order to configure any service. Then you can follow 
documentationhttp://web2py.com/books/default/chapter/29/13/deployment-recipes#Linux-and-Unix.
On Monday, May 5, 2014 12:22:58 PM UTC-5, jansende wrote:

 Thanks for the suggestion NeoToren. However I'm already paying my provider 
 and don't consider changing 


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


[web2py] Re: web2py conference - online talks

2014-05-05 Thread محمد امير


بتاريخ الاثنين، 5 مايو، 2014 UTC+3 8:37:24 م، كتب Massimo Di Pierro:

 I forgot. Here is the opening video:

 https://www.youtube.com/watch?v=RVSRnCxSuUk



how can i watch the conference  

-- 
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] web2py report pdflatex template

2014-05-05 Thread Peter Pan


Hey 
I' m a teacher and work with pdflatex. I think its a good idea to learn LaTeX 
with web2py.
The Students create theire own reports with pdflatex. 
I do Not know how to implement a pdflatex-Template in web2py. I read the 
informations about markmin
But i couldn' t find the answer. 

-- 
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] links to specific records in table

2014-05-05 Thread Kajetan Wardziński
Hello, my first app and I'm stuck.
I generate table with SQLTABLE in Views like this:
{{=SQLTABLE(query, headers='fieldname:capitalize', linkto='table_manage')}}
and links in generated table doesn't link directly to the specific record 
in the database, I have also not authorized message
It should be Digitally signed urls, but I don't kno how to use it
thanks

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


[web2py] Error on fresh startup

2014-05-05 Thread Kurt Jensen
Getting error on start-up of fresh install on Fused.com hosting service 
account :

Traceback (most recent call last):
  File web2py.py, line 18, in ?
import gluon.widget
  File /home/iaff106/web2py/gluon/__init__.py, line 15, in ?
from globals import current
  File /home/iaff106/web2py/gluon/globals.py, line 84
self.write(EMPTY_DICT if self.bin else MARK+DICT)
   ^

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


[web2py] Re: web2py conference - online talks

2014-05-05 Thread Massimo Di Pierro
The links are the beginning of this thread.


On Monday, 5 May 2014 12:52:29 UTC-5, محمد امير wrote:



 بتاريخ الاثنين، 5 مايو، 2014 UTC+3 8:37:24 م، كتب Massimo Di Pierro:

 I forgot. Here is the opening video:

 https://www.youtube.com/watch?v=RVSRnCxSuUk



 how can i watch the conference  


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


Re: [web2py] web2py conference - online talks

2014-05-05 Thread Massimo Di Pierro
I do not think so.

On Monday, 5 May 2014 10:38:17 UTC-5, marco mansilla wrote:

 Is there any chance to download this videos to watch offline?, that 
 would be awesome. 

 Marco. 

  Please find below the links to the video of the first web2py 
  conference. Videos are not broken into talks. 
  There is no audio for the first 2minutes but no talk either, only 
  service announcements. 
  
  
  *Part #1 (from start to lunch break)* 
  
  
 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183272 
  
  10:00-10:10! Conference Opening 
  
  10:10-10:20! “What's New with the PSF” by Brian Curtin 
  
  10:20-11:00! “History of web2py” by Massimo Di Pierro 
  
  11:00-11:40! Learn web2py the Really Hard Way by Anthony Bastardi 
  11:40-12:20! Stereodose by Mark Li 
  
  12:20-12:30! Planet Host by Jason Burosh 
  
  *Part #2 (from tutorial to coffee break)* 
  
  
 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183273 
  
  13:00:13:40! hands-on web2py tutorial by Clifford Williams 
  
  13:40-14:20! Angular and web2py by Amber Doctor 
  
  14:20-14:40 ! Stitching together the tree of life with web2py by 
  Richard Ree 1 
  
  4:40-15:00! ShipElf: Automated Fulfillment with Web2Py by Peter 
  Szczepanski 
  
  15:00-15:20! MyIRE - What is Open Source Science? by Mark Graves 
  
  15:20-15:40! Introduction to Mongodb by Marco Chou 
  
  *Part #3 (from coffee break to end)* 
  
  
 https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183274 
  
  16:00-16:20! Introduction to OpenShift by Craig Brott 
  
  16:20-16:40! Introduction to Hypermedia API by Bryan Barnard 
  
  16:40-17:00! web2py and the Semantic web by Chris Baron 
  
  17:00-17-20! Teaching an old dog new tricks by Don O'Hara 
  
  17:20-17:30! Conference Closing 
  


-- 
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] strange problem with DAL

2014-05-05 Thread Massimo Di Pierro
Derek is right. If you have any controller or model or module that performs 
a chdir, that will move the entire web2py to the new dir and break 
everything. I am not saying this is the cause of the problem, but could be 
an explanations. Web2py apps should not perform thread-unsafe operations 
like chdir.


On Monday, 5 May 2014 17:28:03 UTC-5, Marin Pranjić wrote:

 File can't just dissapear in the middle of transaction :)
 And my table is not called main.message anyway.
 And it's not blank, I have data stored in there that I can read.
 I can't write into one specific table. Other tables work.

 Marin


 On Tue, May 6, 2014 at 12:21 AM, Derek sp1d...@gmail.com wrote:

 well, it will be fine until it can't find the file, creates it again 
 blank.


 http://stackoverflow.com/questions/14262771/why-am-i-suddenly-getting-operationalerror-no-such-table


 On Monday, May 5, 2014 3:12:31 PM UTC-7, Marin Pranjić wrote:

  default DAL configuration that is shipped with welcome app.
 I also searched for solution but didn't find anything.

 sqlite path is fine. There are at least 10 queries in the same 
 transaction before this one breaks.
 i have no idea what's wrong...


 On Mon, May 5, 2014 at 11:40 PM, Derek sp1...@gmail.com wrote:

 What I've read says that you need to specify the full path to the 
 sqlite data file or you will get this error. What's your db.py look like?


 On Monday, May 5, 2014 12:31:35 AM UTC-7, Marin Pranjić wrote:

 I copied broken database locally so I can test it.
 I also added print 
 herehttps://github.com/web2py/web2py/blob/master/gluon/dal.py#L1353to 
 get actual queries.

 Queries are fine. Actually if I just c/p those queries into SQLite 
 Database Browser, it works (on the same database file).

 So it's not web2py, it's not sqlite, but it doesn't work.

 -__-



 On Mon, May 5, 2014 at 9:05 AM, Marin Pranjić marin@gmail.comwrote:

 Well, nothing unusual with my table definitions. Everything by the 
 specs.
  I just removed all .table files and started with new sqlite file, 
 and that problem is gone.
 (i still have copies)

 Seems that files were stuck in some state.

 However, main.message error still confuses me, because sql query 
 that's created by DAL is valid.
 And this happens even after migrations are fixed.

 So it's probably SQLite that's broken/corrupted and I'm not sure if 
 those issues are somehow related.

 Marin




 On Sun, May 4, 2014 at 8:58 PM, Niphlod nip...@gmail.com wrote:

 how are your table defined ? the fact that 'main.message' gets into 
 the error seems a little weird for a table named message_receiver. 
 Also, 
 that success repeated into sql.log means that something really 
 strange is 
 going on with your migrations.


 On Sunday, May 4, 2014 3:22:19 PM UTC+2, Marin Pranjić wrote:

 To confirm...
 https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1262

 This gets executed on every request.

 However I still don't understand why sqlite fails on insert.

 It fails on testing server but it works on my local instance.

 Marin


  On Sun, May 4, 2014 at 3:13 PM, Marin Pranjić marin@gmail.com
  wrote:

  Hi.

 I have application hosted on EC2. It is a testing server. It's 
 like production environment except it uses SQLite.

 I have a table called message_receiver. When I fetch records (for 
 ex. in appadmin) it works, but when I try to insert something 
 (appadmin or 
 in-app) i get the following error:

 OperationalError: no such table: main.message









 I got the actual SQL query from the error ticket:









 INSERT INTO message_receiver(time_seen,user_id,message_id) VALUES 
 (NULL,93,1);









 That seems correct.

 However, I noticed that my sql.log is bigger than sqlite database 
 file. It has lots of success! messages inside.
 And it seems that migration for some tables is triggered on every 
 request but nothing changes in .table files.









 There are 6 tables that are affected by migration but I don't see a 
 pattern.

 Can someone suggest how to trace/debug this?

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



  --