[web2py] Re: Can't open sqlite3 databases.

2021-01-05 Thread 'Woody' via web2py-users
Never mind. It was a dumb issue with a permission in the directory 
hierarchy where the db files are located. My application is now working 
fine with Python 3.9 + w2p 2.21.

On Monday, January 4, 2021 at 12:03:58 AM UTC-5 Woody wrote:

> I updated to Python 3.9 using w2p 2.20.4  and now I'm getting errors 
> opening sqlite3 databases. This is on an application that had been stable 
> for a long time. Is there a compatibility problem with python 3.9?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d34cc368-49dc-4a97-9578-9288014e3eb6n%40googlegroups.com.


[web2py] Can't open sqlite3 databases.

2021-01-03 Thread 'Woody' via web2py-users
I updated to Python 3.9 using w2p 2.20.4  and now I'm getting errors 
opening sqlite3 databases. This is on an application that had been stable 
for a long time. Is there a compatibility problem with python 3.9?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4e7fedb2-a97b-47a1-942e-22e576c96a81n%40googlegroups.com.


[web2py] Re: web2py broken with Python 3.8

2020-01-15 Thread 'Woody' via web2py-users
Good news! I'll give it a try.

On Friday, December 6, 2019 at 10:56:48 AM UTC-5, Woody wrote:
>
> web2py is broken with Python 3.8. I asked a question about this a few days 
> ago and was told that it would be fixed. Looking at the open issues for 
> w2p, I don't see open issues related to fixing these incompatibilities. I 
> would be interested in some discussion about specifically what the 
> incompatibilities are, which open issues are addressing these problems and 
> the time frame to fix. What's the scale of these problems? Is it possible 
> to manually patch the problems?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/01441dad-ce91-4d97-b160-3ad9f1185625%40googlegroups.com.


[web2py] Re: web2py broken with Python 3.8

2020-01-06 Thread 'Woody' via web2py-users
Any update on when web2py will be compatible with Python 3.8?

On Sunday, December 8, 2019 at 2:59:49 AM UTC-5, Massimo Di Pierro wrote:
>
> Both web2py and py4web are currently incompatible with python 3.8 because 
> the latter break backward compatibility again. One of the issue is that 
> stream-like objects are now required to support more methods than they used 
> to. Another issue I am trying to get to the bottom of has to do with 
> pickling. I will try fix this over the week-end. It is a priority.
>
> On Friday, 6 December 2019 07:56:48 UTC-8, Woody wrote:
>>
>> web2py is broken with Python 3.8. I asked a question about this a few 
>> days ago and was told that it would be fixed. Looking at the open issues 
>> for w2p, I don't see open issues related to fixing these incompatibilities. 
>> I would be interested in some discussion about specifically what the 
>> incompatibilities are, which open issues are addressing these problems and 
>> the time frame to fix. What's the scale of these problems? Is it possible 
>> to manually patch the problems?
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/08699b10-57fa-4b16-b76c-311ac0e560b5%40googlegroups.com.


Re: [web2py] Re: Web2py with python 3.8.0

2019-11-29 Thread Woody
Shouldn't that be done before the release rather than afterward?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/cbb87866-f170-4338-ba3f-e93dfc3861f3%40googlegroups.com.


[web2py] Re: Web2py with python 3.8.0

2019-11-29 Thread Woody
What is causing the problem with Python 3.8? Is it causing problems with other 
applications? Is it an undocumented bug in Python? Is it likely that Python 
will be changed to fix the problem or will web2py have to conform to the Python 
changes?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e3321a7d-b518-49ec-8d57-9fcdc8886022%40googlegroups.com.


[web2py] Re: Web2py with python 3.8.0

2019-11-22 Thread Woody
I updated to Python 3.8 on Arch Linux today and I had the same problem with 
'escape'. I patched the languages.py file and got web2py to start, but then 
hit another error:

