[web2py] Re: Why does appadmin have css overflow: hidden in database results?

2014-04-13 Thread User
Yes but with overflow:visible (the default css setting) there are no scroll 
bars and if the table has enough columns than the browser will show a 
horizontal scrollbar anyway as part of the browser window (as opposed to 
with auto showing the scrollbars as part of the div).  With "auto" It just 
gives the feeling of html frames which I thought most people agree are 
annoying except in limited circumstances.

For me it just seems like overflow: auto is just an annoyance with no 
benefit, but I was wondering if there was something I was overlooking.  

On Sunday, April 13, 2014 1:46:32 PM UTC-4, Paolo Caruccio wrote:

> With overflow:auto the scrollbars (vertical and horizontal) are visible 
> only when it is necessary.
> Making scrollbars visible only when you need them is for aesthetic 
> reasons. Indeed not all the tables have a great number of columns. 
>
> Il giorno domenica 13 aprile 2014 13:32:41 UTC+2, User ha scritto:
>>
>> Sorry you're right it's auto not hidden that was a typo.  But why not 
>> make it visible?
>>
>> On Sunday, April 13, 2014 5:37:53 AM UTC-4, Paolo Caruccio wrote:
>>>
>>> If you mean the view "*appadmin/select/db?query=your query"* actually 
>>> the table with the resulting rows is wrapped in a div with "
>>> overflow:auto".
>>> Therefore if you have more columns than the width of the browser a 
>>> horizontal scrollbar will be shown and the table will scroll horizontally. 
>>> The horizontal scrollbar (that is managed by browser not by web2py) is 
>>> positioned after the last displayed row but you can scroll the table with 
>>> arrow keys on the keyboard.
>>> For the sake of completeness, if the div wrapper had "overflow:hidden" 
>>> you couldn't see any scrollbar.
>>> 
>>>
>>> Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto:

 In appadmin, if I query a table that has more columns than the width of 
 my browser there will be a horizontal scrollbar places on the div 
 containing the database rows.  I find this annoying because in order to 
 scroll horizontally I have to go to the bottom of the search results first 
 to find the horizontal scrollbar and then scroll.

 If the containing div had overflow: visible then I could use the 
 browser's horizontal scrollbar which is much more convenient.  My question 
 is what purpose does having overflow = hidden serve in this context?

>>>

-- 
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: Broken migration

2014-04-13 Thread pallav
To use fake_migrate, first you have to revert your model definition to the 
old version (that matches the existing db), run the app. This will make 
web2py update the table definition file. Now, you can change your models 
and set fake_migrate to False, and migrate to True.

On Sunday, April 13, 2014 5:49:17 PM UTC-4, Wonton wrote:
>
> Hello!
>
> I have a web2py application with a sqlite database. The structure of my 
> db.py file is something like this:
>
> db = DAL('sqlite://storage.sqlite', migrate=False)
> ...
> db.define_table('table1',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 
> (field1)')
>
> db.define_table('table2',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table2_field1 ON table2 
> (field1)')
>
> ...
>
> Each time I want to add a new table or a new field, I remove ", 
> migrate=False", make the change and, after it has been applied I add ", 
> migrate=False" again.
> This has been working very well so far.
>
> Inside my database folder I have this files:
> storage.sqlite
> c8b1837fhj47blahblahblah_table1.table
> c8b1837fhj47blahblahblah_table2.table
>
> Well, now my problem. Last time I made an update (I added a new table) in 
> my database, the migration was broken. I don't know why but I guess it was 
> probably because I removed accidentally the .table files and after restore 
> them maybe they were too old. I tried everything and finally the migration 
> worked and the database added the new table.
>
> Now my db.py file is something like this:
>
> db = DAL('sqlite://storage.sqlite', migrate=False)
> ...
> db.define_table('table1',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 
> (field1)')
>
> db.define_table('table2',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table2_field1 ON table2 
> (field1)')
>
> db.define_table('newtable',
> Field('field1'))
> db.executesql('CREATE INDEX IF NOT EXISTS newtable_field1 ON newtable 
> (field1)')
>
> ...
>
> but the first strange thing, in my database folder now I have this:
> storage.sqlite
> c8b1837fhj47blahblahblah_table1.table
> c8b1837fhj47blahblahblah_table2.table
> newtable.table
>
> Why newtable.table doesn't have the c8b1837fhj47blahblahblah part? Is this 
> important?
>
> The thing is that I need to add a new field to table1 table and I'm 
> getting errors and I don't know how to solve them.
>
> Just removing the ", migrate=False" part I get the error "newtable is 
> already defined" and the application fails.
> I've tried to use db = DAL('sqlite://storage.sqlite', fake_migrate=True)and 
> have no errors. Then I add my new field but no changes are applied to 
> the database.
>
> What am i doing wrong? how could I fix this?
>
> Kind regards and thank you very much!
>

-- 
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: current trunk using memdb results in crash

2014-04-13 Thread pallav
deleting memcache causes a separate issue 
(https://code.google.com/p/web2py/issues/detail?id=1919) that you may be 
seeing.

Basically, your browser now refers to a session that is not in memory 
anymore. Web2py looks for the missing key in memdb and crashes. Try 
clearing out your browser's sessions and cookies, this will disassociate 
your browser from the web2py session, and force the creation of a new 
session when you log in. You can also try using incognito mode in chrome to 
get a new session.

On Friday, April 11, 2014 10:04:49 AM UTC-4, David Manns wrote:
>
> Tried this - didn't help
>
> On Thursday, April 10, 2014 5:17:38 PM UTC-4, Sebastian Cambeo wrote:
>>
>> Try deleting memcache and browser cache
>>
>> Am Donnerstag, 10. April 2014 21:13:39 UTC+2 schrieb David Manns:
>>>
>>> I am still seeing this in released version 2.9.5??
>>>
>>> On Sunday, March 9, 2014 9:04:49 PM UTC-4, Massimo Di Pierro wrote:

 This is fixed in trunk.

 On Friday, 7 March 2014 21:11:08 UTC-6, Leonardo Pires Felix wrote:
>
> Looks like that this is happening with the REDIS too, Upgraded from 
> 2.8.3 to 2.9.4 And the error persist.
>
> Traceback (most recent call last):
>   File 
> "/home/leonardo/domains/cef03.com/arquivos/web2py/gluon/restricted.py", 
> line 217, in restricted
> exec ccode in environment
>   File 
> "/home/leonardo/domains/cef03.com/arquivos/web2py/applications/cef03/models/db.py"
>  , line 62, in 
> 
> session.connect(request, response, db = sessiondb)
>   File 
> "/home/leonardo/domains/cef03.com/arquivos/web2py/gluon/globals.py", line 
> 883, in connect
> row = table(record_id, unique_key=unique_key)
> TypeError: __call__() got an unexpected keyword argument 'unique_key'
>
>
>
>
>
> Em terça-feira, 4 de março de 2014 19h37min17s UTC-3, Sebastian Cambeo 
> escreveu:
>>
>> I can only provide assistance for the "unique key error":
>> line 883: 
>> https://github.com/web2py/web2py/blame/master/gluon/globals.py:
>> dee4e6a9
>>  
>> »
>>  
>> mdipierro  
>> 2013-08-20 new session logic 
>>
>>
>> I don't know how the "int64 too big" error was introduced
>>
>>
>>
>> Am Dienstag, 4. März 2014 22:29:56 UTC+1 schrieb Massimo Di Pierro:
>>>
>>> can you provide a patch or a revision number that broke it?
>>>
>>> On Saturday, 1 March 2014 12:25:14 UTC-6, Bas Ti wrote:

 The current trunk does not support using memcache as session store 
 on GAE:
 session.connect calls memdb.Table.__call__(recordid, 
 unique_key=unique_key)

 however unique_key is not supported by memdb.Table, it is only 
 supported by dal.Table

>>>

-- 
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] Personalize calendar for reservation

2014-04-13 Thread FERNANDO VILLARROEL
Dear all.

I see the post; https://groups.google.com/forum/#!topic/web2py/IIYWWB0D7e4  


I am think to do a reservation site, basically i need to input a date range :

fromfate
todate

My probem is how i can show a calendar with days in green colors for available 
days and red colors for reservated days, like this:

http://easyreservations.org/


Excuse my english
Regards

-- 
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] great news: Sphinx Documentation

2014-04-13 Thread Brian M
Great job niphlod!

-- 
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: Networkx draw graph

2014-04-13 Thread Luis Fontes
Thank you very much for your help Massimo.
The problem I have is not how to plot easily in matplotlib. My problem is 
how to display
in my web2py view the NetworkX drawing made using nx.draw without saving 
the png file in disk 
but using some code like:

canvas=FigureCanvas(fig)
stream=cStringIO.StringIO()
canvas.print_png(stream)
return stream.getvalue()

as I have seen in the web2py Application Development Cookbook and in your 
paper "web2py for Scientific Applications" (2011). 

If you try for example:

import matplotlib.pyplot as plt
import networkx as nx
G = nx.path_graph(21)
nx.draw(G)
plt.show()

you get a plot. Now, how should I put this code in my model or controller 
to get 
the plot in my web2py view. 

Thank you for your help.






 

On Sunday, April 13, 2014 5:59:39 PM UTC+2, Massimo Di Pierro wrote:
>
> Not sure but look into https://github.com/mdipierro/canvas
>
> On Saturday, 12 April 2014 04:10:42 UTC-5, Luis Fontes wrote:
>>
>> I am trying to plot a graph using NetworkX draw function but 
>> using cStringIO.StringIO(). I have read
>> how to do it in web2py Application Development Cookbook.
>>
>> Let's say I have something like:
>>
>> import matplotlib.pyplot as plt
>> import networkx as nx
>>
>> G = nx.path_graph(8)
>> nx.draw(G)
>> plt.show()
>>
>> This code plots and shows the graph. Now, to place it in a web2py view I 
>> should use a function like:
>>
>>
>> def mygraph()
>> fig=Figure()
>>
>> .
>> .
>> .
>>
>> canvas=FigureCanvas(fig)
>> stream=cStringIO.StringIO()
>> canvas.print_png(stream)
>> return stream.getvalue()
>>
>> The problem is how to place the plot generated by nx.path_graph(8) and 
>> nx.draw(G) in the code in
>> blue in order to make it work.
>>
>> I am learning web2py and I am nor expert in NetworkX or matplotlib 
>> packages. Sorry if my question
>> is stupid.
>>
>> Thank you.
>>
>>

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


[web2py] Nginx/passenger/web2py -> 504 Gateway Timeout?

2014-04-13 Thread Krzysztof Socha
I am trying to setup (vanila) web2py on shared hosting with nginx and 
passenger with support for python. I put all the files from web2py folder 
in the folder expected by passenger, I created a file passenger_wsgi.py 
required by passenger, which I simlinked to wsgihandler.py (taken from the 
handlers dir to the dir where web2py.py resides). The result: nothing works 
- I get consistently 504 Gateway Timeout for every attempted connection. 

On the other hand, when I simply created a passenger_wsgi.py file that 
contained:

def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  return [b"hello world!\n"]

then everything works fine - i.e., I get the "hello world". 

I believe, it takes about one minute for the request to time-out... Does 
the web2py startup take so long?  When can/should I do to make it work?

Krzysztof.


  

  start_response('200 OK', [('Content-Type', 'text/plain')])
  return [b"hello world!\n"]

def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  return [b"hello world!\n"]

def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  return [b"hello world!\n"]

def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')]) def 
application(environ, start_response):

  start_response('200 OK', [('Content-Type', 'text/plain')])
  return [b"hello world!\n"]

-- 
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: Networkx draw graph

2014-04-13 Thread Luis Fontes


On Saturday, April 12, 2014 11:10:42 AM UTC+2, Luis Fontes wrote:
>
> I am trying to plot a graph using NetworkX draw function but 
> using cStringIO.StringIO(). I have read
> how to do it in web2py Application Development Cookbook.
>
> Let's say I have something like:
>
> import matplotlib.pyplot as plt
> import networkx as nx
>
> G = nx.path_graph(8)
> nx.draw(G)
> plt.show()
>
> This code plots and shows the graph. Now, to place it in a web2py view I 
> should use a function like:
>
>
> def mygraph()
> fig=Figure()
>
> .
> .
> .
>
> canvas=FigureCanvas(fig)
> stream=cStringIO.StringIO()
> canvas.print_png(stream)
> return stream.getvalue()
>
> The problem is how to place the plot generated by nx.path_graph(8) and 
> nx.draw(G) in the code in
> blue in order to make it work.
>
> I am learning web2py and I am nor expert in NetworkX or matplotlib 
> packages. Sorry if my question
> is stupid.
>
> Thank you.
>
>

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


[web2py] Re: configuring routes for web2py behind reverse proxy

2014-04-13 Thread Jason Lee
What file am I supposed to add this to?

default, weby2py, default-sll?

On Thursday, November 14, 2013 6:48:05 PM UTC-5, DeanK wrote:
>
> For anyone in the future trying to do this with Apache2 on Ubuntu:
>
> ProxyHTMLInterp On
> LogLevel Debug
> ProxyHTMLLogVerbose On
> ProxyPass /link/ http://my.server.com/
> ProxyPassReverse /link/ http://my.server.com/
>
> ProxyHTMLURLMap http://my.server.com /link/
>
> 
>   ProxyPassReverse /
>   SetOutputFilter  proxy-html
>   ProxyHTMLURLMap http://my.server.com /link/
>   ProxyHTMLURLMap / /link/
>   ProxyHTMLURLMap  /link/ /link/
>   RequestHeaderunset  Accept-Encoding
> 
>
>
>
> On Tuesday, November 5, 2013 11:51:11 AM UTC-5, DeanK wrote:
>>
>> I have an instance of web2py running on nginx sitting behind an apache 
>> reverse proxy (soon to be nginx as well) so:
>>
>> www.mydomain.com/myapppoints to >>myserver1.otherdomain.com
>>
>> i have /myapp/default/landing set as the default application, controller, 
>> and function.  When i go directly to myserver1.otherdomain.comeverything is 
>> fine, but if i go to 
>> www.mydomain.com/myapp all of my static files are unreachable because 
>> the relative paths point to www.mydomain.com/myapp/static/file where 
>> really it would have to be www.mydomain.com/myapp/myapp/static/filewhich is 
>> kind of ugly.  I am using URL() to create relative links.
>>
>> I first though maybe the fact the the reverse proxy url and app names are 
>> the same was confusing regex or whatever was doing the rewrites, but that 
>> didn't seem to be the case.  I also started looking at routes.py and set 
>> BASE = 'myapp'.  That made parts of my site work, but things like login 
>> then didn't.
>>
>>
>> Anyone have experience setting a web2py app up behind a reverse proxy? 
>>  Thoughts? Thanks,
>>
>> Dean
>>
>

-- 
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: Broken migration

2014-04-13 Thread 黄祥
just a suggestion, please put the create index in the controller because 
models is always execute everytime your application is execute, so 
includeing create index too

e.g.
*controllers/install.py*
def index:
db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 
(field1)')

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.


[web2py] Database compute fields

2014-04-13 Thread Anthony
I believe you have to provide the price field in your update as well.

-- 
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: Broken migration

2014-04-13 Thread Wonton
Wow, sorry for answering myself, but I managed to get it working. I've 
tried to add c8b1837fhj47blahblahblah_ before newtable.table file and now 
everything is working.

Could it be a problem add this to my table file?

On Sunday, April 13, 2014 11:49:17 PM UTC+2, Wonton wrote:
>
> Hello!
>
> I have a web2py application with a sqlite database. The structure of my 
> db.py file is something like this:
>
> db = DAL('sqlite://storage.sqlite', migrate=False)
> ...
> db.define_table('table1',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 
> (field1)')
>
> db.define_table('table2',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table2_field1 ON table2 
> (field1)')
>
> ...
>
> Each time I want to add a new table or a new field, I remove ", 
> migrate=False", make the change and, after it has been applied I add ", 
> migrate=False" again.
> This has been working very well so far.
>
> Inside my database folder I have this files:
> storage.sqlite
> c8b1837fhj47blahblahblah_table1.table
> c8b1837fhj47blahblahblah_table2.table
>
> Well, now my problem. Last time I made an update (I added a new table) in 
> my database, the migration was broken. I don't know why but I guess it was 
> probably because I removed accidentally the .table files and after restore 
> them maybe they were too old. I tried everything and finally the migration 
> worked and the database added the new table.
>
> Now my db.py file is something like this:
>
> db = DAL('sqlite://storage.sqlite', migrate=False)
> ...
> db.define_table('table1',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 
> (field1)')
>
> db.define_table('table2',
> Field('field1'),
> Field('field2'))
> db.executesql('CREATE INDEX IF NOT EXISTS table2_field1 ON table2 
> (field1)')
>
> db.define_table('newtable',
> Field('field1'))
> db.executesql('CREATE INDEX IF NOT EXISTS newtable_field1 ON newtable 
> (field1)')
>
> ...
>
> but the first strange thing, in my database folder now I have this:
> storage.sqlite
> c8b1837fhj47blahblahblah_table1.table
> c8b1837fhj47blahblahblah_table2.table
> newtable.table
>
> Why newtable.table doesn't have the c8b1837fhj47blahblahblah part? Is this 
> important?
>
> The thing is that I need to add a new field to table1 table and I'm 
> getting errors and I don't know how to solve them.
>
> Just removing the ", migrate=False" part I get the error "newtable is 
> already defined" and the application fails.
> I've tried to use db = DAL('sqlite://storage.sqlite', fake_migrate=True)and 
> have no errors. Then I add my new field but no changes are applied to 
> the database.
>
> What am i doing wrong? how could I fix this?
>
> Kind regards and thank you very much!
>

-- 
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] Broken migration

2014-04-13 Thread Wonton
Hello!

I have a web2py application with a sqlite database. The structure of my 
db.py file is something like this:

db = DAL('sqlite://storage.sqlite', migrate=False)
...
db.define_table('table1',
Field('field1'),
Field('field2'))
db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 (field1)')

db.define_table('table2',
Field('field1'),
Field('field2'))
db.executesql('CREATE INDEX IF NOT EXISTS table2_field1 ON table2 (field1)')

...

Each time I want to add a new table or a new field, I remove ", 
migrate=False", make the change and, after it has been applied I add ", 
migrate=False" again.
This has been working very well so far.

Inside my database folder I have this files:
storage.sqlite
c8b1837fhj47blahblahblah_table1.table
c8b1837fhj47blahblahblah_table2.table

Well, now my problem. Last time I made an update (I added a new table) in 
my database, the migration was broken. I don't know why but I guess it was 
probably because I removed accidentally the .table files and after restore 
them maybe they were too old. I tried everything and finally the migration 
worked and the database added the new table.

Now my db.py file is something like this:

db = DAL('sqlite://storage.sqlite', migrate=False)
...
db.define_table('table1',
Field('field1'),
Field('field2'))
db.executesql('CREATE INDEX IF NOT EXISTS table1_field1 ON table1 (field1)')

db.define_table('table2',
Field('field1'),
Field('field2'))
db.executesql('CREATE INDEX IF NOT EXISTS table2_field1 ON table2 (field1)')

db.define_table('newtable',
Field('field1'))
db.executesql('CREATE INDEX IF NOT EXISTS newtable_field1 ON newtable 
(field1)')

...

but the first strange thing, in my database folder now I have this:
storage.sqlite
c8b1837fhj47blahblahblah_table1.table
c8b1837fhj47blahblahblah_table2.table
newtable.table

Why newtable.table doesn't have the c8b1837fhj47blahblahblah part? Is this 
important?

The thing is that I need to add a new field to table1 table and I'm getting 
errors and I don't know how to solve them.

Just removing the ", migrate=False" part I get the error "newtable is 
already defined" and the application fails.
I've tried to use db = DAL('sqlite://storage.sqlite', fake_migrate=True)and 
have no errors. Then I add my new field but no changes are applied to 
the database.

What am i doing wrong? how could I fix this?

Kind regards and thank you very much!

-- 
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: form help

2014-04-13 Thread pallav
Your way will work, but you can do it easier by just using 
sqlform.smartgrid - the tables will be automatically generated. It works 
for the simple case where you want to give people the ability to add an 
item, add a category, and also associate any item with any category.

On Friday, April 11, 2014 12:34:24 PM UTC-4, Cristian Re wrote:
>
> Hello to all,
>
> assuming I have in db.py these tables:
>
> db.define_table('items', 
> Field('item', requires=IS_NOT_EMPTY()),
> format='%(item)s'
> )
>
> db.define_table('types',
> Field('type_name', requires=IS_NOT_EMPTY()),
> format='%(type)s'
> )
> 
> db.define_table('item_type',
> Field('item_id', 'reference items'),
> Field('types_id', 'reference types')
> )
>
> I have for example 50 items and 3 types and I would like to associate into 
> table item_type any item to a type.
> In my mind there is a page with a table with all the items; on the left 
> there is the neme of the item and on the right a select list with all the 
> types.
>
> what is the right way to do this with web2py?
>
> in my controller I tried with:
>
> def item_type():
> items =  db().select(db.items.ALL)
> types =  db().select(db.type.ALL)
> return dict(items=items, types=types)
>
> and into a view:
>
>
> 
> 
> {{for en, item in enumerate(items):}}
> 
> 
>  />{{=item.item}}
> 
> 
> 
> -
> {{for type in types:}}
> {{=type.type_name}}
> {{pass}}
> 
> 
> 
> {{pass}}
> 
> 
> 
> 
>
> It's the right way or I can do something better?
>
> thanks in advance
>
>
>

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


[web2py] Re: great news: Sphinx Documentation

2014-04-13 Thread pallav
Much neater! Thank you.

On Sunday, April 13, 2014 11:43:26 AM UTC-4, Massimo Di Pierro wrote:
>
> Great news! We are finally moving to Sphinx.
>
> http://web2py.readthedocs.org/en/latest/
>
> Kudos to Simone (niphlod) who single handedly ported all the docstrings 
> and made this possible.
>
> Thank you Simone!
>
>  
>

-- 
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] GAE Select Ignores cache and cacheable arguments?

2014-04-13 Thread pallav
It seems like the 'cache' and 'cacheable' arguments to the .select() 
statement do not work on GAE. This is even after setting 
cache.ram=cache.memcache (following the code in the book and multiple 
examples in this forum)

I tested on a GAE app, and explicitly setting memcache works, but the 
select statements ignore it and go straight to the database.

I also looked at the code in the GoogleDatastoreAdapter class in dal.py, 
the select() functions passes control through to the select_raw() function, 
and the select_raw() function does not check for the 'cache' or 'cacheable' 
attribute at all.

The book does not explicitly say that cache/cacheable do not work on GAE, 
only that we should use memcache (which I am using).

Am I missing something? Is this a bug?

-- 
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] deployment error

2014-04-13 Thread Richard
Gooed evening,

When I call an app on my domain the index view is returned.
But having an SSL connection In Chrome I do get the following error (In 
IE 11 I do not get an error)

Any clus what may cause this? I run from the latest source version of 
web2py.

Thank you in advance

TICKET ID

213.10.60.120.2014-04-13.14-08-36.a2f01714-7fb0-4aa9-8519-636ee745fb03
 not enough arguments for format stringVERSION
web2py™stablePythonPython 2.6.6: /usr/bin/python (prefix: /usr)TRACEBACK

1.
2.
3.
4.
5.
6.
7.

Traceback (most recent call last):
  File "/home4/mamplcom/public_html/cgi-bin/gluon/restricted.py", line 217, in 
restricted
exec ccode in environment
  File 
"/home4/mamplcom/public_html/cgi-bin/applications/admin/views/default/site.html",
 line 123, in 

TypeError: not enough arguments for format string

ERROR SNAPSHOT 

-- 
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: Why does appadmin have css overflow: hidden in database results?

2014-04-13 Thread Paolo Caruccio
With overflow:auto the scrollbars (vertical and horizontal) are visible 
only when it is necessary.
Making scrollbars visible only when you need them is for aesthetic reasons. 
Indeed not all the tables have a great number of columns. 

Il giorno domenica 13 aprile 2014 13:32:41 UTC+2, User ha scritto:
>
> Sorry you're right it's auto not hidden that was a typo.  But why not make 
> it visible?
>
> On Sunday, April 13, 2014 5:37:53 AM UTC-4, Paolo Caruccio wrote:
>>
>> If you mean the view "*appadmin/select/db?query=your query"* actually 
>> the table with the resulting rows is wrapped in a div with "overflow:auto
>> ".
>> Therefore if you have more columns than the width of the browser a 
>> horizontal scrollbar will be shown and the table will scroll horizontally. 
>> The horizontal scrollbar (that is managed by browser not by web2py) is 
>> positioned after the last displayed row but you can scroll the table with 
>> arrow keys on the keyboard.
>> For the sake of completeness, if the div wrapper had "overflow:hidden" 
>> you couldn't see any scrollbar.
>> 
>>
>> Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto:
>>>
>>> In appadmin, if I query a table that has more columns than the width of 
>>> my browser there will be a horizontal scrollbar places on the div 
>>> containing the database rows.  I find this annoying because in order to 
>>> scroll horizontally I have to go to the bottom of the search results first 
>>> to find the horizontal scrollbar and then scroll.
>>>
>>> If the containing div had overflow: visible then I could use the 
>>> browser's horizontal scrollbar which is much more convenient.  My question 
>>> is what purpose does having overflow = hidden serve in this context?
>>>
>>

-- 
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: Networkx draw graph

2014-04-13 Thread Massimo Di Pierro
Not sure but look into https://github.com/mdipierro/canvas

On Saturday, 12 April 2014 04:10:42 UTC-5, Luis Fontes wrote:
>
> I am trying to plot a graph using NetworkX draw function but 
> using cStringIO.StringIO(). I have read
> how to do it in web2py Application Development Cookbook.
>
> Let's say I have something like:
>
> import matplotlib.pyplot as plt
> import networkx as nx
>
> G = nx.path_graph(8)
> nx.draw(G)
> plt.show()
>
> This code plots and shows the graph. Now, to place it in a web2py view I 
> should use a function like:
>
>
> def mygraph()
> fig=Figure()
>
> .
> .
> .
>
> canvas=FigureCanvas(fig)
> stream=cStringIO.StringIO()
> canvas.print_png(stream)
> return stream.getvalue()
>
> The problem is how to place the plot generated by nx.path_graph(8) and 
> nx.draw(G) in the code in
> blue in order to make it work.
>
> I am learning web2py and I am nor expert in NetworkX or matplotlib 
> packages. Sorry if my question
> is stupid.
>
> Thank you.
>
>

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


[web2py] Re: Web2Py vs Django - powered sites.

2014-04-13 Thread Massimo Di Pierro
Django has been around longer (at least 5 years longer) and therefore there 
are more users. In terms of scalability they are very similar. They are 
both solid. web2py is easier to start with and requires less coding than 
Django. web2py includes much more stuff in the standard distribution while 
Django has more third party modules. web2py never broke (or will break) 
backward compatibility. Django did it. Django has an ORM which I personally 
find somewhat constraining and you have to rewrite your code to use GAE or 
Mongo. web2py has a DAL which is close to the SQL syntax but can run out of 
the box on GAE and Mongo as long as you do not use Joins.

You may want to look at this: http://vimeo.com/6507384
The Django tutorial compared to web2py.

Massimo

On Friday, 11 April 2014 09:15:28 UTC-5, digirew wrote:
>
> Hello Everyone,
>
>
> I am in the process of evaluating Web2py and Django frameworks for our 
> application. So far I like what I see with Web2py.  I will need to build 
> a business case for one vs the other.
>
>
> Few initial questions if you have some input:
>
>
> 1.  is there any large enterprise sites/users using the Web2py framework? 
> I took a look at the web2py powered by sites at 
> http://web2py.com/poweredby. The examples shown are not very 
> convincing/encouraging.
>
>
> Compared with Django, the site lists many large enterprise players…Disqus, 
> Instagram, Mozilla, OpenStack, Pinterest etc.
>
>
>
>
> 2.  I read a lot on the internet that you should choose a framework that 
> suits your applications requirements.
>
>
> Q: Why would one choose Web2py over Django? or are these two frameworks so 
> similar that it boils down to coding preference / feature sets etc?
>
>
>
> Thanks in advance for your input
>
>
>
>

-- 
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: Illegal character in encryption salt

2014-04-13 Thread Massimo Di Pierro
The problem is not really that you use $ in salt. The probably is that 
web2py and the framework you moved from must have different conventions for 
storing the salt. We use  'alg$salt$pwd'. What do they use? What is the 
framework? If we know we can convert it.


On Friday, 11 April 2014 08:38:38 UTC-5, Louis Amon wrote:
>
> I'm trying to migrate from another framework to web2py but can't make any 
> of the previous user accounts work : passwords don't match even tho I have 
> the correct salt and algorithm.
>
> After much research, I think the issue is in the way web2py stores 
> passwords : 'alg$salt$pwd'
>
>
> My salt uses the character '$' so I guess the regex goes wrong because of 
> that.
>
> It's a big issue for me because not being able to seamlessly plug to my 
> database means I'd have to ask all my users to enter a new password.
>
>
> Any solution/advice ?
>

-- 
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] Illegal character in encryption salt

2014-04-13 Thread Jonathan Lundell
On 11 Apr 2014, at 6:38 AM, Louis Amon  wrote:
> I'm trying to migrate from another framework to web2py but can't make any of 
> the previous user accounts work : passwords don't match even tho I have the 
> correct salt and algorithm.
> 
> After much research, I think the issue is in the way web2py stores passwords 
> : 'alg$salt$pwd'
> 
> 
> My salt uses the character '$' so I guess the regex goes wrong because of 
> that.
> 
> It's a big issue for me because not being able to seamlessly plug to my 
> database means I'd have to ask all my users to enter a new password.
> 
> 
> Any solution/advice ?
> 
> 

What's the format of the old hashes?

-- 
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: unique entry or null validation

2014-04-13 Thread Massimo Di Pierro
This will be deprecated as we are moving to Sphinx.

On Friday, 4 June 2010 03:53:18 UTC-5, dlin wrote:
>
> By the way, 
> I found http://127.0.0.1:8000/examples/static/epydoc/index.html also 
> have such document. 
> But, I missed it.  I should click on the left upper corner to choose 
> validator at first to narrow the display results. 
>
>
> On 6月4日, 下午4時15分, dlin  wrote: 
> > Thanks, It works. 
> > 
> > I've searched it onhttp://web2py.com/book/default/section/7/4 
> > 
> > On 6月4日, 下午1時47分, Yarko Tymciurak  wrote: 
> > 
> > 
> > 
> > > On Jun 3, 11:31 pm, dlin  wrote: 
> > 
> > > > There is a field which I want user to enter different answer, or 
> just 
> > > > keep in empty. 
> > 
> > > empty, or unique answer: 
> > 
> > > db.table.answer.requires=IS_NULL_OR( IS_NOT_IN_DB( db, 
> > > 'table.answer' ) ) 
> > 
> > > > I've tried by: 
> > 
> > > > db.table.field.requires=IS_NOT_IN_DB(db, 'table.field') 
> > 
> > > > But, it will failed, if the second empty field entered. 
> > 
> > > > How could I do the validation for this case? 
> > > > Is there any 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Can't edit default.py after upgrade to 2.8.2

2014-04-13 Thread Massimo Di Pierro
Can you submit a patch to the scripts/setup-web2py-* scripts?


On Thursday, 10 April 2014 00:26:14 UTC-5, Michael Sounhein wrote:
>
> Apparently there was a fix discovered here.
> https://www.mail-archive.com/web2py@googlegroups.com/msg129910.html
>
> append the following line to /etc/apache2/apache2.conf
>
> Header always append X-Frame-Options SAMEORIGIN
>
>
> On Thursday, December 19, 2013 5:14:03 PM UTC-6, Richard Brown wrote:
>>
>> Yes, everything but editing. If I reboot the RPi it works for a while, 
>> then stops. It seems to me like it is a timing or timeout problem. 
>> Everything takes noticeably longer since the upgrade, including my 
>> application site which takes >15 seconds  to load even over my local 
>> network. perhaps that is why it has a 'Cancelled' message in the Java 
>> console's Network tab; because it timed out?
>>
>

-- 
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] great news: Sphinx Documentation

2014-04-13 Thread Massimo Di Pierro
Great news! We are finally moving to Sphinx.

http://web2py.readthedocs.org/en/latest/

Kudos to Simone (niphlod) who single handedly ported all the docstrings and 
made this possible.

Thank you Simone!

 

-- 
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 startup and shutdown of server to call function that starts and stops ROS

2014-04-13 Thread Jacoby Larson
I am running a web application that connects to ROS and streams images and 
data from rostopics.  To send and receive ROS data in python with rospy, 
you need to call the init_node() function  (e.g. rospy.init_node('web2py', 
anonymous=True, disable_signals=True) ). This function basically hangs and 
doesn't release, so I create another thread that calls this function so 
that I can send and receive ROS messages in my web2py application, and it 
should only be called once.  The problem is, ROS doesn't provide a check to 
see if I have already called the init_node function.  So the question is 
where to put the initial call to init_node and not call it again during the 
time the server is running.  I would set it up as a session variable, but 
the session can end even if the server is still running and a new session 
would try to call it again.  I could put it in the database, but then it 
would be persistent even after I shut down the server and restarted.  I am 
looking for an init function that gets called when the server starts.  It 
is also good practice to shutdown ROS when I close the server, so I am also 
looking for a shutdown function.  


-- 
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 when implementing search_widget for SQLFORM.smartgrid

2014-04-13 Thread Seth J
Hello again,

I apologize for potentially naive question as I am new to web2py.  I am 
trying to implement a custom search_widget on SQLFORM.smartgrid and ran 
into an error.

My table is defined in db.py as such:

## We prepend f_ to fieldnames for disambiguity
db._common_fields.append(auth.signature)  ## adds signature fields to all 
tables

db.define_table('work_log',
Field('f_jacket_no', type='string',
  label=T('Jacket Number')),
Field('f_job_title_format_no', type='string',
  label=T('Job Title & Format Number')),
Field('f_assoc_no', type='string',
  label=T('Associated Information')),
Field('f_status_destination', type='string',
  label=T('Status & Destination')),
Field('f_probe', type='boolean',
  label=T('Peps')),
Field('created_on', type='date', default=request.now,
  label=T('Date Out')),
format='%(f_job_title_format_no)s',
migrate=settings.migrate)

db.work_log._plural = T('Work Log')
db.work_log._singular = T('Work Entry')
db.work_log.f_jacket_no.requires = IS_MATCH('\d{3}-\d{3}', strict=True, 
error_message='Please use 000-000 format for Jacket No. (including leading 
0)')
db.work_log.f_job_title_format_no.requires = requires=IS_IN_SET(['Public 
Law: 6580', 'W&M Hearing: 5011', 'VA Hearing: 5011', 'State Disburse: 
9334', 'Leg Calendar: 7800', 'Leg Branch Appro: 3700', 'Final Calendar: 
7800', '112th Congress: 7800', 'CFR: 8091 (Indicate title & vol. num. at 
Assoc. Info.)', 'Other (Indicate at Assoc. Info.)'])
db.work_log.f_status_destination.requires = requires=IS_IN_SET(['1st Try: 
PR', 'OK to Print: TE', 'CX\'s: PR', 'AA\'s: PR', 'Converted: TP'])
db.work_log.created_on.represent = lambda value, x: 
value.strftime('%m/%d/%Y')
db.work_log.created_on.writable = False

## after defining tables, uncomment below to enable auditing
auth.enable_record_versioning(db)

In a default.py controller I have among other standard things these two 
functions of interest  I followed example from this topic 
(https://groups.google.com/forum/#!topic/web2py/tku5zkVZfZc) :

def contactSearch(self):
# Build a simple form
userId = auth.user_id

form = FORM('',
LABEL('Name:', _for='asset_name'),
INPUT(_name='asset_name',_value=userId, _id='web2py_asset_name'),
INPUT(_type='submit',_value=T('Search')),
INPUT(_type='submit',_value=T('Clear'), 
_onclick="jQuery('#asset_name').val('');"), _method="GET",_action='self', 
_id='contactSearch')
return form


@auth.requires_login()
def work_log_manage():
is_owner = (lambda row: row.created_by == auth.user_id) if auth.user 
else False
db.work_log.id.readable=False # Since we do not want to expose the id 
field on the grid
db.work_log.created_by.readable=True # Show owner of record
db.work_log_archive.id.readable=False # Since we do not want to expose 
the id field on the grid
links = [lambda row: A('View 
Post',_href=URL("default","work_log_archive.current_record",args=[row.id]))]
orderby = ['created_on']

searchForms = dict(work_log=contactSearch, work_log_archive=None)

grid = SQLFORM.smartgrid(db.work_log, linked_tables = 
['work_log_archive'], editable= dict(work_log=is_owner, 
work_log_archive=False), deletable= dict(work_log=is_owner, 
work_log_archive=False), user_signature=True, details=False, 
search_widget=searchForms, showbuttontext=True, links_in_grid=False, 
links=links, paginate=30, 
maxtextlengths={'work_log.f_job_title_format_no':60}, orderby=orderby)
return dict(grid=grid)

I know contactSearch doesn't do much.  At the moment I am simply trying to 
display a widget.  I get the following error when accessing a page:

Version
> web2py™ Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
> Python Python 2.7.3: /usr/bin/python (prefix: /usr)
> Traceback
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 220, in restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/worklog/controllers/default.py", 
> line 104, in 
> File "/home/www-data/web2py/gluon/globals.py", line 385, in 
> self._caller = lambda f: f()
> File "/home/www-data/web2py/gluon/tools.py", line 3287, in f
> return action(*a, **b)
> File "/home/www-data/web2py/applications/worklog/controllers/default.py", 
> line 101, in work_log_manage
> grid = SQLFORM.smartgrid(db.work_log, linked_tables = 
> ['work_log_archive'], editable= dict(work_log=is_owner, 
> work_log_archive=False), deletable= dict(work_log=is_owner, 
> work_log_archive=False), user_signature=True, details=False, 
> search_widget=searchForms, showbuttontext=True, links_in_grid=False, 
> links=links, paginate=30, 
> maxtextlengths={'work_log.f_job_title_format_no':60}, orderby=orderby)
> File "/home/www-data/web2py/gluon/sqlhtml.py"

Re: [web2py] Re: unique entry or null validation

2014-04-13 Thread Claudio Cocciarelli

>
>
>>
> If you want the items in field1 to be uinique then you cannot allow update 
> to put a duplicate value in there.
>
> If you get that message, find the duplicate value in the database and do 
> something about that.
>
> Regards
> Johann
>
>  
As I mentioned, it's difficult to explain :)

I don't want to create a duplicate using update(), what I meant is that 
message comes even though that field1 is still unique, I'm updating field2 
after all.
For now I managed to workaround the issue by a simple check in the 
controller:

if request.method =="update":
  field1.requires = None
else:
  field1.requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'table.field1'))

I just hope it doesn't cause some nasty side effects.

Claudio

-- 
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] Illegal character in encryption salt

2014-04-13 Thread Louis Amon
I'm trying to migrate from another framework to web2py but can't make any 
of the previous user accounts work : passwords don't match even tho I have 
the correct salt and algorithm.

After much research, I think the issue is in the way web2py stores 
passwords : 'alg$salt$pwd'


My salt uses the character '$' so I guess the regex goes wrong because of 
that.

It's a big issue for me because not being able to seamlessly plug to my 
database means I'd have to ask all my users to enter a new password.


Any solution/advice ?

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


[web2py] How to load processed values in same page as form exists ?

2014-04-13 Thread Ramesh Aj


I have created a form that takes server ip, username and password. I use 
pexpect to ssh into remote server, run a particular command and get basic 
data related to that server. I am creating the form using controller and 
also doing ssh in same controller and returning both form and processed 
data from same controller. But, when I run the html it is not displaying 
correct result, I am also confused on how I can load a table below add 
button inside a same page but as different frame.

My Controller script as below:

# coding: utf8# try something likedef display():
import pexpect
import sys
import time
import cgi, cgitb
import getpass
import urllib3
import xml.etree.ElementTree as ET
import json

attr = ["Hostname", "Model Name", "Version", "connected count", "online 
Count"]

form=FORM(DIV('server IP', INPUT(_name = 'ipaddr', requires = 
IS_NOT_EMPTY()),
  'Username', INPUT(_name = 'uname', requires = 
IS_NOT_EMPTY()), 
  'Password',INPUT(_name = 'password', _type = 'password', 
requires = IS_NOT_EMPTY()),
  INPUT(_value='Add',_type='submit')))
valuelist = list()
if form.accepts(request,session):
response.flash = 'form accepted'
ssh_cmd = 'ssh'
username = request.vars['uname'].strip()
ip_addr = request.vars['ipaddr'].strip()
password = request.vars['password'].strip()
command = ssh_cmd+" "+username+"@"+ip_addr
try:
child = pexpect.spawn(command)
child.expect('(?i)password')
child.sendline(password)
child.expect('bash2.1# ')
child.sendline('show sys-summary general')
child.expect('bash2.1# ')
except Exception, e:
print e
print child.before
lines = child.before
for line in lines.split("\n"):
if any(word in line for word in attr):
keyValue = line.split(":", 1)
value = keyValue[1].strip()
valuelist.append(value)
sys.stdout.flush()
if child.isalive():
child.sendline('exit') # Try to ask ftp child to exit.
child.close()
if child.isalive():
print('Child did not exit gracefully.')
else:
print('Child exited gracefully.')

elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form, valuelist=valuelist)

Now my html code is as below. It is just simple and I want to test whether 
that particular values has been received accordingly or not, hence I am 
just calling returned value

View code is:

{{extend 'layout.html'}}Controller Page{{=form}}Submitted 
variables{{=valuelist}}Accepted 
variables{{=BEAUTIFY(form.vars)}}Errors in 
form{{=BEAUTIFY(form.errors)}}

Could some one suggest, what change I can make so that I can see details of 
server below add button itself ? Like

Server IP: Username: Password: add

222.222.222.222 examplehostname 333modelno 3.2 44 connected 22 online

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: Install in hostgator

2014-04-13 Thread RTBS
Hey Criss,

Great testimonial and I would love to use hostgator.  However, I would also 
like to use web2py.  Currently, a complete tutorial does not exist to make 
these two work together.  It seems some people have been able to get this 
to work, unfortunately, I am not one of them.  

The django tutorial on the hostgator web page works great and only took 
about 10 min. to get working. 
 https://support.hostgator.com/articles/django-with-fastcgi

I am looking for something similar for web2py.  I really hate to tie up 
their support team on an issue that they shouldn't be supporting.  I'm 
surprised that no one has written a white-paper how-to on this one.  Maybe 
I'm missing something so simple that no one has bothered to mention it.

Thanks again, you have solidified my resolve to make this work (or at least 
ask their support team again).


On Wednesday, April 9, 2014 10:43:10 AM UTC-7, criss shirley wrote:
>
> Hey Everyone
>
> I saw many of peoples asking about the best web hosting with best resultat 
> so
>
>  i‘m here to giving and sharing you my experience :
>
> I have been with Hostgator for over 4 years now having moved from many 
> different hosts before finding the right one, Hostgator. I have never had 
> such a fantastic service from any company anywhere! Hostgator are simply 
> the best you will find, the customer service is amazing, 24/7 and they help 
> with all kinds of advice, even when it isnt server related. They have techs 
> working for them that actually care for the customers and this has been 
> proven time and time again when I had issues with scripts, even though it 
> wasnt up to Hostgator to fix these issues, they gave me great advice to get 
> the scripts working. I have a dedicated pro server, fully managed and a 
> level 4 VPS, both are perfect for my entire business and I have a lot of 
> sites! 
>
> Anyway, Hostgator are simply the best hosting company out there and that 
> is the reason why they are so popular, if you are searching for a hosting 
> company, you dont need to, just go to Hostgator!
>
> If you are looking to host your website, my strongest advise is to go with 
> Hostgator and you will never regret doing so…
>
> With hostgator 1 cent coupon, you can get hostgator hosting in just 1 cent 
> for first month.
>
>  You can use following coupons to get discount: 
>
> $0.01 First Month, Coupon Code -> markdownhost
>
> To sign up in hostgator here : http://goo.gl/3cVZNd
>
>
> Le samedi 14 mai 2011 05:21:13 UTC+1, José Eloy a écrit :
>>
>> Hello! 
>>
>> Recently a customer bought a hosting plan (business) with hostgator. 
>> I'm developing for him a web2py application, I have doubts of how to 
>> deploy it. Somebody can help me? The application runs well in 
>> localhost (ubuntu). 
>>
>> Thanks in advance 
>>
>>

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


[web2py] Web2Py vs Django - powered sites.

2014-04-13 Thread digirew


Hello Everyone,


I am in the process of evaluating Web2py and Django frameworks for our 
application. So far I like what I see with Web2py.  I will need to build a 
business case for one vs the other.


Few initial questions if you have some input:


1.  is there any large enterprise sites/users using the Web2py framework? I 
took a look at the web2py powered by sites at http://web2py.com/poweredby. 
The examples shown are not very convincing/encouraging.


Compared with Django, the site lists many large enterprise players…Disqus, 
Instagram, Mozilla, OpenStack, Pinterest etc.




2.  I read a lot on the internet that you should choose a framework that 
suits your applications requirements.


Q: Why would one choose Web2py over Django? or are these two frameworks so 
similar that it boils down to coding preference / feature sets etc?



Thanks in advance for your input



-- 
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: Can't edit default.py after upgrade to 2.8.2

2014-04-13 Thread Michael Sounhein
Apparently there was a fix discovered here.
https://www.mail-archive.com/web2py@googlegroups.com/msg129910.html

append the following line to /etc/apache2/apache2.conf

Header always append X-Frame-Options SAMEORIGIN


On Thursday, December 19, 2013 5:14:03 PM UTC-6, Richard Brown wrote:
>
> Yes, everything but editing. If I reboot the RPi it works for a while, 
> then stops. It seems to me like it is a timing or timeout problem. 
> Everything takes noticeably longer since the upgrade, including my 
> application site which takes >15 seconds  to load even over my local 
> network. perhaps that is why it has a 'Cancelled' message in the Java 
> console's Network tab; because it timed out?
>

-- 
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] Networkx draw graph

2014-04-13 Thread Luis Fontes
I am trying to plot a graph using NetworkX draw function but 
using cStringIO.StringIO(). I have read
how to do it in web2py Application Development Cookbook.

Let's say I have something like:

import matplotlib.pyplot as plt
import networkx as nx

G = nx.path_graph(8)
nx.draw(G)
plt.show()

This code plots and shows the graph. Now, to place it in a web2py view I 
should use a function like:


def mygraph()
fig=Figure()

.
.
.

canvas=FigureCanvas(fig)
stream=cStringIO.StringIO()
canvas.print_png(stream)
return stream.getvalue()

The problem is how to place the plot generated by nx.path_graph(8) and 
nx.draw(G) in the code in
blue in order to make it work.

I am learning web2py and I am nor expert in NetworkX or matplotlib 
packages. Sorry if my question
is stupid.

Thank you.

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


[web2py] form help

2014-04-13 Thread Cristian Re
Hello to all,

assuming I have in db.py these tables:

db.define_table('items', 
Field('item', requires=IS_NOT_EMPTY()),
format='%(item)s'
)

db.define_table('types',
Field('type_name', requires=IS_NOT_EMPTY()),
format='%(type)s'
)

db.define_table('item_type',
Field('item_id', 'reference items'),
Field('types_id', 'reference types')
)

I have for example 50 items and 3 types and I would like to associate into 
table item_type any item to a type.
In my mind there is a page with a table with all the items; on the left 
there is the neme of the item and on the right a select list with all the 
types.

what is the right way to do this with web2py?

in my controller I tried with:

def item_type():
items =  db().select(db.items.ALL)
types =  db().select(db.type.ALL)
return dict(items=items, types=types)

and into a view:




{{for en, item in enumerate(items):}}


{{=item.item}}



-
{{for type in types:}}
{{=type.type_name}}
{{pass}}



{{pass}}





It's the right way or I can do something better?

thanks in advance


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


[web2py] Database compute fields

2014-04-13 Thread horridohobbyist
I have the following table:

db.define_table('cart',
Field('quantity','integer'),
Field('in_stock','integer',writable=False,represent=lambda 
v, r: 'Pre-ordered' if v < 0 else '√'),
Field('price','float',writable=False,represent=lambda v, r: 
'C'+locale.currency(v,grouping=True)),
Field('subtotal','float',represent=lambda v, r: 
'C'+locale.currency(v,grouping=True),
compute=lambda r: r.price*r.quantity))

I find that when I update the 'quantity' field, the 'subtotal' field does 
NOT get recomputed. Is this a bug, or expected behaviour?

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: Why does appadmin have css overflow: hidden in database results?

2014-04-13 Thread User
Sorry you're right it's auto not hidden that was a typo.  But why not make 
it visible?

On Sunday, April 13, 2014 5:37:53 AM UTC-4, Paolo Caruccio wrote:
>
> If you mean the view "*appadmin/select/db?query=your query"* actually the 
> table with the resulting rows is wrapped in a div with "overflow:auto".
> Therefore if you have more columns than the width of the browser a 
> horizontal scrollbar will be shown and the table will scroll horizontally. 
> The horizontal scrollbar (that is managed by browser not by web2py) is 
> positioned after the last displayed row but you can scroll the table with 
> arrow keys on the keyboard.
> For the sake of completeness, if the div wrapper had "overflow:hidden" 
> you couldn't see any scrollbar.
> 
>
> Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto:
>>
>> In appadmin, if I query a table that has more columns than the width of 
>> my browser there will be a horizontal scrollbar places on the div 
>> containing the database rows.  I find this annoying because in order to 
>> scroll horizontally I have to go to the bottom of the search results first 
>> to find the horizontal scrollbar and then scroll.
>>
>> If the containing div had overflow: visible then I could use the 
>> browser's horizontal scrollbar which is much more convenient.  My question 
>> is what purpose does having overflow = hidden serve in this context?
>>
>

-- 
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: Why does appadmin have css overflow: hidden in database results?

2014-04-13 Thread Paolo Caruccio
If you mean the view "*appadmin/select/db?query=your query"* actually the 
table with the resulting rows is wrapped in a div with "overflow:auto".
Therefore if you have more columns than the width of the browser a 
horizontal scrollbar will be shown and the table will scroll horizontally. 
The horizontal scrollbar (that is managed by browser not by web2py) is 
positioned after the last displayed row but you can scroll the table with 
arrow keys on the keyboard.
For the sake of completeness, if the div wrapper had "overflow:hidden" you 
couldn't see any scrollbar.


Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto:
>
> In appadmin, if I query a table that has more columns than the width of my 
> browser there will be a horizontal scrollbar places on the div containing 
> the database rows.  I find this annoying because in order to scroll 
> horizontally I have to go to the bottom of the search results first to find 
> the horizontal scrollbar and then scroll.
>
> If the containing div had overflow: visible then I could use the browser's 
> horizontal scrollbar which is much more convenient.  My question is what 
> purpose does having overflow = hidden serve in this context?
>

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