Traceback (most recent call last):
  File "/home/www/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/www/web2py/applications/x10_security/models/db.py" 
, line 
55, in 
auth.define_tables(username=False, signature=False)
  File "/home/www/web2py/gluon/tools.py", line 2092, in define_tables
super(Auth, self).define_tables(username, signature, migrate, 
fake_migrate)._table_signature_list
  File "/home/www/web2py/gluon/authapi.py", line 322, in define_tables
db.define_table(
  File "/home/www/web2py/gluon/packages/dal/pydal/base.py", line 592, in 
define_table
table = self.lazy_define_table(tablename, *fields, **kwargs)
  File "/home/www/web2py/gluon/packages/dal/pydal/base.py", line 623, in 
lazy_define_table
self._adapter.create_table(
  File "/home/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 798, 
in create_table
return self.migrator.create_table(*args, **kwargs)
  File "/home/www/web2py/gluon/packages/dal/pydal/migrator.py", line 299, in 
create_table
sql_fields_old = pickle.load(tfile)
TypeError: file must have 'read', 'readinto' and 'readline' attributes


I looked for a discussion or patch for this, but I didn't find one. Can 
anybody tell me how to fix 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/facebca6--4cd4-a643-a84d2a33e613%40googlegroups.com.


[web2py] Force boolean to use 1/0 in sqlite?

2013-07-27 Thread Woody
I have a legacy sqlite3 database that is tied to an application that uses 
1/0 to represent boolean values.  Sqlite doesn't have a boolean data type; 
1/0 is the conventional representation.  I want to define these fields as 
boolean in w2p so they will show up as checkboxes in SQLFORM, but when I do 
that, the values get updated as T/F, which doesn't work in my application.

Is there a way I can make these fields show up as checkboxes  in SQLFORM, 
but have the data stored as 1/0?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Force boolean to use 1/0 in sqlite?

2013-07-27 Thread Woody
Marin,

After some tinkering, SQLCustomType is working nicely for my purposes. 
 Thanks for your help!

On Saturday, July 27, 2013 1:00:29 PM UTC-4, Marin Pranjić wrote:

 1. SQLCustomType


 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Custom-Field-types-(experimental)

 2. filter_in and filter_out

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#filter_in-and-filter_out


 Marin


 On Sat, Jul 27, 2013 at 6:53 PM, Woody myl...@woodring.us 
 javascript:wrote:

 I have a legacy sqlite3 database that is tied to an application that uses 
 1/0 to represent boolean values.  Sqlite doesn't have a boolean data type; 
 1/0 is the conventional representation.  I want to define these fields as 
 boolean in w2p so they will show up as checkboxes in SQLFORM, but when I do 
 that, the values get updated as T/F, which doesn't work in my application.

 Is there a way I can make these fields show up as checkboxes  in SQLFORM, 
 but have the data stored as 1/0?

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




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Inject HTML in field definition

2013-07-18 Thread Woody
Hmm.  I'm having a lot of trouble figuring out how to use 'represent'. 
 Let's try a different approach.  Let's say I want to do this:

db_mydb.my_table.location.represent = lambda something)

And the something I want to output would be  XML('span 
style=color:#EB0F0F' + row.location + '/span')

Now, how would I create the lambda function to do this and then, how would 
I reference the .represent attribute:

   db_mydb.my_table.location.represent(?)

to retrieve the value that I want?


On Thursday, July 18, 2013 8:57:56 AM UTC-4, Richard wrote:

 Ok, I see 2 possibility why it not working. 1) Cause you use TABLE(), you 
 should try SQLTABLE or SQLFORM.gris. 2) LOAD(), since component strip all 
 the style it may be possible that you can't see your stuff.

 You can try to just embed your table in a view without LOAD() like that 
 {{=table}} see what happen.

 Then try SQLFORM.grid or SQLTABLE (that tend to be deprecated, but still 
 help in many situation where SQLFORM.gris lack of flexibility).

 Richard


 On Wed, Jul 17, 2013 at 11:46 PM, Woody myl...@woodring.us 
 javascript:wrote:

 Ok, here's the format for my select and table creation: 

 In the controller:

 rows = db_mydb(db_mydb.my_table).select()
 fields = db_mydb.my_table.fields
 headers = [list of headers]

 table = TABLE(THEAD(TR(*[B(header) for header in headers])),
  TBODY(*[TR(*[TD(row[field]) for field in fields]) \
 for row in rows]))
 table[_class] = table table-striped table-bordered table-condensed
 return dict(table=table)

 In the view:

 div id=table 
 {{=LOAD('default','my_table_function',ajax=True, target='table')}}
 /div



 On Wednesday, July 17, 2013 11:10:35 PM UTC-4, Richard wrote:

 Can you show us you select and the way you make your table and view?

 Richard


 On Wed, Jul 17, 2013 at 11:02 PM, Woody myl...@woodring.us wrote:

 I don't see 'This is a test'.  The table looks exactly the same as it 
 does without the represent statement.

 It doesn't matter what I put in the represent statement, If I have:

 db_mydb.my_table.location.**repr**esent=lambda location,row: 
 XML(T('This is a test'))

 'This is a test' doesn't appear in the table.

 It also doesn't work if I put:

 db_mydb.my_table.location.**repr**esent=lambda location,row:T('This is 
 a test').

 No matter what I put in the represent statement, my table looks the 
 same.  I'm obviously doing something wrong, but I can't figure out what it 
 is.


 On Wednesday, July 17, 2013 7:34:13 PM UTC-4, Richard wrote:

 I don't understand... Do you see : This is a test ?? You don't need 
 XML() for use a simple T(), XML serve to escape special caracter and 
 accentuated one, at least that my understanding. And of course there will 
 be not change (all your value will be represent with : This is a test, 
 since you don't take care of your location in your lambda.

 I never try to pass html tag in a represent except a A() helper, but I 
 don't why it would not work.

 You don't really need XML in the code above (virtual field), try this :

 Field.Virtual('description_**formatted', lambda row: 
 SPAN(row.description, _style=color:#EB0F0F;), 

 or 

 Field.Virtual('description_**formatted', lambda row: 
 TAG.span(row.description, _style=color:#EB0F0F;),  

 In case there is no SPAN helper (don't remember if there is SPAN() 
 helper).

 Richard
  

 On Wed, Jul 17, 2013 at 5:55 PM, Woody myl...@woodring.us wrote:

 'represent' is not working for me.  Here's my code:

 ---
 db_mydb.define_table('my_**table**',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('other_field', 'string'),
 migrate=False)

 db_mydb.my_table.location.**repr**esent=lambda location,row: 
 XML(T('This is a test'))
 

 Doesn't matter what I put in the represent declaration, the data 
 displayed in the table doesn't change.








 On Wednesday, July 17, 2013 3:34:21 PM UTC-4, Richard wrote:

 represent!!

 represent=lambda value, row: XML(...) if value is not None else 
 T('N/A')

 Richard


  On Wed, Jul 17, 2013 at 3:24 PM, Woody myl...@woodring.us wrote:

 I have a table definition that uses virtual fields with XML:

 db_mydb.define_table('my_**table',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('description', 'string', required=False),
 Field.Virtual('description_**formatted', 
 lambda row: XML('span style=color:#EB0F0F' + row.description + 
 '/span'), 
 etc

 So, using Field.Virtual, I can pass XML with HTML tags to a table. 
 Is there a way to do this without having to create a virtual field?  
 In 
 other words, I'd like to be able to add HTML formatting in a normal 
 field 
 definition, using XML or helper functions.

  -- 
  
 --- 
 You received this message because you are subscribed

[web2py] Re: Inject HTML in field definition

2013-07-18 Thread Woody
Thanks, Massimo.  That's a big help!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Inject HTML in field definition

2013-07-17 Thread Woody
I have a table definition that uses virtual fields with XML:

db_mydb.define_table('my_table',
Field('ROWID', 'id'),
Field('location', 'string'),
Field('description', 'string', required=False),
Field.Virtual('description_formatted', lambda row: 
XML('span style=color:#EB0F0F' + row.description + '/span'), 
etc

So, using Field.Virtual, I can pass XML with HTML tags to a table. Is there 
a way to do this without having to create a virtual field?  In other words, 
I'd like to be able to add HTML formatting in a normal field definition, 
using XML or helper functions.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Inject HTML in field definition

2013-07-17 Thread Woody
'represent' is not working for me.  Here's my code:

---
db_mydb.define_table('my_table',
Field('ROWID', 'id'),
Field('location', 'string'),
Field('other_field', 'string'),
migrate=False)

db_mydb.my_table.location.represent=lambda location,row: XML(T('This is a 
test'))


Doesn't matter what I put in the represent declaration, the data displayed 
in the table doesn't change.








On Wednesday, July 17, 2013 3:34:21 PM UTC-4, Richard wrote:

 represent!!

 represent=lambda value, row: XML(...) if value is not None else T('N/A')

 Richard


 On Wed, Jul 17, 2013 at 3:24 PM, Woody myl...@woodring.us 
 javascript:wrote:

 I have a table definition that uses virtual fields with XML:

 db_mydb.define_table('my_table',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('description', 'string', required=False),
 Field.Virtual('description_formatted', lambda row: 
 XML('span style=color:#EB0F0F' + row.description + '/span'), 
 etc

 So, using Field.Virtual, I can pass XML with HTML tags to a table. Is 
 there a way to do this without having to create a virtual field?  In other 
 words, I'd like to be able to add HTML formatting in a normal field 
 definition, using XML or helper functions.

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




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Inject HTML in field definition

2013-07-17 Thread Woody
I don't see 'This is a test'.  The table looks exactly the same as it does 
without the represent statement.

It doesn't matter what I put in the represent statement, If I have:

db_mydb.my_table.location.represent=lambda location,row: XML(T('This is a 
test'))

'This is a test' doesn't appear in the table.

It also doesn't work if I put:

db_mydb.my_table.location.represent=lambda location,row:T('This is a test').

No matter what I put in the represent statement, my table looks the same. 
 I'm obviously doing something wrong, but I can't figure out what it is.


On Wednesday, July 17, 2013 7:34:13 PM UTC-4, Richard wrote:

 I don't understand... Do you see : This is a test ?? You don't need XML() 
 for use a simple T(), XML serve to escape special caracter and accentuated 
 one, at least that my understanding. And of course there will be not change 
 (all your value will be represent with : This is a test, since you don't 
 take care of your location in your lambda.

 I never try to pass html tag in a represent except a A() helper, but I 
 don't why it would not work.

 You don't really need XML in the code above (virtual field), try this :

 Field.Virtual('description_**formatted', lambda row: 
 SPAN(row.description, _style=color:#EB0F0F;), 

 or 

 Field.Virtual('description_**formatted', lambda row: 
 TAG.span(row.description, _style=color:#EB0F0F;),  

 In case there is no SPAN helper (don't remember if there is SPAN() helper).

 Richard


 On Wed, Jul 17, 2013 at 5:55 PM, Woody myl...@woodring.us 
 javascript:wrote:

 'represent' is not working for me.  Here's my code:

 ---
 db_mydb.define_table('my_table',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('other_field', 'string'),
 migrate=False)

 db_mydb.my_table.location.represent=lambda location,row: XML(T('This is a 
 test'))
 

 Doesn't matter what I put in the represent declaration, the data 
 displayed in the table doesn't change.








 On Wednesday, July 17, 2013 3:34:21 PM UTC-4, Richard wrote:

 represent!!

 represent=lambda value, row: XML(...) if value is not None else T('N/A')

 Richard


  On Wed, Jul 17, 2013 at 3:24 PM, Woody myl...@woodring.us wrote:

 I have a table definition that uses virtual fields with XML:

 db_mydb.define_table('my_**table',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('description', 'string', required=False),
 Field.Virtual('description_**formatted', lambda row: 
 XML('span style=color:#EB0F0F' + row.description + '/span'), 
 etc

 So, using Field.Virtual, I can pass XML with HTML tags to a table. Is 
 there a way to do this without having to create a virtual field?  In other 
 words, I'd like to be able to add HTML formatting in a normal field 
 definition, using XML or helper functions.

  -- 
  
 --- 
 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/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Inject HTML in field definition

2013-07-17 Thread Woody
Ok, here's the format for my select and table creation: 

In the controller:

rows = db_mydb(db_mydb.my_table).select()
fields = db_mydb.my_table.fields
headers = [list of headers]

table = TABLE(THEAD(TR(*[B(header) for header in headers])),
 TBODY(*[TR(*[TD(row[field]) for field in fields]) \
for row in rows]))
table[_class] = table table-striped table-bordered table-condensed
return dict(table=table)

In the view:

div id=table 
{{=LOAD('default','my_table_function',ajax=True, target='table')}}
/div



On Wednesday, July 17, 2013 11:10:35 PM UTC-4, Richard wrote:

 Can you show us you select and the way you make your table and view?

 Richard


 On Wed, Jul 17, 2013 at 11:02 PM, Woody myl...@woodring.us 
 javascript:wrote:

 I don't see 'This is a test'.  The table looks exactly the same as it 
 does without the represent statement.

 It doesn't matter what I put in the represent statement, If I have:

 db_mydb.my_table.location.**represent=lambda location,row: XML(T('This 
 is a test'))

 'This is a test' doesn't appear in the table.

 It also doesn't work if I put:

 db_mydb.my_table.location.**represent=lambda location,row:T('This is a 
 test').

 No matter what I put in the represent statement, my table looks the same. 
  I'm obviously doing something wrong, but I can't figure out what it is.


 On Wednesday, July 17, 2013 7:34:13 PM UTC-4, Richard wrote:

 I don't understand... Do you see : This is a test ?? You don't need 
 XML() for use a simple T(), XML serve to escape special caracter and 
 accentuated one, at least that my understanding. And of course there will 
 be not change (all your value will be represent with : This is a test, 
 since you don't take care of your location in your lambda.

 I never try to pass html tag in a represent except a A() helper, but I 
 don't why it would not work.

 You don't really need XML in the code above (virtual field), try this :

 Field.Virtual('description_**for**matted', lambda row: 
 SPAN(row.description, _style=color:#EB0F0F;), 

 or 

 Field.Virtual('description_**for**matted', lambda row: 
 TAG.span(row.description, _style=color:#EB0F0F;),  

 In case there is no SPAN helper (don't remember if there is SPAN() 
 helper).

 Richard
  

 On Wed, Jul 17, 2013 at 5:55 PM, Woody myl...@woodring.us wrote:

 'represent' is not working for me.  Here's my code:

 ---
 db_mydb.define_table('my_**table',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('other_field', 'string'),
 migrate=False)

 db_mydb.my_table.location.**represent=lambda location,row: XML(T('This 
 is a test'))
 

 Doesn't matter what I put in the represent declaration, the data 
 displayed in the table doesn't change.








 On Wednesday, July 17, 2013 3:34:21 PM UTC-4, Richard wrote:

 represent!!

 represent=lambda value, row: XML(...) if value is not None else 
 T('N/A')

 Richard


  On Wed, Jul 17, 2013 at 3:24 PM, Woody myl...@woodring.us wrote:

 I have a table definition that uses virtual fields with XML:

 db_mydb.define_table('my_**table**',
 Field('ROWID', 'id'),
 Field('location', 'string'),
 Field('description', 'string', required=False),
 Field.Virtual('description_**for**matted', lambda 
 row: XML('span style=color:#EB0F0F' + row.description + '/span'), 
 etc

 So, using Field.Virtual, I can pass XML with HTML tags to a table. Is 
 there a way to do this without having to create a virtual field?  In 
 other 
 words, I'd like to be able to add HTML formatting in a normal field 
 definition, using XML or helper functions.

  -- 
  
 --- 
 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/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
  
 --- 
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py

[web2py] Re: How to insert line breaks in table cell created by a virtual field

2013-07-15 Thread Woody
Perfect!  That did the trick.

On Monday, July 15, 2013 4:39:05 AM UTC-4, Massimo Di Pierro wrote:

 Try this:

 db.table.field = Field.Virtual('alert_time', 
 lambda row: XML(str(a calculation that generates an 
 integer) + ' hoursbr/' + str(references a field that has type 
 datetime)))

 On Sunday, 14 July 2013 17:40:28 UTC-5, Woody wrote:

 I have a virtual field that concatenates 2 fields like this:

 Field.Virtual('alert_time', 
 lambda row: (str(a calculation that generates an 
 integer) + ' hours | ' + str(references a field that has type datetime))

  


 The result goes into a table cell and looks something like this:  8 
 hours 2013-07-14 09:10:20

 I want to force  line breaks so that it will look like this
  8 hours
   2013-07-14
 09:10:20

 I tried inserting line breaks using /n or br / in the text like this:

 lambda row: (str(a calculation that generates an integer) + ' hours/n' 
 + str(references a field that has type datetime))

 but they printed out as string literals in the table.  How can I format 
 the text for this cell?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Field.Virtual does not show up in db.table.fields

2013-07-14 Thread Woody
Thanks for the clarification.  This is what appears in the book:

Mind that virtual fields do not have the same attributes as the other 
fields (default, readable, requires, etc). In older versions of web2py they 
do not appear in the list of db.table.fields and they require a special 
approach to display in SQLFORM.grid and SQLFORM.smartgrid. See the 
discussion on grids and virtual fields in the Forms chapter.
*
*
The statement that it doesn't appear in older versions made me think that 
it would appear in the current version.  Is it likely that this will work 
in some future version?
*
*
On Sunday, July 14, 2013 5:18:26 AM UTC-4, Massimo Di Pierro wrote:

 No. This is the intended behavior.



 On Saturday, 13 July 2013 12:27:04 UTC-5, Woody wrote:

 I'm using version 2.5.1 stable and I've created a virtual field as part 
 of a table definition, like this:

 db_mydb.define_table('my_table',
 Field('ROWID', 'id'),
 Field('test_field1', 'string', required=True),
 Field('test_field2', 'string', required=False),
 Field.Virtual('virtual_field_test', lambda row: 
 test_field), 
 Field('test_field3', 'string', required=False),
 migrate=False)


 The other fields show up in mydb.my_table.fields, but the virtual field 
 does not.  According to the documentation, this didn't work in earlier 
 versions, but I assumed that means that it does work in the current 
 version.  Is this a bug?




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] How to insert line breaks in table cell created by a virtual field

2013-07-14 Thread Woody
I have a virtual field that concatenates 2 fields like this:

Field.Virtual('alert_time', 
lambda row: (str(a calculation that generates an integer) 
+ ' hours' + str(references a field that has type datetime))

The result goes into a table cell and looks something like this:  8 hours 
2013-07-14 09:10:20

I want to force  line breaks so that it will look like this
 8 hours
  2013-07-14
09:10:20

I tried inserting line breaks using /n or br / in the text like this:

lambda row: (str(a calculation that generates an integer) + ' hours/n' + 
str(references a field that has type datetime))

but they printed out as string literals in the table.  How can I format the 
text for this cell?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Using ROWID function as id field in sqlite tables

2013-07-14 Thread Woody
This may be something that is known by people with more experience than me, 
but it took me a lot of experimenting to figure it out, so I thought I 
would post it here so others will find it.

I have legacy sqlite tables that do not have an id field.  This makes it 
difficult to update them using SQLFORM.

ROWID is a hidden auto-increment integer field that's included in all 
sqlite tables.  You can make ROWID explicit by declaring it as the first 
field in a table definition, then you can assign it the 'id' alias.

Here's an example:

db.define_table('my_sqlite_table',
Field('ROWID', 'id'),
Field('some_field', 'string'),
Field('some_other_field', 'integer'),

migrate=False)

You can then use 'id' as a field name just as if your table had an actual 
id field defined in the underlying table.  As far as I can tell, this hack 
works without any problems.  The use of the 'id' alias is documented, but 
 I haven't seen the use of 'ROWID' with the alias discussed.  This might be 
something that could be tested and added to the documentation.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Field.Virtual does not show up in db.table.fields

2013-07-13 Thread Woody
I'm using version 2.5.1 stable and I've created a virtual field as part of 
a table definition, like this:

db_mydb.define_table('my_table',
Field('ROWID', 'id'),
Field('test_field1', 'string', required=True),
Field('test_field2', 'string', required=False),
Field.Virtual('virtual_field_test', lambda row: 
test_field), 
Field('test_field3', 'string', required=False),
migrate=False)


The other fields show up in mydb.my_table.fields, but the virtual field 
does not.  According to the documentation, this didn't work in earlier 
versions, but I assumed that means that it does work in the current 
version.  Is this a bug?
   

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: LOAD gives duplicate navbar

2013-07-07 Thread Woody
That's just what I needed.  Thanks much for the help.  Web2Py is a great 
development platform, and I really appreciate all of the generous help 
provided by people on this list!

On Saturday, July 6, 2013 9:36:28 PM UTC-4, Anthony wrote:

 {{=LOAD('default','select_table',args=(x10_state_view, 
 not_editable),ajax=True, target='table')}}


 If you don't specify an extension with LOAD(), it defaults to the usual 
 .html extension (just as the URL() function does). If you don't have a 
 specific .html view for the select_table() function, it will use the 
 generic.html view, which extends layout.html, which includes the navbar. 
 Instead, it is common to use the .load extension for LOAD() components 
 (though that's just a convention and not required). It will then use the 
 generic.load view, unless you create a custom .load view (which you should 
 do, as the generic views are disabled by default on production for security 
 reasons).

 Anthony


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] LOAD gives duplicate navbar

2013-07-06 Thread Woody
I have an index.html that looks uses LOAD to call a function which returns 
a table.  Here's the code for index.html:

{{extend 'layout.html'}}
h4 Current State /h4
hr
div id=table
{{=LOAD('default','select_table',args=(x10_state_view, 
not_editable),ajax=True, target='table')}}
/div
hr

Everything looks good, except that the navbar gets duplicated inside the 
div that contains the LOAD call.  What do I need to do to fix this?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Can view, but can't edit files

2013-07-03 Thread Woody

Okay,

I'm still struggling with this.  I opened up ports on my router, so now I'm 
accessing w2p admin using https from the outside world.  Admin functions 
seem normal, except that editing files is extremely flaky.  I can open a 
file and edit it once, but the next file I open gives a communication error 
when I try to open it, then, after that, I can't open any files until I log 
out and start over.  It appears that this might be a timing issue, because, 
I have more success opening smaller files and some larger files I can't 
open at all.

This situation makes it more or less impossible to use the admin editing 
from a remote location.  Again, when I'm editing on the same LAN as the 
server, everything works ok.  I've checked all of the file permissions, and 
they seem good.  If this is a situation where the editing function is 
timing out because of slow loading, is there a way to deal with that?





-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How to get a list of all fields in a table?

2013-06-28 Thread Woody
Perfect! Thanks.

On Thursday, June 27, 2013 4:43:07 PM UTC-4, Niphlod wrote:

 tables list = db.tables
 field list for table 'a_table' = db.a_table.fields



 On Thursday, June 27, 2013 10:30:24 PM UTC+2, Woody wrote:

 I hope the answer to this is something that's not too obvious, but I've 
 searched a bit and have not found an answer.  I'm looking for a way to 
 programatically get a list of all of the fields in a given table.  My 
 intention is to build a common function that will use variables for table 
 names and fields to display a similar form for several different tables.

 I see that I can use the Crud API to get table names like this:  
 crud.tables().  Is there a similar way to get field names, using crud or 
 something else?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] How to get a list of all fields in a table?

2013-06-27 Thread Woody
I hope the answer to this is something that's not too obvious, but I've 
searched a bit and have not found an answer.  I'm looking for a way to 
programatically get a list of all of the fields in a given table.  My 
intention is to build a common function that will use variables for table 
names and fields to display a similar form for several different tables.

I see that I can use the Crud API to get table names like this:  
crud.tables().  Is there a similar way to get field names, using crud or 
something else?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Can view, but can't edit files

2013-06-26 Thread Woody
Let me clarify.  The server is a headless system (actually, a small plug 
computer).  So, I can access it like this:

Local LAN PC#1: 192.168.xxx.111 - Server: 192.168.xxx.222 .  This works ok.

Now, when I ssh tunnel to PC#1 or to Server, I can go to URL: 
https://192.168.xxx.222/admin or https://127.0.0.1/admin and I can connect 
to web2py admin and authenticate to it.  But when I open an application 
file, nothing appears in the edit window.  I've tried this using different 
browsers, etc.  but I can't get the edit window to appear.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Can view, but can't edit files

2013-06-24 Thread Woody
Thanks for the suggestion, but refreshing the page doesn't make a 
difference.  I've tried setting up the ssh tunnel with different ports, 
etc., but I can't get editing to work.  Seems as though it could be a 
permissions problem, but I can't see why there is a problem.  It's also 
possible that it is some issue with the way I have nginx or uwsgi 
configured, but I'm stumped on that, too.

On Friday, June 21, 2013 1:03:59 PM UTC-4, Niphlod wrote:

 from web2py's standpoint (the web one) it only matters where requests are 
 from, not the user who's doing those.
 If you have a working admin on the local LAN and you can access but not 
 edit from outside your LAN, than you're doing the ssh tunnel wrong.

 PS: did you just tried to do a ctrl+R to refresh all static assets while 
 on tunnel ? Problems can happen if you load an admin app in your local 
 computer using 127.0.0.1:8000 and then a remote (ssh tunneled) admin on 
 127.0.0.1:8000 too. 
 If web2py's versions are different, your browser can't tell the difference 
 between one or another admin app, so it may retain in cache the other 
 version of admin's static files.

 On Friday, June 21, 2013 6:27:46 PM UTC+2, Woody wrote:

 I am using web2py admin served by nginx and uwsgi.  When I access the 
 server from the same LAN, I can edit files with no problem.  When I use an 
 ssh tunnel to proxy into my LAN from a remote location, I can login to the 
 admin app and I can view files, but when I try to edit them, I get nothing 
 in the edit window.  I get no errors, just a blank edit window.

 The permissions used by the nginx, and uwsgi match the file ownership. 
  If I change the ownership to 777, I still have the problem.  Anybody have 
 an idea what's causing this?



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Can view, but can't edit files

2013-06-21 Thread Woody
I am using web2py admin served by nginx and uwsgi.  When I access the 
server from the same LAN, I can edit files with no problem.  When I use an 
ssh tunnel to proxy into my LAN from a remote location, I can login to the 
admin app and I can view files, but when I try to edit them, I get nothing 
in the edit window.  I get no errors, just a blank edit window.

The permissions used by the nginx, and uwsgi match the file ownership.  If 
I change the ownership to 777, I still have the problem.  Anybody have an 
idea what's causing this?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.