Re: [web2py] Re: Memory problems on Webfaction

2012-07-05 Thread Johann Spies
On 3 July 2012 18:01, Alec Taylor  wrote:

> Any ideas on how I should proceed?
>
> (Nothing is running on that port number)
>
> Thanks for all suggestions,
>
>
If I remember correctly the support people from Webfaction helped me to
identify the correct port number after my first effort ended similarly.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] auth exception with Version 2.0.0 (2012-07-04 23:30:47) dev

2012-07-05 Thread szimszon
Hi!

I'm using ldap auth and after the web2py update I get:

Traceback (most recent call last):
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/restricted.py", 
line 205, in restricted
exec ccode in environment
  File 
"/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/applications/webadmin/controllers/default.py",
 line 2072, in 
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/globals.py", 
line 182, in 
self._caller = lambda f: f()
  File 
"/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/applications/webadmin/controllers/default.py",
 line 2051, in user
return dict( form = auth() )
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/tools.py", line 
1197, in __call__
return getattr(self,args[0])()
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/tools.py", line 
1832, in login
if temp_user.registration_key == 'pending':
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
6156, in __getattr__
return self[key]
  File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
6147, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'registration_key'



http://code.google.com/p/web2py/issues/detail?id=876


Re: [web2py] sqlform.grid properties

2012-07-05 Thread Johann Spies
On 4 July 2012 16:22, Ovidio Marinho  wrote:

> I'm need Translate Bottom submit in SQLFORM.grid, Nao estou achando esta
> propriedade.


Somebody else on this list helped me and I used this code to change the
text in that submit button:

 form.element('.web2py_table input[type=submit]')['_value'] = T('Delete
selected articles')

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Re: Invalid circual reference

2012-07-05 Thread François Delpierre
I'll have a look to build the steps to reproduce the problem, however I 
wonder if the problem could not occur when I change the name (and type) of 
the first field of a table, that is 'name' by default.

[web2py] Re: {{=LOAD()}} and JavaScript function

2012-07-05 Thread Annet
Hi Anthony,

Thanks for providing me with this solution. I used it in the timetable 
function as follows:

In the function: tab='tab-' + str(weekday)

In the view:


  {{for i in xrange(1,8):}}
{{this_tab = 'tab-%s' % i}}

  {{if tab==this_tab:}}

{{=LOAD('calendar','daytimes.load',args=i,ajax=True,target=this_tab)}}
  {{pass}}
 
  {{pass}}
 


$(document).ready(function(){
  $('a[href=#{{=tab}}]').tab('show');
});


In this case determining this:

{{if tab==this_tab:}}
  {{=LOAD('calendar','daytimes.load',args=i,ajax=True,target=this_tab)}}
{{pass}}

... because the tab variable provides me with the tab that should be loaded 
the first time the page displays. However, in the case your trying to help 
me solve, I don't know which one is the tab that should be loaded the first 
time the page displays, all I know is that it's the first tab. What I am 
looking for is something to do the following:

tab='tab-' + the minimum value of i


Kind regards,

Annet


[web2py] html5 background video script

2012-07-05 Thread lucas
hello one and all,

i am good with server-side processing.  very new to client-side java script 
stuff.  i think this idea requires that; please give me your best advice.

client loads a page that contains html5 video.  user hits play on one of 
the videos on the page and is watching it.  what is the best approach to 
writing a client-side script, java script, ajax, etc., that will report the 
ending time of the video watch by the user if the video played either to 
the end, was paused, or stopped by the user?  you can see i want data on 
the server for how long the user is watching the video so that that data 
can be analyzed and such information sent back to the video producer for 
feedback and such.

i am guessing the video player buttons would have to trigger their onclick 
events of the pause/stop buttons to run the client-side script, also the 
onend/oncompletion of the video, in which the script will then grab the 
final video time and report that back to the server through some 
predesigned communication data protocol exchange.  that is all i can guess 
at this point.  please help me write such a script and give direction.

thank you in advance and have a great week.  lucas


[web2py] When does translation take place.

2012-07-05 Thread Annet
Some of my menus are generated using tables containing fields being True of 
False. The problem is that the table fields are in English and the menu 
items should be translated. I wonder whether translation happens before any 
comparisons being made in a view or after.

So, if I have T('Timetable) which I translate to Lesrooster, will I be able 
to compare it to a field called 'Timetable' in a view or has Timetable been 
translated to Lesrooster before.


Kind regards,

Annet



[web2py] Re: Homemade Task Queues

2012-07-05 Thread mehta
Hi,

Here when i run the above command , it says 'application could not be 
found'. But, i double checked , that folder is there and also it appears 
when I run the admin interface. Are there any naming conventions that for 
which I have to take care about?

Thanks,
Harsh Mehta

On Saturday, 30 June 2012 19:56:25 UTC+5:30, Massimo Di Pierro wrote:
>
> Source distribution:
>
> From the main web2py folder
> python web2py.py -S app -M -N -R path/to/myscript.py -A a b c
>
> Binary distribution (windows):
>
> web2py.exe -S app -M -N -R path/to/myscript.py -A a b c
>
> myscript.py can be anywhere as long as path/to is its absolute path or 
> relative path from the place where you are.
>
>
>
>
> On Saturday, 30 June 2012 03:21:38 UTC-5, mehta wrote:
>>
>> Hi Group,
>>
>> Homemade Task Queues specifies that we make a .py file and run the following 
>> command.
>>
>> python web2py.py -S app -M -N -R applications/app/private/myscript.py -A a b 
>> c
>>
>> I am new to web2py and I don't know where the .py file shoul be located and 
>> where and how should I write the above command.
>>
>> Thanks
>>
>> Harsh Mehta
>>
>>
>>

Re: [web2py] When does translation take place.

2012-07-05 Thread Jason Brower
Don't know all the details.  But it's best to leave logical things 
outside of the translations. Otherwise you end up destroying your app 
when someone does the translation change.
The translations can happen anywhere.  They are executed as soon as you 
run them.

So T('test') = test it is a string.
BR,
Jason

On 07/05/2012 12:23 PM, Annet wrote:
Some of my menus are generated using tables containing fields being 
True of False. The problem is that the table fields are in English and 
the menu items should be translated. I wonder whether translation 
happens before any comparisons being made in a view or after.


So, if I have T('Timetable) which I translate to Lesrooster, will I be 
able to compare it to a field called 'Timetable' in a view or has 
Timetable been translated to Lesrooster before.



Kind regards,

Annet






Re: [web2py] html5 background video script

2012-07-05 Thread Jason Brower
There are usually javascript plugins that you can have handle any 
function you like when the video ends...

Never used this but a quick google lead me to here...
http://jplayer.org/latest/developer-guide/#jPlayer-events
Notice it has event handling for when the video has ended.
BR,
Jason

On 07/05/2012 12:12 PM, lucas wrote:

hello one and all,

i am good with server-side processing.  very new to client-side java 
script stuff.  i think this idea requires that; please give me your 
best advice.


client loads a page that contains html5 video.  user hits play on one 
of the videos on the page and is watching it.  what is the best 
approach to writing a client-side script, java script, ajax, etc., 
that will report the ending time of the video watch by the user if the 
video played either to the end, was paused, or stopped by the user? 
 you can see i want data on the server for how long the user is 
watching the video so that that data can be analyzed and such 
information sent back to the video producer for feedback and such.


i am guessing the video player buttons would have to trigger their 
onclick events of the pause/stop buttons to run the client-side 
script, also the onend/oncompletion of the video, in which the script 
will then grab the final video time and report that back to the server 
through some predesigned communication data protocol exchange.  that 
is all i can guess at this point.  please help me write such a script 
and give direction.


thank you in advance and have a great week.  lucas





[web2py] language selector in layout.html

2012-07-05 Thread Fernando J
How is set a language selector in layout.html in order to any user may 
select any language during his session?

Thanks in advance

Fernando J.


[web2py] Re: language selector in layout.html

2012-07-05 Thread Anthony
You could add a dropdown for language selection and when the user makes a 
selection, store the value in the session. Then use T.force('[language 
code]') in a model file to force translations to the particular language. 
If you want the selection to be remembered across sessions, you could set a 
cookie on the user's machine (or if most of the site is behind a login, you 
could instead store the user's preferred language as part of their profile).

Anthony

On Thursday, July 5, 2012 7:01:55 AM UTC-4, Fernando J wrote:
>
> How is set a language selector in layout.html in order to any user may 
> select any language during his session?
>
> Thanks in advance
>
> Fernando J.
>


[web2py] Dict object has no attribute 'rstrip'

2012-07-05 Thread adohertyd
Me again! I don't know why I am getting this error. The process() function 
takes in a value session.term, processes it, and returns it as a dict type 
so that it can be mapped to URL's in the next function. The results() 
function sends the variable 'term' to 3 different API URL's which all 
should return some json results. The entireweb and blekko results come back 
fine if I leave out the bing call; however, the bing results cause the 
error 'Dict object has no attribute rstrip'. The problem has to be in the 
way I'm calling the Bing API. Would really appreciate some guidance here. 
Thanks! This is my default.py controller

def index():
form = FORM('',
INPUT(_name='query', requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
if form.process().accepted:
session.term=request.vars.query
redirect(URL('results'))
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form)

def __process():
import urllib
term=session.term
#do some processing on term
return dict(term=term)
   
def results():
import urllib
import requests #This is an external library in the site-packages folder

blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=f4c8acf3" %__process
()
blekkoresults = urllib.urlopen(blekko).read()

entireweb = 
"http://www.entireweb.com/xmlquery?pz=&ip=&n=10&of=0&format=json&q=%(term)s"
 
%__process()
entresults = urllib.urlopen(entireweb).read()

URL = 
"https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json"
API_KEY= 'mykey'
term = __process()
r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY))
bingresults = r.json['d']['results']

return blekkoresults, entresults, bingresults







Re: [web2py] Dict object has no attribute 'rstrip'

2012-07-05 Thread Jonathan Lundell
On 5 Jul 2012, at 6:55 AM, adohertyd wrote:
> Me again! I don't know why I am getting this error. The process() function 
> takes in a value session.term, processes it, and returns it as a dict type so 
> that it can be mapped to URL's in the next function. The results() function 
> sends the variable 'term' to 3 different API URL's which all should return 
> some json results. The entireweb and blekko results come back fine if I leave 
> out the bing call; however, the bing results cause the error 'Dict object has 
> no attribute rstrip'. The problem has to be in the way I'm calling the Bing 
> API. Would really appreciate some guidance here. Thanks! This is my 
> default.py controller

Where is rstrip being called, and on which variable?

One thing: avoid using URL as a variable name. The symbol is globally defined 
in web2py as the URL function you're calling in index(). You might be getting 
away with it here, but best to use another name.

> 
> def index():
> form = FORM('',
> INPUT(_name='query', requires=IS_NOT_EMPTY()),
> INPUT(_type='submit'))
> if form.process().accepted:
> session.term=request.vars.query
> redirect(URL('results'))
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill the form'
> return dict(form=form)
> 
> def __process():
> import urllib
> term=session.term
> #do some processing on term
> return dict(term=term)
>
> def results():
> import urllib
> import requests #This is an external library in the site-packages folder
> 
> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=f4c8acf3" % 
> __process()
> blekkoresults = urllib.urlopen(blekko).read()
> 
> entireweb = 
> "http://www.entireweb.com/xmlquery?pz=&ip=&n=10&of=0&format=json&q=%(term)s"
>  %__process()
> entresults = urllib.urlopen(entireweb).read()
> 
> URL = 
> "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json"
> API_KEY= 'mykey'
> term = __process()
> r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY))
> bingresults = r.json['d']['results']
> 
> return blekkoresults, entresults, bingresults
> 
> 
> 
> 
> 




[web2py] Re: When does translation take place.

2012-07-05 Thread Anthony

>
> So, if I have T('Timetable) which I translate to Lesrooster, will I be 
> able to compare it to a field called 'Timetable' in a view or has Timetable 
> been translated to Lesrooster before.
>

By default, T('Timetable') is a lazyT object, so isn't translated until 
necessary. It will be translated when serialized in the view, and it will 
also be translated when you apply any operators, such as testing for 
equality, concatenation, length, etc. So, T('Timetable') == 'Timetable'will be 
False unless the translation language is English. However, you can 
access the original untranslated message via T('Timetable').m, which will 
always be 'Timetable' (note, that is an internal implementation detail, not 
part of the public API).

Anthony 


Re: [web2py] Dict object has no attribute 'rstrip'

2012-07-05 Thread adohertyd
That's the thing, I don't know where it is being called or why! I haven't 
specified it, so I'm assuming it's coming from this block of code:

 import requests   

bing = "
https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json
"
API_KEY= 'mykey'
term = __process()
r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY))
bingresults = r.json['d']['results']



On Thursday, 5 July 2012 15:12:20 UTC+1, Jonathan Lundell wrote:
>
> On 5 Jul 2012, at 6:55 AM, adohertyd wrote:
>
> Me again! I don't know why I am getting this error. The process() function 
> takes in a value session.term, processes it, and returns it as a dict type 
> so that it can be mapped to URL's in the next function. The results() 
> function sends the variable 'term' to 3 different API URL's which all 
> should return some json results. The entireweb and blekko results come back 
> fine if I leave out the bing call; however, the bing results cause the 
> error 'Dict object has no attribute rstrip'. The problem has to be in the 
> way I'm calling the Bing API. Would really appreciate some guidance here. 
> Thanks! This is my default.py controller
>
>
> Where is rstrip being called, and on which variable?
>
> One thing: avoid using URL as a variable name. The symbol is globally 
> defined in web2py as the URL function you're calling in index(). You might 
> be getting away with it here, but best to use another name.
>
>
> def index():
> form = FORM('',
> INPUT(_name='query', requires=IS_NOT_EMPTY()),
> INPUT(_type='submit'))
> if form.process().accepted:
> session.term=request.vars.query
> redirect(URL('results'))
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill the form'
> return dict(form=form)
> 
> def __process():
> import urllib
> term=session.term
> #do some processing on term
> return dict(term=term)
>
> def results():
> import urllib
> import requests #This is an external library in the site-packages 
> folder
> 
> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=f4c8acf3" 
> %__process
> ()
> blekkoresults = urllib.urlopen(blekko).read()
> 
> entireweb = "
> http://www.entireweb.com/xmlquery?pz=&ip=&n=10&of=0&format=json&q=%(term)s
> " %__process()
> entresults = urllib.urlopen(entireweb).read()
> 
> URL = "
> https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json
> "
> API_KEY= 'mykey'
> term = __process()
> r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY
> ))
> bingresults = r.json['d']['results']
> 
> return blekkoresults, entresults, bingresults
>
>
>
>
>
>
>
>

Re: [web2py] Dict object has no attribute 'rstrip'

2012-07-05 Thread Jonathan Lundell
On 5 Jul 2012, at 7:19 AM, adohertyd wrote:
> That's the thing, I don't know where it is being called or why! I haven't 
> specified it, so I'm assuming it's coming from this block of code:
> 
>>  import requests   
>> bing = 
>> "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json"
>> API_KEY= 'mykey'
>> term = __process()
>> r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY))
>> bingresults = r.json['d']['results']
> 

Don't you mean something like term = __process().get('term')?

[web2py] Alternative to Janrain: in pure Python

2012-07-05 Thread Alec Taylor
A rather good 64-line OAuth 2 client implementation for Python has been 
open-sourced.

Source-code  
(announcement
)

This has been tested—and includes example code—with:

   - Facebook
   - Google
   - Foursquare

https://github.com/demianbrecht/sanction/blob/master/example/server.py

Please share your thoughts below, specify if you would like how to use it 
with web2py, e.g.: for the online web2py book. [Disclaimer: haven't spoken 
with Massimo yet]

Thanks,

Alec Taylor


[web2py] Re: Dict object has no attribute 'rstrip'

2012-07-05 Thread adohertyd
No that's not it either Jonathan. The problem I think is with the {'term' : 
urllib.quote(term)}. I think that because 'term' is a dict type, the 
urllib.quote is having issues with it.

On Thursday, 5 July 2012 14:55:06 UTC+1, adohertyd wrote:
>
> Me again! I don't know why I am getting this error. The process() function 
> takes in a value session.term, processes it, and returns it as a dict type 
> so that it can be mapped to URL's in the next function. The results() 
> function sends the variable 'term' to 3 different API URL's which all 
> should return some json results. The entireweb and blekko results come back 
> fine if I leave out the bing call; however, the bing results cause the 
> error 'Dict object has no attribute rstrip'. The problem has to be in the 
> way I'm calling the Bing API. Would really appreciate some guidance here. 
> Thanks! This is my default.py controller
>
> def index():
> form = FORM('',
> INPUT(_name='query', requires=IS_NOT_EMPTY()),
> INPUT(_type='submit'))
> if form.process().accepted:
> session.term=request.vars.query
> redirect(URL('results'))
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill the form'
> return dict(form=form)
> 
> def __process():
> import urllib
> term=session.term
> #do some processing on term
> return dict(term=term)
>
> def results():
> import urllib
> import requests #This is an external library in the site-packages 
> folder
> 
> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=f4c8acf3" 
> %__process
> ()
> blekkoresults = urllib.urlopen(blekko).read()
> 
> entireweb = "http://www.entireweb.com/xmlquery?pz=
> &ip=&n=10&of=0&format=json&q=%(term)s" %__process()
> entresults = urllib.urlopen(entireweb).read()
> 
> URL = "
> https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json
> "
> API_KEY= 'mykey'
> term = __process()
> r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY
> ))
> bingresults = r.json['d']['results']
> 
> return blekkoresults, entresults, bingresults
>
>
>
>
>
>

Re: [web2py] Re: Dict object has no attribute 'rstrip'

2012-07-05 Thread Jonathan Lundell
On 5 Jul 2012, at 7:47 AM, adohertyd wrote:
> No that's not it either Jonathan. The problem I think is with the {'term' : 
> urllib.quote(term)}. I think that because 'term' is a dict type, the 
> urllib.quote is having issues with it.

That's what I mean. In the case of blekko and entireweb, you're using 
(implicitly) term = __process()['term'], but for Bing you're doing term = 
__process().

> 
> On Thursday, 5 July 2012 14:55:06 UTC+1, adohertyd wrote:
> Me again! I don't know why I am getting this error. The process() function 
> takes in a value session.term, processes it, and returns it as a dict type so 
> that it can be mapped to URL's in the next function. The results() function 
> sends the variable 'term' to 3 different API URL's which all should return 
> some json results. The entireweb and blekko results come back fine if I leave 
> out the bing call; however, the bing results cause the error 'Dict object has 
> no attribute rstrip'. The problem has to be in the way I'm calling the Bing 
> API. Would really appreciate some guidance here. Thanks! This is my 
> default.py controller
> 
> def index():
> form = FORM('',
> INPUT(_name='query', requires=IS_NOT_EMPTY()),
> INPUT(_type='submit'))
> if form.process().accepted:
> session.term=request.vars.query
> redirect(URL('results'))
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill the form'
> return dict(form=form)
> 
> def __process():
> import urllib
> term=session.term
> #do some processing on term
> return dict(term=term)
>
> def results():
> import urllib
> import requests #This is an external library in the site-packages folder
> 
> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=f4c8acf3" % 
> __process()
> blekkoresults = urllib.urlopen(blekko).read()
> 
> entireweb = 
> "http://www.entireweb.com/xmlquery?pz=&ip=&n=10&of=0&format=json&q=%(term)s"
>  %__process()
> entresults = urllib.urlopen(entireweb).read()
> 
> URL = 
> "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json"
> API_KEY= 'mykey'
> term = __process()
> r = requests.get(URL % {'term': urllib.quote(term)}, auth=('', API_KEY))
> bingresults = r.json['d']['results']
> 
> return blekkoresults, entresults, bingresults
> 
> 
> 
> 
> 




Re: [web2py] Re: Minimum memory requirements?

2012-07-05 Thread Alec Taylor
On Wed, Jul 4, 2012 at 2:27 AM, Vasile Ermicioi  wrote:
> 1)
> go to https://my.webfaction.com/applications and create an application,
> uwsgi for e.g.
> App category: custom
> App type: custom  app (listening on a port)
> and once done you will see the port near app name (it is a number)
>
> 2) connect via ssh and execute those commands, but put instead yourportthere
> the number of port of your app
>
> 3)
> [utils]
> ps -u fermer -o rss,command
>
> this is also a command, and shouldn't be written in uwsgireload.txt
>
> fermer is my username on webfaction, you should put yours instead
> if you execute it, it will show you how much memory is used by your
> processes
>
>
>
> this command shows you how much memory is using your processes

Thanks, but it still doesn't seem to be working. Here is the output of
my ~/tmp/uwsgi.log:

*** Starting uWSGI 1.2.3 (64bit) on [Thu Jul  5 09:53:11 2012] ***
compiled with version: 4.4.6 20110731 (Red Hat 4.4.6-3) on 03 July 2012 09:59:58
detected number of CPU cores: 8
current working directory: /home/myusernamehere
detected binary path: /home/myusernamehere/bin/uwsgi
limiting address space of processes...
your process address space limit is 67108864 bytes (64 MB)
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow
upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 4096
async fd table size: 4096
allocated 24960 bytes (24 KB) for 24 cores per worker.
lock engine: pthread robust mutexes
initializing 24 uGreen threads with stack size of 262144 (256 KB)
mprotect(): Invalid argument [plugins/ugreen/ugreen.c line 109]


On Wed, Jul 4, 2012 at 6:22 AM, Luther Goh Lu Feng  wrote:
> At some point, will it be beneficial to have fabric scripts to setup web2py
> on webhosts?
>
> http://fabfile.org
>

Sure, a fabric script would be helpful :)


[web2py] Online debugger broken?

2012-07-05 Thread MJo
Using latest version 
https://github.com/web2py/web2py/commit/074b3de687ee65c2fc5bf87816d72cfd9fd96a10and
 while accessing 
http://127.0.0.1:8000/admin/debug/interact it gives "invalid view 
(debug/interact.html)". Is it me or just bug? (Never used this online 
debugger)

BR,
-- MJo


[web2py] Re: Web Development Introduction Based On Web2py

2012-07-05 Thread dave
the site is down

Internal Server Error

The server encountered an internal error or misconfiguration and was unable 
to complete your request.

Please contact the server administrator, [no address given] and inform them 
of the time the error occurred, and anything you might have done that may 
have caused the error.

More information about this error may be available in the server error log.
--
Apache/2.2.16 (Debian) Server at killer-web-development.com Port 80


[web2py] MySQL migration fails adding unique

2012-07-05 Thread MichaelF
I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 4, 
22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
(x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
to add `unique=True` the web2py migration fails with this error: `" 'institution_name'"` where institution_name is the 
name of the field in question.

I've recreated the problem using a single-table application in web2py using 
MySQL. Here's the model code:

To start off (field not defined as unique):

... (usual model/db.py boilerplate)
db = DAL('mysql://w2ptest:abcde...@mysql5.server.com:3307/abc_web2py')
...
db.define_table('Institution',
Field('Institution_name', 'string', length=60, 
required=True),
format='%(Institution_name)s')

I go to the appadmin page and everything looks fine. Then, making 
Institution_name unique:

db.define_table('Institution',
Field('Institution_name', 'string', length=60, 
required=True,
   unique=True),
format='%(Institution_name)s')

I then refresh the appadmin page and get a ticket with the error. The error 
line in the traceback is the last line of the modified statement above. 
And, to make things worse, I can go in and undo the `unique=True`, but 
web2py doesn't respond if I refresh the appadmin page...or any page served 
by that web server, even in other applications! The cpu is not 
pinned while in this state. I have to recreate the app and database to 
clear the problem. (Well, I think I have to go that far. Just restarting 
web2py doesn't clear it in the full case, but does clear it in my little 
one-table test case.) I try to stop the server (web2py_no_console.exe), but 
it fails to respond.

Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
but I'd rather not, particularly as then I have to `try` that statement 
because MySQL has no `...IF NOT EXIST...` capability for index creation.

Also, if I start off the model with `unique=True` in the first place, 
everything is fine, and MySQL even shows the unique index as created.


[web2py] MySQL migration fails adding unique=

2012-07-05 Thread MichaelF
I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 4, 
22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
(x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
to add `unique=True` the web2py migration fails with this error: `" 'institution_name'"` where institution_name is the 
name of the field in question.

I've recreated the problem using a single-table application in web2py using 
MySQL. Here's the model code:

To start off (field not defined as unique):

... (usual model/db.py boilerplate)
db = DAL('mysql://w2ptest:abcde...@mysql5.server.com:3307/abc_web2py')
...
db.define_table('Institution',
Field('Institution_name', 'string', length=60, 
required=True),
format='%(Institution_name)s')

I go to the appadmin page and everything looks fine. Then, making 
Institution_name unique:

db.define_table('Institution',
Field('Institution_name', 'string', length=60, 
required=True,
   unique=True),
format='%(Institution_name)s')

I then refresh the appadmin page and get a ticket with the error. The error 
line in the traceback is the last line of the modified statement above. 
And, to make things worse, I can go in and undo the `unique=True`, but 
web2py doesn't respond if I refresh the appadmin page...or any page served 
by that web server, even in other applications! The cpu is not 
pinned while in this state. I have to recreate the app and database to 
clear the problem. (Well, I think I have to go that far. Just restarting 
web2py doesn't clear it in the full case, but does clear it in my little 
one-table test case.) I try to stop the server (web2py_no_console.exe), but 
it fails to respond.

Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
but I'd rather not, particularly as then I have to `try` that statement 
because MySQL has no `...IF NOT EXIST...` capability for index creation.

Also, if I start off the model with `unique=True` in the first place, 
everything is fine, and MySQL even shows the unique index as created.



Re: [web2py] Alternative to Janrain: in pure Python

2012-07-05 Thread Bruno Rocha
Thanks! I need to try it today!

On Thu, Jul 5, 2012 at 11:42 AM, Alec Taylor  wrote:

> A rather good 64-line OAuth 2 client implementation for Python has been
> open-sourced.
>
> Source-code  
> (announcement
> )
>
> This has been tested—and includes example code—with:
>
>- Facebook
>- Google
>- Foursquare
>
> https://github.com/demianbrecht/sanction/blob/master/example/server.py
>
> Please share your thoughts below, specify if you would like how to use it
> with web2py, e.g.: for the online web2py book. [Disclaimer: haven't spoken
> with Massimo yet]
>
> Thanks,
>
> Alec Taylor
>


Re: [web2py] Re: Dict object has no attribute 'rstrip'

2012-07-05 Thread adohertyd
Oh I see now. Ok tried to implement that still no joy. I'm trying a number 
of different things still no luck. It's just a matter of perseverance I 
think!

On Thursday, 5 July 2012 15:49:50 UTC+1, Jonathan Lundell wrote:
>
> On 5 Jul 2012, at 7:47 AM, adohertyd wrote:
>
> No that's not it either Jonathan. The problem I think is with the {'term' 
> : urllib.quote(term)}. I think that because 'term' is a dict type, the 
> urllib.quote is having issues with it.
>
>
> That's what I mean. In the case of blekko and entireweb, you're using 
> (implicitly) term = __process()['term'], but for Bing you're 
> doing term = __process().
>
>
> On Thursday, 5 July 2012 14:55:06 UTC+1, adohertyd wrote:
>>
>> Me again! I don't know why I am getting this error. The process() 
>> function takes in a value session.term, processes it, and returns it as a 
>> dict type so that it can be mapped to URL's in the next function. The 
>> results() function sends the variable 'term' to 3 different API URL's which 
>> all should return some json results. The entireweb and blekko results come 
>> back fine if I leave out the bing call; however, the bing results cause the 
>> error 'Dict object has no attribute rstrip'. The problem has to be in the 
>> way I'm calling the Bing API. Would really appreciate some guidance here. 
>> Thanks! This is my default.py controller
>>
>> def index():
>> form = FORM('',
>> INPUT(_name='query', requires=IS_NOT_EMPTY()),
>> INPUT(_type='submit'))
>> if form.process().accepted:
>> session.term=request.vars.query
>> redirect(URL('results'))
>> elif form.errors:
>> response.flash = 'form has errors'
>> else:
>> response.flash = 'please fill the form'
>> return dict(form=form)
>> 
>> def __process():
>> import urllib
>> term=session.term
>> #do some processing on term
>> return dict(term=term)
>>
>> def results():
>> import urllib
>> import requests #This is an external library in the site-packages 
>> folder
>> 
>> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=f4c8acf3" 
>> %__process
>> ()
>> blekkoresults = urllib.urlopen(blekko).read()
>> 
>> entireweb = "http://www.entireweb.com/xmlquery?pz=
>> &ip=&n=10&of=0&format=json&q=%(term)s" %__process()
>> entresults = urllib.urlopen(entireweb).read()
>> 
>> URL = "
>> https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json
>> "
>> API_KEY= 'mykey'
>> term = __process()
>> r = requests.get(URL % {'term': urllib.quote(term)}, auth=('',API_KEY
>> ))
>> bingresults = r.json['d']['results']
>> 
>> return blekkoresults, entresults, bingresults
>>
>>
>>
>>
>>
>>
>
>

Re: [web2py] Re: Dict object has no attribute 'rstrip'

2012-07-05 Thread Jonathan Lundell
On 5 Jul 2012, at 8:04 AM, adohertyd wrote:
> Oh I see now. Ok tried to implement that still no joy. I'm trying a number of 
> different things still no luck. It's just a matter of perseverance I think!

Show your current code, please. 

> 
> On Thursday, 5 July 2012 15:49:50 UTC+1, Jonathan Lundell wrote:
> On 5 Jul 2012, at 7:47 AM, adohertyd wrote:
>> No that's not it either Jonathan. The problem I think is with the {'term' : 
>> urllib.quote(term)}. I think that because 'term' is a dict type, the 
>> urllib.quote is having issues with it.
> 
> That's what I mean. In the case of blekko and entireweb, you're using 
> (implicitly) term = __process()['term'], but for Bing you're doing term = 
> __process().
> 
>> 
>> On Thursday, 5 July 2012 14:55:06 UTC+1, adohertyd wrote:
>> Me again! I don't know why I am getting this error. The process() function 
>> takes in a value session.term, processes it, and returns it as a dict type 
>> so that it can be mapped to URL's in the next function. The results() 
>> function sends the variable 'term' to 3 different API URL's which all should 
>> return some json results. The entireweb and blekko results come back fine if 
>> I leave out the bing call; however, the bing results cause the error 'Dict 
>> object has no attribute rstrip'. The problem has to be in the way I'm 
>> calling the Bing API. Would really appreciate some guidance here. Thanks! 
>> This is my default.py controller




[web2py] Re: {{=LOAD()}} and JavaScript function

2012-07-05 Thread Anthony

>
> ... because the tab variable provides me with the tab that should be 
> loaded the first time the page displays. However, in the case your trying 
> to help me solve, I don't know which one is the tab that should be loaded 
> the first time the page displays, all I know is that it's the first tab. 
> What I am looking for is something to do the following:
>
> tab='tab-' + the minimum value of i


I believe that's what my code does. This line:

{{show_tab = this_tab if not show_tab else show_tab}}

sets the value of show_tab to the first tab (if any) that gets written to 
the view. Is that not what you want?

Anthony


Re: [web2py] Re: Working with custom form

2012-07-05 Thread Kenny Chung
When I used customform for login, it won't give me any errors to be shown
whenever the password was invalid or email is not existing. I put it on
jquery mobile website. Any idea?
On Jul 4, 2012 4:25 PM, "Anthony"  wrote:

> If you refuse to use web2py's css and js files, remember that
>> response.flash and session.flash wont work
>>
>
> Well, the flash message won't *display*, but it's easy to add some very
> minimal JS code to get it to display.
>
>
>> and also your validators also wont work. so you would have to handle form
>> validation yourself.
>>
>
> The validators will work fine without web2py's CSS and JS files. However,
> when displaying form errors, you won't get the nice slidedown effect
> without the JS (i.e., the errors will simply appear when the page is
> initially rendered rather than sliding down after page render).
>
> Anthony
>


Re: [web2py] Re: Minimum memory requirements?

2012-07-05 Thread Alec Taylor
Alright, fixed that last error, now it's just web2py (not uWSGI)
giving me trouble:

*** Operational MODE: async ***
added /home/myusername/web2py/ to pythonpath.
Traceback (most recent call last):
  File "/home/myusername/web2py/wsgihandler.py", line 33, in 
import gluon.main
  File "/home/myusername/web2py/gluon/__init__.py", line 15, in 
from globals import current
  File "/home/myusername/web2py/gluon/globals.py", line 17, in 
from storage import Storage, List
  File "/home/myusername/web2py/gluon/storage.py", line 15, in 
import cPickle
ImportError: PyCapsule_Import could not import module "cStringIO"
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***


Re: [web2py] Re: Dict object has no attribute 'rstrip'

2012-07-05 Thread adohertyd
Ok, I've gotten around that little problem by doing the following:

r = requests.get(
"https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json"
 
% __process(), auth=('', API_KEY))

It works for some reason! The problem now is outputting the json data but 
that's another beast entirely. Thanks for your time and help Jonathan


On Thursday, 5 July 2012 16:06:16 UTC+1, Jonathan Lundell wrote:
>
> On 5 Jul 2012, at 8:04 AM, adohertyd wrote:
>
> Oh I see now. Ok tried to implement that still no joy. I'm trying a number 
> of different things still no luck. It's just a matter of perseverance I 
> think!
>
>
> Show your current code, please. 
>
>
> On Thursday, 5 July 2012 15:49:50 UTC+1, Jonathan Lundell wrote:
>>
>> On 5 Jul 2012, at 7:47 AM, adohertyd wrote:
>>
>> No that's not it either Jonathan. The problem I think is with the {'term' 
>> : urllib.quote(term)}. I think that because 'term' is a dict type, the 
>> urllib.quote is having issues with it.
>>
>>
>> That's what I mean. In the case of blekko and entireweb, you're using 
>> (implicitly) term = __process()['term'], but for Bing you're 
>> doing term = __process().
>>
>>
>> On Thursday, 5 July 2012 14:55:06 UTC+1, adohertyd wrote:
>>>
>>> Me again! I don't know why I am getting this error. The process() 
>>> function takes in a value session.term, processes it, and returns it as a 
>>> dict type so that it can be mapped to URL's in the next function. The 
>>> results() function sends the variable 'term' to 3 different API URL's which 
>>> all should return some json results. The entireweb and blekko results come 
>>> back fine if I leave out the bing call; however, the bing results cause the 
>>> error 'Dict object has no attribute rstrip'. The problem has to be in the 
>>> way I'm calling the Bing API. Would really appreciate some guidance here. 
>>> Thanks! This is my default.py controller
>>>
>>
>
>

Re: [web2py] Re: Working with custom form

2012-07-05 Thread Anthony

>
> When I used customform for login, it won't give me any errors to be shown 
> whenever the password was invalid or email is not existing. I put it on 
> jquery mobile website. Any idea?
>
Just to clarify, if you let web2py serialize the form widgets (i.e., using 
{{=form}} or {{=form.custom.widget.field}}), the errors will display (even 
without using the web2py CSS and JS files). However, if you use completely 
custom HTML to display the widgets, then you have to handle displaying the 
errors yourself. The errors can be found in form.errors (i.e., 
form.errors.myfield contains the error message for the "myfield" field if 
there is one).

Anthony


[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread Massimo Di Pierro
I would do:

def getImage(url,db): 
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = {'User-Agent': user_agent}

req = urllib2.Request(url,"",headers)

try:
response = urllib2.urlopen(req)
except urllib2.URLError, e:
if hasattr(e, 'reason'):
print 'We failed to reach a server.'
print 'Reason: ', e.reason
elif hasattr(e, 'code'):
print 'The server couldn\'t fulfill the request.'
print 'Error code: ', e.code
else:
pass # everything is fine
print response.geturl()
print response.info()
# print response.read() # <<< do not read it
# f = open(response.read(),'rb') # << response is already a stream
# stream = open(response,'rb')
id = 
db.image.insert(url=url,image=db.image.image_upload.store(response,filename=url))
db.commit() # not sure if needed, depends on where executed
return id

then return it with the provided download action or

def imageLookup():
id = request.vars.id
#response.headers['Content-Type']='image/jpeg' 
path = os.path.join(request.folder,'uploads',db.image[id].image_file)
return response.stream(open(path,'rb'))



On Thursday, 5 July 2012 06:23:31 UTC-5, RCTYCO wrote:
>
>
> I am trying to save an image from another database into my 
> database, essentially i am caching the a copy into my database so I don't 
> have to query the external site. 
>
> I have a link 
> http://eandata.com/image/products/004/900/000/004900443.jpg. 
>
> I want to save the jpg into a blob in my database.
>
> Model
> db.define_table('image',
> Field('url','string'),
> Field('image_upload','upload',uploadfield='image_file'),
> Field('image_file','blob'))
>
> Function. I have this running a module and called when I need to download 
> the external image.
>
> def getImage(url,db): 
> 
> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
> headers = {'User-Agent': user_agent}
> 
> req = urllib2.Request(url,"",headers)
> 
> try:
> response = urllib2.urlopen(req)
> except urllib2.URLError, e:
> if hasattr(e, 'reason'):
> print 'We failed to reach a server.'
> print 'Reason: ', e.reason
> elif hasattr(e, 'code'):
> print 'The server couldn\'t fulfill the request.'
> print 'Error code: ', e.code
> else:
> pass # everything is fine
> 
> print response.geturl()
> print response.info()
> print response.read()
> f = open(response.read(),'rb')
> #stream = open(response,'rb')
> 
> return 
> db.image.insert(url=url,image=db.image.image_upload.store(f,url))
>
>
> *I am having a problem with my insert statement. I can't seem to figure 
> out how to save the image into database.* urllib2.urlopen(req) will 
> download the file and provide a file object. But I don't know if i can just 
> save the file or do i need to read the file object within 
> the urllib2.urlopen(req).
>
> I would like the image to be available to be via 
> http://mydomain.com/myapp/imageLookup?id=2 
> 
>
> Controller
> def imageLookup():
> id = request.vars.id
> #response.headers['Content-Type']='image/jpeg' 
> 
> return db.image[id].image_file
>
>
> Do you have any suggestions? The code abo
>


[web2py] Re: MySQL migration fails adding unique

2012-07-05 Thread Massimo Di Pierro
web2py does not know how to migrate when you add a unique=True because 
existing data may break the contraint. You have some option:

1) if there is no data in db, comment the line in model (it will be 
dropped), then add it again with the unique constraint
2) if you have data, add the unique constraint to model, set migrate=True, 
fake_migrate=True then manually do the alter table and make it unique
3) if you upgrade to web2py trank it will silently ignore the alter table 
(bad) but add a constraint at the web2py level.

On Thursday, 5 July 2012 09:41:26 UTC-5, MichaelF wrote:
>
> I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 
> 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
> (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
> to add `unique=True` the web2py migration fails with this error: `" 'exceptions.KeyError'> 'institution_name'"` where institution_name is the 
> name of the field in question.
>
> I've recreated the problem using a single-table application in web2py 
> using MySQL. Here's the model code:
>
> To start off (field not defined as unique):
>
> ... (usual model/db.py boilerplate)
> db = DAL('mysql://w2ptest:abcde...@mysql5.server.com:3307/abc_web2py')
> ...
> db.define_table('Institution',
> Field('Institution_name', 'string', length=60, 
> required=True),
> format='%(Institution_name)s')
>
> I go to the appadmin page and everything looks fine. Then, making 
> Institution_name unique:
>
> db.define_table('Institution',
> Field('Institution_name', 'string', length=60, 
> required=True,
>unique=True),
> format='%(Institution_name)s')
>
> I then refresh the appadmin page and get a ticket with the error. The 
> error line in the traceback is the last line of the modified statement 
> above. And, to make things worse, I can go in and undo the `unique=True`, 
> but web2py doesn't respond if I refresh the appadmin page...or any page 
> served by that web server, even in other applications! The cpu is 
> not pinned while in this state. I have to recreate the app and 
> database to clear the problem. (Well, I think I have to go that far. Just 
> restarting web2py doesn't clear it in the full case, but does clear it in 
> my little one-table test case.) I try to stop the server 
> (web2py_no_console.exe), but it fails to respond.
>
> Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
> abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
> but I'd rather not, particularly as then I have to `try` that statement 
> because MySQL has no `...IF NOT EXIST...` capability for index creation.
>
> Also, if I start off the model with `unique=True` in the first place, 
> everything is fine, and MySQL even shows the unique index as created.
>


Re: [web2py] Re: Thinking of building a bug tracker...

2012-07-05 Thread Richard Vézina
Hello,

Here a patch for web2py_issuetracker...
I didn't read the whole app, so I hope it still works as intended.


# HG changeset patch
# User Richard Vézina 
# Date 1341502246 14400
# Node ID d4a6372008825fa571f3f7b021b3e79fab7e7df4
# Parent  e4535bcdef395d6e8b1f777e8466e1fc74a2d0d1
Fix not working app

diff -r e4535bcdef39 -r d4a637200882 controllers/default.py
--- a/controllers/default.py mar nov 01 08:23:10 2011 -0500
+++ b/controllers/default.py jeu jui 05 11:30:46 2012 -0400
@@ -18,11 +18,15 @@


 def projects():
-COLUMNS=('project.name
','project.author','project.repo','project.license')
-LINKS=[lambda row: A('issues',_href=URL('issues',args=row.id))]
+FIELDS=[db.project.name,
+db.project.author,
+db.project.repo,
+db.project.license,
+db.project.created_by] # created_by seems to be required in
the fields list
+LINKS=[lambda row: A('issues', _href=URL('issues', args=row.id))]
 def check(row): return (row.created_by == auth.user_id)
-grid = SQLFORM.grid(db.project,editable=check,deletable=check,
-columns = COLUMNS,links=LINKS)
+grid = SQLFORM.grid(db.project, editable=check, deletable=check,
+fields = FIELDS, field_id=db.project.id,
links=LINKS)
 return dict(grid=grid)

 def issues():
@@ -49,13 +53,17 @@
 auth.user.email in (project.members_email or [])):
 db.issue.owner.writable = False
 db.issue.status.writable = False
-COLUMNS=('issue.status','issue.summary','issue.created_on',
- 'issue.author','issue.labels')
-LINKS=[lambda row: A('issue',_href=URL('issue',args=row.uuid))]
-grid = SQLFORM.grid(query, columns = COLUMNS,links=LINKS,
-details=False,editable=False,
+FIELDS=[db.issue.status,
+db.issue.summary,
+db.issue.created_on,
+db.issue.author,
+db.issue.labels,
+db.issue.uuid] # uuid seems to be required in the fields list
+LINKS=[lambda row: A('issue', _href=URL('issue', args=row.uuid))]
+grid = SQLFORM.grid(query, fields = FIELDS, links=LINKS,
+details=False, editable=False,
 deletable=project.created_on==auth.user_id,
-create=auth.user_id,args=[project.id],
+create=auth.user_id, args=[project.id],
 oncreate=lambda form:do_mail([db.issue(form.vars.id
)]))
 return dict(grid=grid, project=project)


I will open a ticket on google code and post it there too, in case this
mail get lost.

Richard

On Sat, Jun 2, 2012 at 3:26 PM, Anthony  wrote:

> Yes, that's one of Julio's, creator of http://www.qa-stack.com/ and
> http://pyforum.org/. All three are listed on the Powered By site.
>
> Anthony
>
>
> On Saturday, June 2, 2012 3:13:40 PM UTC-4, Massimo Di Pierro wrote:
>>
>> I had not seen it. Looks really slick.
>>
>> On Friday, 1 June 2012 23:49:31 UTC-5, Bruce Wade wrote:
>>>
>>> i-track is the winner I already have it integrated into my project and
>>> will build off of it.
>>>
>>> On Fri, Jun 1, 2012 at 7:01 AM, Bruce Wade  wrote:
>>>
 issue tracker there is an error when you click on projects on the demo
 not a good example :D
 i-track looks like a very good starting point if we want to build of an
 existing product.


 On Fri, Jun 1, 2012 at 12:37 AM, Jason (spot) Brower <
 encomp...@gmail.com> wrote:

> issue tracker I know of...
> I am looking at itracker now
> Thanks. :)
>
>
> On Fri, Jun 1, 2012 at 10:31 AM, stefaan wrote:
>
>>
>>
>>
>> I have noticed one other tracker in web2py, but I couldn't demo it.
>>>
>>> Have you seen these?
>>
>> http://code.google.com/p/**web2py-issuetracker/
>> http://www.i-track.org/
>>
>>
>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.**com  -
 Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com  -
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>


Re: [web2py] Re: How to install web2py on webfaction

2012-07-05 Thread Prakhar Srivastava
thanks bro, with the help of this mail i install the web2py application but
still not able to login ,i open one ticket for that issue so they reply me
not open Parameters_80.py get the pwd
but i'm able open this file and even i don't know where it is? please help
bro

On 5 July 2012 10:24, khuc viet Cuong  wrote:

> sorry for bad english, i forgot one thing that:
> you should check web2py folder first,
> if  there is a parameters_1234.py  file then you have remove it before
> do steps above
>  (coz: if parameters_1234.py is existing then web2py wont ask password
> again, dont remember exactly )
>
> web2py admin panel and password wont work if you installed it by
> autoscript, because 2 problems:
> 1- No SSL web2py website be created in webfaction control panel.
> 2- parameters_portnumber.py:  portnumber is wrong ( i tested and it
> works with port 80, dont understand why)
>
> To re-config apache for web2py, goto:
> username/webapps/web2py/apache2/conf/httpd.conf
> open this file and change these params to fit your requirement and here is
> mine:
>
> MaxSpareThreads 3
> MinSpareThreads 1
> ThreadsPerChild 5
> WSGIDaemonProcess web2py processes=1
> python-path=/home/user/webapps/web2py/lib/python2.7 threads=1
> maximum-requests=120
>
> Regards.
>
> On Thu, Jul 5, 2012 at 12:35 PM, khuc viet Cuong 
> wrote:
> > hi,
> > webfaction will use your admin password for web2py admin password by
> > default if you install it by auto-script. its ricsky.
> > to set password , you have login via SSH, run web2py as python script,
> > it will ask you password, when you done, stop and kill web2py process,
> > a new file : parameters_portnumber.py , etc.  parameters_1234.py which
> > 12345 port is webfaction gave you when create a new app , but web2py
> > wont work, alway say can access password or...blabla, to solve it,
> > rename its name:
> >
> >  parameters_1234.py-->  parameters_80.py
> >
> > and check your apache thread worker via SSH, and test from your brow.
> > default web2py app folder in webfaction will look like this:
> > web2py-->
> >   -apache2
> >   -htdocs
> >   -web2py
> >
> > check your apache thread worker memory usage via SSH to know how much
> > it eats, should re-config apache, if not webffaction will kill your
> > apache worker and issue email "memory exceed your plan" when run
> > web2py. if u need  re-config apache, i will paste it here for you.
> > Regards
> >
> >
> > On Thu, Jul 5, 2012 at 7:42 AM, monotasker  wrote:
> >> Do you know how to set the admin password? I tried entering my
> webfaction
> >> dashboard password but it didn't work.
> >>
> >> Ian
> >>
> >>
> >> On Wednesday, July 4, 2012 11:42:24 AM UTC-4, kokoyo wrote:
> >>>
> >>> hi, i have been using webfaction, you can do these step to get w2py
> admin:
> >>> on the left menu:  Domains/Website
> >>>
> >>> 1. -->Domains-->Add new domain:domain.com(you did)
> >>> 2. -->Applications-->Add new application:   web2py  (you did:
> >>> install web2py)
> >>> 3. -->Websites--->Click the (+) at bottom-right to create a new Website
> >>> with:
> >>>  Name:*:web2py
> >>>  Https:*  un-check
> >>>  Subdomains:*domain.com
> >>>  Site apps:--->app: web2py  (got this name at Step 2)
> >>> URL path (ex: '/' or '/blog'):* /  (you
> >>> did)
> >>>
> >>> 4. Repeat Step 3 with:
> >>> Name:*:web2py_admin
> >>> Https:*  checked
> >>> Subdomains:*domain.com
> >>> Site apps:--->app: web2py  (got this name at Step 2)   URL
> >>> path (ex: '/' or '/blog'):* /
> >>>
> >>>
> >>> you have lacked of step 4 only,
> >>> to login to admin page: https://domain.com/admin
> >>>
> >>> Regards
> >>>
> >>> On Tue, Jul 3, 2012 at 1:46 PM, Annet wrote:
> >>> > Hi,
> >>> >
> >>> > This post might answer your question:
> >>> >
> >>> >
> >>> >
> https://groups.google.com/forum/?fromgroups#!searchin/web2py/annet$20webfaction/web2py/o9We_wV3eNc/0dS3ci6nFOAJ
> >>> >
> >>> >
> >>> > Kind regards,
> >>> >
> >>> > Annet
>



-- 
*With Regards
Prakhar Srivastava
   +91**9241829245*


Re: [web2py] Re: Thinking of building a bug tracker...

2012-07-05 Thread Richard Vézina
 Issue 3 :App
is broken

Richard

On Thu, Jul 5, 2012 at 11:38 AM, Richard Vézina  wrote:

> Hello,
>
> Here a patch for web2py_issuetracker...
> I didn't read the whole app, so I hope it still works as intended.
>
>
> # HG changeset patch
> # User Richard Vézina 
> # Date 1341502246 14400
> # Node ID d4a6372008825fa571f3f7b021b3e79fab7e7df4
> # Parent  e4535bcdef395d6e8b1f777e8466e1fc74a2d0d1
> Fix not working app
>
> diff -r e4535bcdef39 -r d4a637200882 controllers/default.py
> --- a/controllers/default.py mar nov 01 08:23:10 2011 -0500
> +++ b/controllers/default.py jeu jui 05 11:30:46 2012 -0400
> @@ -18,11 +18,15 @@
>
>
>  def projects():
> -COLUMNS=('project.name
> ','project.author','project.repo','project.license')
> -LINKS=[lambda row: A('issues',_href=URL('issues',args=row.id))]
> +FIELDS=[db.project.name,
> +db.project.author,
> +db.project.repo,
> +db.project.license,
> +db.project.created_by] # created_by seems to be required in
> the fields list
> +LINKS=[lambda row: A('issues', _href=URL('issues', args=row.id))]
>  def check(row): return (row.created_by == auth.user_id)
> -grid = SQLFORM.grid(db.project,editable=check,deletable=check,
> -columns = COLUMNS,links=LINKS)
> +grid = SQLFORM.grid(db.project, editable=check, deletable=check,
> +fields = FIELDS, field_id=db.project.id,
> links=LINKS)
>  return dict(grid=grid)
>
>  def issues():
> @@ -49,13 +53,17 @@
>  auth.user.email in (project.members_email or [])):
>  db.issue.owner.writable = False
>  db.issue.status.writable = False
> -COLUMNS=('issue.status','issue.summary','issue.created_on',
> - 'issue.author','issue.labels')
> -LINKS=[lambda row: A('issue',_href=URL('issue',args=row.uuid))]
> -grid = SQLFORM.grid(query, columns = COLUMNS,links=LINKS,
> -details=False,editable=False,
> +FIELDS=[db.issue.status,
> +db.issue.summary,
> +db.issue.created_on,
> +db.issue.author,
> +db.issue.labels,
> +db.issue.uuid] # uuid seems to be required in the fields list
> +LINKS=[lambda row: A('issue', _href=URL('issue', args=row.uuid))]
> +grid = SQLFORM.grid(query, fields = FIELDS, links=LINKS,
> +details=False, editable=False,
>  deletable=project.created_on==auth.user_id,
> -create=auth.user_id,args=[project.id],
> +create=auth.user_id, args=[project.id],
>  oncreate=lambda form:do_mail([db.issue(
> form.vars.id)]))
>  return dict(grid=grid, project=project)
>
>
> I will open a ticket on google code and post it there too, in case this
> mail get lost.
>
> Richard
>
> On Sat, Jun 2, 2012 at 3:26 PM, Anthony  wrote:
>
>> Yes, that's one of Julio's, creator of http://www.qa-stack.com/ and
>> http://pyforum.org/. All three are listed on the Powered By site.
>>
>> Anthony
>>
>>
>> On Saturday, June 2, 2012 3:13:40 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> I had not seen it. Looks really slick.
>>>
>>> On Friday, 1 June 2012 23:49:31 UTC-5, Bruce Wade wrote:

 i-track is the winner I already have it integrated into my project and
 will build off of it.

 On Fri, Jun 1, 2012 at 7:01 AM, Bruce Wade wrote:

> issue tracker there is an error when you click on projects on the demo
> not a good example :D
> i-track looks like a very good starting point if we want to build of
> an existing product.
>
>
> On Fri, Jun 1, 2012 at 12:37 AM, Jason (spot) Brower <
> encomp...@gmail.com> wrote:
>
>> issue tracker I know of...
>> I am looking at itracker now
>> Thanks. :)
>>
>>
>> On Fri, Jun 1, 2012 at 10:31 AM, stefaan wrote:
>>
>>>
>>>
>>>
>>> I have noticed one other tracker in web2py, but I couldn't demo it.

 Have you seen these?
>>>
>>> http://code.google.com/p/**web2py-issuetracker/
>>> http://www.i-track.org/
>>>
>>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/**brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.**com  -
> Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.**com  -
 Fitness Personal Trainers Online
 http://www.warplydesigned.com


>


Re: [web2py] Re: How to install web2py on webfaction

2012-07-05 Thread khuc viet Cuong
hi
for webfaction, your web2py app is an application with a name,you can find
out what name when check it in application menu,
and the file Parameters_80.py (or  *parameters_xyz.py*  not sure what you
got) is in web2py application folder, look like this:

home/yourusername/webapps/web2py <---this is name of an app which we have
give to

inside this folder has 3 folders: apache2, htdocs, web2py

so goto: home/yourusername/webapps/web2py/web2py
the file: *parameters_80.py (or * *parameters_xyz.py* *) must be here, if
not we can not login.*
inside this file is your encoded password, you dont need to open this file
to edit, just rename it by change the port number, 80 or the port that
webfaction gave to app and test. (get this port via application menu)
if the  *parameters_80.py*  file is not exsiting then you have do the steps
to set password for web2py (i wrote above ) , it will created this file for
you.

regards

On Fri, Jul 6, 2012 at 12:52 AM, Prakhar Srivastava 
wrote:
> thanks bro, with the help of this mail i install the web2py application
but
> still not able to login ,i open one ticket for that issue so they reply me
> not open Parameters_80.py get the pwd
> but i'm able open this file and even i don't know where it is? please help
> bro
>
>
> On 5 July 2012 10:24, khuc viet Cuong  wrote:
>>
>> sorry for bad english, i forgot one thing that:
>> you should check web2py folder first,
>> if  there is a parameters_1234.py  file then you have remove it before
>> do steps above
>>  (coz: if parameters_1234.py is existing then web2py wont ask password
>> again, dont remember exactly )
>>
>> web2py admin panel and password wont work if you installed it by
>> autoscript, because 2 problems:
>> 1- No SSL web2py website be created in webfaction control panel.
>> 2- parameters_portnumber.py:  portnumber is wrong ( i tested and it
>> works with port 80, dont understand why)
>>
>> To re-config apache for web2py, goto:
>> username/webapps/web2py/apache2/conf/httpd.conf
>> open this file and change these params to fit your requirement and here
is
>> mine:
>>
>> MaxSpareThreads 3
>> MinSpareThreads 1
>> ThreadsPerChild 5
>> WSGIDaemonProcess web2py processes=1
>> python-path=/home/user/webapps/web2py/lib/python2.7 threads=1
>> maximum-requests=120
>>
>> Regards.
>>
>> On Thu, Jul 5, 2012 at 12:35 PM, khuc viet Cuong 
>> wrote:
>> > hi,
>> > webfaction will use your admin password for web2py admin password by
>> > default if you install it by auto-script. its ricsky.
>> > to set password , you have login via SSH, run web2py as python script,
>> > it will ask you password, when you done, stop and kill web2py process,
>> > a new file : parameters_portnumber.py , etc.  parameters_1234.py which
>> > 12345 port is webfaction gave you when create a new app , but web2py
>> > wont work, alway say can access password or...blabla, to solve it,
>> > rename its name:
>> >
>> >  parameters_1234.py-->  parameters_80.py
>> >
>> > and check your apache thread worker via SSH, and test from your brow.
>> > default web2py app folder in webfaction will look like this:
>> > web2py-->
>> >   -apache2
>> >   -htdocs
>> >   -web2py
>> >
>> > check your apache thread worker memory usage via SSH to know how much
>> > it eats, should re-config apache, if not webffaction will kill your
>> > apache worker and issue email "memory exceed your plan" when run
>> > web2py. if u need  re-config apache, i will paste it here for you.
>> > Regards
>> >
>> >
>> > On Thu, Jul 5, 2012 at 7:42 AM, monotasker  wrote:
>> >> Do you know how to set the admin password? I tried entering my
>> >> webfaction
>> >> dashboard password but it didn't work.
>> >>
>> >> Ian
>> >>
>> >>
>> >> On Wednesday, July 4, 2012 11:42:24 AM UTC-4, kokoyo wrote:
>> >>>
>> >>> hi, i have been using webfaction, you can do these step to get w2py
>> >>> admin:
>> >>> on the left menu:  Domains/Website
>> >>>
>> >>> 1. -->Domains-->Add new domain:domain.com(you did)
>> >>> 2. -->Applications-->Add new application:   web2py  (you did:
>> >>> install web2py)
>> >>> 3. -->Websites--->Click the (+) at bottom-right to create a new
>> >>> Website
>> >>> with:
>> >>>  Name:*:web2py
>> >>>  Https:*  un-check
>> >>>  Subdomains:*domain.com
>> >>>  Site apps:--->app: web2py  (got this name at Step 2)
>> >>> URL path (ex: '/' or '/blog'):* /  (you
>> >>> did)
>> >>>
>> >>> 4. Repeat Step 3 with:
>> >>> Name:*:web2py_admin
>> >>> Https:*  checked
>> >>> Subdomains:*domain.com
>> >>> Site apps:--->app: web2py  (got this name at Step 2)   URL
>> >>> path (ex: '/' or '/blog'):* /
>> >>>
>> >>>
>> >>> you have lacked of step 4 only,
>> >>> to login to admin page: https://domain.com/admin
>> >>>
>> >>> Regards
>> >>>
>> >>> On Tue, Jul 3, 2012 at 1:46 PM, Annet wrote:
>> >>> > Hi,
>> >>> >
>> >>> > This post might answer your question:
>> >

Re: [web2py] Re: How to install web2py on webfaction

2012-07-05 Thread Prakhar Srivastava
thanks bro for nice and quick reply
i got that file but whatever pwd is written over there it also not working.

On 5 July 2012 22:09, khuc viet Cuong  wrote:

>
>
> On Fri, Jul 6, 2012 at 1:19 AM, khuc viet Cuong wrote:
>
>> hi
>> for webfaction, your web2py app is an application with a name,you can
>> find out what name when check it in application menu,
>> and the file Parameters_80.py (or  *parameters_xyz.py*  not sure what
>> you got) is in web2py application folder, look like this:
>>
>> home/yourusername/webapps/web2py <---this is name of an app which we have
>> give to
>>
>> inside this folder has 3 folders: apache2, htdocs, web2py
>>
>> so goto: home/yourusername/webapps/web2py/web2py
>> the file: *parameters_80.py (or * *parameters_xyz.py* *) must be here,
>> if not we can not login.*
>> inside this file is your encoded password, you dont need to open this
>> file to edit, just rename it by change the port number, 80 or the port
>> that webfaction gave to app and test. (get this port via application
>> menu)
>> if the  *parameters_80.py*  file is not exsiting then you have do the
>> steps to set password for web2py (i wrote above ) , it will created this
>> file for you.
>>
>> regards
>>
>> On Fri, Jul 6, 2012 at 12:52 AM, Prakhar Srivastava <
>> prakharsri...@gmail.com> wrote:
>> > thanks bro, with the help of this mail i install the web2py
>> application but
>> > still not able to login ,i open one ticket for that issue so they
>> reply me
>> > not open Parameters_80.py get the pwd
>> > but i'm able open this file and even i don't know where it is? pleasehelp
>> > bro
>> >
>> >
>> > On 5 July 2012 10:24, khuc viet Cuong  wrote:
>> >>
>> >> sorry for bad english, i forgot one thing that:
>> >> you should check web2py folder first,
>> >> if  there is a parameters_1234.py  file then you have remove it before
>> >> do steps above
>> >>  (coz: if parameters_1234.py is existing then web2py wont ask password
>> >> again, dont remember exactly )
>> >>
>> >> web2py admin panel and password wont work if you installed it by
>> >> autoscript, because 2 problems:
>> >> 1- No SSL web2py website be created in webfaction control panel.
>> >> 2- parameters_portnumber.py:  portnumber is wrong ( i tested and it
>> >> works with port 80, dont understand why)
>> >>
>> >> To re-config apache for web2py, goto:
>> >> username/webapps/web2py/apache2/conf/httpd.conf
>> >> open this file and change these params to fit your requirement and
>> here is
>> >> mine:
>> >>
>> >> MaxSpareThreads 3
>> >> MinSpareThreads 1
>> >> ThreadsPerChild 5
>> >> WSGIDaemonProcess web2py processes=1
>> >> python-path=/home/user/webapps/web2py/lib/python2.7 threads=1
>> >> maximum-requests=120
>> >>
>> >> Regards.
>> >>
>> >> On Thu, Jul 5, 2012 at 12:35 PM, khuc viet Cuong > >
>> >> wrote:
>> >> > hi,
>> >> > webfaction will use your admin password for web2py admin password by
>> >> > default if you install it by auto-script. its ricsky.
>> >> > to set password , you have login via SSH, run web2py as python
>> script,
>> >> > it will ask you password, when you done, stop and kill web2py
>> process,
>> >> > a new file : parameters_portnumber.py , etc.  parameters_1234.pywhich
>> >> > 12345 port is webfaction gave you when create a new app , but web2py
>> >> > wont work, alway say can access password or...blabla, to solve it,
>> >> > rename its name:
>> >> >
>> >> >  parameters_1234.py-->  parameters_80.py
>> >> >
>> >> > and check your apache thread worker via SSH, and test from your
>> brow.
>> >> > default web2py app folder in webfaction will look like this:
>> >> > web2py-->
>> >> >   -apache2
>> >> >   -htdocs
>> >> >   -web2py
>> >> >
>> >> > check your apache thread worker memory usage via SSH to know how
>> much
>> >> > it eats, should re-config apache, if not webffaction will kill your
>> >> > apache worker and issue email "memory exceed your plan" when run
>> >> > web2py. if u need  re-config apache, i will paste it here for you.
>> >> > Regards
>> >> >
>> >> >
>> >> > On Thu, Jul 5, 2012 at 7:42 AM, monotasker 
>> wrote:
>> >> >> Do you know how to set the admin password? I tried entering my
>> >> >> webfaction
>> >> >> dashboard password but it didn't work.
>> >> >>
>> >> >> Ian
>> >> >>
>> >> >>
>> >> >> On Wednesday, July 4, 2012 11:42:24 AM UTC-4, kokoyo wrote:
>> >> >>>
>> >> >>> hi, i have been using webfaction, you can do these step to get
>> w2py
>> >> >>> admin:
>> >> >>> on the left menu:  Domains/Website
>> >> >>>
>> >> >>> 1. -->Domains-->Add new domain:domain.com(you did)
>> >> >>> 2. -->Applications-->Add new application:   web2py  (you
>> did:
>> >> >>> install web2py)
>> >> >>> 3. -->Websites--->Click the (+) at bottom-right to create a new
>> >> >>> Website
>> >> >>> with:
>> >> >>>  Name:*:web2py
>> >> >>>  Https:*  un-check
>> >> >>>  Subdomains:*domain.com
>> >> >>>  Site apps:--->app: web2py  (got this name a

[web2py] Re: Rocket server truncating long responses

2012-07-05 Thread nick name
On Tuesday, June 26, 2012 3:43:16 PM UTC-4, Massimo Di Pierro wrote:
>
> If you can reproduce. Chould you try wireshark to do a packet capture? I 
> would like to see what is going on.
> Tim is a new dad and has not been responsive. I will try an attempt to fix 
> this myself (although I cannot repcoduce it) else we wil revert to 
> cherrypy. 
>

I was away for a couple of weeks and only now catching up.

I've posted the instructions to reproduce this several times, e.g. 
https://github.com/explorigin/Rocket/issues/1#issuecomment-3734231 ; I've 
just noticed that Tim actually checked in the changes I suggested into the 
Rocket source on github 

 
, but as far as I remember, they didn't actually solve the problem - only 
helped reliable demonstrate that they are happening (and when).

I don't think the packet capture will be helpful -- dropping of data 
happens inside Python's sendall() and Rocket's handling of that.

I will reapply my patch that Tim adopted later this week and try to 
recreate to see if the problem is solved.


Re: [web2py] Re: Web Development Introduction Based On Web2py

2012-07-05 Thread Richard Vézina
Still down!

Richard

On Thu, Jul 5, 2012 at 2:27 AM, dave  wrote:

> the site is down
>
> Internal Server Error
>
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
>
> Please contact the server administrator, [no address given] and inform
> them of the time the error occurred, and anything you might have done that
> may have caused the error.
>
> More information about this error may be available in the server error log.
> --
> Apache/2.2.16 (Debian) Server at killer-web-development.com Port 80
>


Re: [web2py] DAL performance vs executesql

2012-07-05 Thread nick name
On Friday, June 22, 2012 11:37:10 AM UTC-4, Anthony wrote:

> Maybe it would be possible to convert the results of executesql() to a 
> pseudo-Rows object (without all the processing of each individual field 
> value) so it could be used with the grid, etc.
>

The original ticket that prompted adding processors 
 has example that 
creates namedtuples, which is a kind of pseudo-Row - but I don't know if 
it's good enough for grid or not. 


[web2py] Re: Standalone DAL leaves mysql connections opened

2012-07-05 Thread nick name
On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote:
>
> why not simply?
>
> db.commit()
> db.close()
>
> if db in an on object attribute like self.db you can do
>
> if self.db:
>self.db.commit()
>self.db.close()
>self.db = 0
>
> you can also do:
>
> BaseAdapter.close_all_instances('commit')
>

This is not enough, as was documented on issue  
http://code.google.com/p/web2py/issues/detail?id=731.
 
The code that works for me for sqlite is as follows:

def closebase(base):
if not base: return
# see: http://code.google.com/p/web2py/issues/detail?id=731
# see: https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion
# was: base._adapter.close()
from gluon.dal import thread
thread.instances.remove(base._adapter)
base._adapter.close()

and then I call closebase(db); db = None which is enough for me with sqlite 
-- but apparently, the original poster has tried that, and that is not 
sufficient for mysql.


[web2py] Re: Audit for all tables, independent of CRUD; and transaction rollback.

2012-07-05 Thread nick name
On Wednesday, July 4, 2012 2:23:16 PM UTC-4, Massimo Di Pierro wrote:
>
> web2py has change since one year ago. Now you simply do:
>
>db.define_table('mytable',fields...,auth.signature)
>... define more table ...
>auth.enable_record_versioning(db)
>
> and mytable will have a mytable_archive that works as Nick suggested.
>

Indeed, it works beautifully, and is much simpler (and much more general) 
than my monkeypatching solution.

Thanks, Massimo! 


[web2py] Re: MySQL migration fails adding unique=

2012-07-05 Thread Jim S
I believe that field level migrations do not work with MySQL.  I get around 
this by removing the column, saving, run the app to force migration, and 
then add the field back the way I want it.  I know this causes you to lose 
the data in that column, but I only do this in my test environment and have 
migrations turned off in production.

Alternatively, you could update the column def in web2py, change manually 
in mysql and then run with migrate=False, fake_migrate=True to get things 
back in sync.

Hope that helps.

-Jim

On Wednesday, July 4, 2012 10:29:10 AM UTC-5, MichaelF wrote:
>
> I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 
> 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
> (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
> to add `unique=True` the web2py migration fails with this error: `" 'exceptions.KeyError'> 'institution_name'"` where institution_name is the 
> name of the field in question.
>
> I've recreated the problem using a single-table application in web2py 
> using MySQL. Here's the model code:
>
> To start off (field not defined as unique):
>
> ... (usual model/db.py boilerplate)
> db = DAL('mysql://w2ptest:abcde...@mysql5.server.com:3307/abc_web2py')
> ...
> db.define_table('Institution',
> Field('Institution_name', 'string', length=60, 
> required=True),
> format='%(Institution_name)s')
>
> I go to the appadmin page and everything looks fine. Then, making 
> Institution_name unique:
>
> db.define_table('Institution',
> Field('Institution_name', 'string', length=60, 
> required=True,
>unique=True),
> format='%(Institution_name)s')
>
> I then refresh the appadmin page and get a ticket with the error. The 
> error line in the traceback is the last line of the modified statement 
> above. And, to make things worse, I can go in and undo the `unique=True`, 
> but web2py doesn't respond if I refresh the appadmin page...or any page 
> served by that web server, even in other applications! The cpu is 
> not pinned while in this state. I have to recreate the app and 
> database to clear the problem. (Well, I think I have to go that far. Just 
> restarting web2py doesn't clear it in the full case, but does clear it in 
> my little one-table test case.) I try to stop the server 
> (web2py_no_console.exe), but it fails to respond.
>
> Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
> abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
> but I'd rather not, particularly as then I have to `try` that statement 
> because MySQL has no `...IF NOT EXIST...` capability for index creation.
>
> Also, if I start off the model with `unique=True` in the first place, 
> everything is fine, and MySQL even shows the unique index as created.
>
>

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread RCTYCO
Thank you for the quick response.

I added the lines above : (  id = 
db.image.insert(url=url,image=db.image.image_upload.store(response,filename=url))
db.commit() )

It uploaded the information (url and renamed the file) but I don't believe 
it upload the image to the database.

This is what it uploaded. Image_file is empty. 
id,url,image_upload,image_file
'1', 'http://eandata.com/image/products/000/000/015/000151122.jpg', 
'image.image_upload.94df8d0ebb1047e0.303030303030303135313132322e6a7067.jpg', 


This is my model.
Model
db.define_table('image',
Field('url','string'),
Field('image_upload','upload',uploadfield='image_file'),
Field('image_file','blob'))

Any suggestions?


[web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
I am trying to get a json response from 2 URL's and showing in on a results 
page. I'm getting an error saying that the page I'm redirecting to in order 
to show the json data is not defined but this only happens with one of the 
url's being contacted. I'm probably not being very clear with this so I 
will show you some code:


import urllib2

def index():
form = FORM(''...  
if form.process().accepted:
session.term=request.vars.query
redirect(URL('results'))
elif form.errors: ...
return dict(form=form)

def __process():
term = session.term
term = urllib2.quote("'" + term + "'")
return dict(term=term)

def results():
import requests

blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=" %__process
()
blekkoresults = urllib2.urlopen(blekko).read()

bing = 
"https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json"
API_KEY = 'mykey'
r = requests.get(bing % __process(), auth=('', API_KEY))
bingresults = r.json

   return blekkoresults, bingresults

The line 'bing= ' is causing the issue. If I comment out the bing section 
of the code, the blekko part returns no problem. However, with the bing 
section included I get the following error:

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

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "C:\web2py\applications\metasearch2\views\manage/results.html", line 86, 
in 
NameError: name 'results' is not defined

Can anyone please tell me what's going on? If I run this program in IDLE it 
returns the bing results so it is definitely a web2py issue.


Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread Richard Vézina
Maybe you should encode your bing url.

Richard

On Thu, Jul 5, 2012 at 4:05 PM, adohertyd  wrote:

> I am trying to get a json response from 2 URL's and showing in on a
> results page. I'm getting an error saying that the page I'm redirecting to
> in order to show the json data is not defined but this only happens with
> one of the url's being contacted. I'm probably not being very clear with
> this so I will show you some code:
>
>
> import urllib2
>
> def index():
> form = FORM(''...
> if form.process().accepted:
> session.term=request.vars.query
> redirect(URL('results'))
> elif form.errors: ...
> return dict(form=form)
>
> def __process():
> term = session.term
> term = urllib2.quote("'" + term + "'")
> return dict(term=term)
>
> def results():
> import requests
>
> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=" %__process
> ()
> blekkoresults = urllib2.urlopen(blekko).read()
>
> bing = "
> https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json
> "
> API_KEY = 'mykey'
> r = requests.get(bing % __process(), auth=('', API_KEY))
> bingresults = r.json
>
>return blekkoresults, bingresults
>
> The line 'bing= ' is causing the issue. If I comment out the bing section
> of the code, the blekko part returns no problem. However, with the bing
> section included I get the following error:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 205, in restricted
> exec ccode in environment
>   File "C:\web2py\applications\metasearch2\views\manage/results.html", line 
> 86, in 
> NameError: name 'results' is not defined
>
> Can anyone please tell me what's going on? If I run this program in IDLE
> it returns the bing results so it is definitely a web2py issue.
>


Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
No tried that and got 'unsupported format character 'A' at index 7'

On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>
> Maybe you should encode your bing url.
>
> Richard
>
> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>
>> I am trying to get a json response from 2 URL's and showing in on a 
>> results page. I'm getting an error saying that the page I'm redirecting to 
>> in order to show the json data is not defined but this only happens with 
>> one of the url's being contacted. I'm probably not being very clear with 
>> this so I will show you some code:
>>
>>
>> import urllib2
>>
>> def index():
>> form = FORM(''...  
>> if form.process().accepted:
>> session.term=request.vars.query
>> redirect(URL('results'))
>> elif form.errors: ...
>> return dict(form=form)
>>
>> def __process():
>> term = session.term
>> term = urllib2.quote("'" + term + "'")
>> return dict(term=term)
>>
>> def results():
>> import requests
>>
>> blekko = "http://www.blekko.com/?q=%(term)s+/json&auth=" 
>> %__process
>> ()
>> blekkoresults = urllib2.urlopen(blekko).read()
>>
>> bing = "
>> https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(term)s&$top=50&$format=json
>> "
>> API_KEY = 'mykey'
>> r = requests.get(bing % __process(), auth=('', API_KEY))
>> bingresults = r.json
>>
>>return blekkoresults, bingresults
>>
>> The line 'bing= ' is causing the issue. If I comment out the bing section 
>> of the code, the blekko part returns no problem. However, with the bing 
>> section included I get the following error:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.py", line 205, in restricted
>>
>> exec ccode in environment
>>   File "C:\web2py\applications\metasearch2\views\manage/results.html", line 
>> 86, in 
>> NameError: name 'results' is not defined
>>
>> Can anyone please tell me what's going on? If I run this program in IDLE 
>> it returns the bing results so it is definitely a web2py issue.
>>
>
>

Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread Bruce Wade
I am assuming by your error inside results.html you have a variable defined
as results however you are passing a tuple blekkoresults, bingresults we
would need to see results.html

On Thu, Jul 5, 2012 at 1:16 PM, adohertyd  wrote:

> No tried that and got 'unsupported format character 'A' at index 7'
>
>
> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>
>> Maybe you should encode your bing url.
>>
>> Richard
>>
>> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>>
>> I am trying to get a json response from 2 URL's and showing in on a
>>> results page. I'm getting an error saying that the page I'm redirecting to
>>> in order to show the json data is not defined but this only happens with
>>> one of the url's being contacted. I'm probably not being very clear with
>>> this so I will show you some code:
>>>
>>>
>>> import urllib2
>>>
>>> def index():
>>> form = FORM(''...
>>> if form.process().accepted:
>>> session.term=request.vars.**query
>>> redirect(URL('results'))
>>> elif form.errors: ...
>>> return dict(form=form)
>>>
>>> def __process():
>>> term = session.term
>>> term = urllib2.quote("'" + term + "'")
>>> return dict(term=term)
>>>
>>> def results():
>>> import requests
>>>
>>> blekko = "http://www.blekko.com/?q=%(**term)s+/json&auth=" 
>>> %__process
>>> ()
>>> blekkoresults = urllib2.urlopen(blekko).read()
>>>
>>> bing = "https://api.datamarket.azure.**com/Data.ashx/Bing/SearchWeb/
>>> **Web?Query=%(term)s&$top=50&$**format=json"
>>> API_KEY = 'mykey'
>>> r = requests.get(bing % __process(), auth=('', API_KEY))
>>> bingresults = r.json
>>>
>>>return blekkoresults, bingresults
>>>
>>> The line 'bing= ' is causing the issue. If I comment out the bing
>>> section of the code, the blekko part returns no problem. However, with the
>>> bing section included I get the following error:
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>>
>>> Traceback (most recent call last):
>>>   File "C:\web2py\gluon\restricted.**py", line 205, in restricted
>>>
>>> exec ccode in environment
>>>   File "C:\web2py\applications\**metasearch2\views\manage/**results.html", 
>>> line 86, in 
>>> NameError: name 'results' is not defined
>>>
>>> Can anyone please tell me what's going on? If I run this program in IDLE
>>> it returns the bing results so it is definitely a web2py issue.
>>>
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
This is my results.html, all of it :)

{{extend 'layout.html'}}

{{=results}}

On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>
> I am assuming by your error inside results.html you have a variable 
> defined as results however you are passing a tuple blekkoresults,bingresults 
> we would need to see results.html
>
> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>
>> No tried that and got 'unsupported format character 'A' at index 7'
>>
>>
>> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>>
>>> Maybe you should encode your bing url.
>>>
>>> Richard
>>>
>>> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>>>
>>> I am trying to get a json response from 2 URL's and showing in on a 
 results page. I'm getting an error saying that the page I'm redirecting to 
 in order to show the json data is not defined but this only happens with 
 one of the url's being contacted. I'm probably not being very clear with 
 this so I will show you some code:


 import urllib2

 def index():
 form = FORM(''...  
 if form.process().accepted:
 session.term=request.vars.**query
 redirect(URL('results'))
 elif form.errors: ...
 return dict(form=form)

 def __process():
 term = session.term
 term = urllib2.quote("'" + term + "'")
 return dict(term=term)

 def results():
 import requests

 blekko = "http://www.blekko.com/?q=%(**term)s+/json&auth=" 
 %__process
 ()
 blekkoresults = urllib2.urlopen(blekko).read()

 bing = "https://api.datamarket.azure.**
 com/Data.ashx/Bing/SearchWeb/**Web?Query=%(term)s&$top=50&$**
 format=json"
 API_KEY = 'mykey'
 r = requests.get(bing % __process(), auth=('', API_KEY))
 bingresults = r.json

return blekkoresults, bingresults

 The line 'bing= ' is causing the issue. If I comment out the bing 
 section of the code, the blekko part returns no problem. However, with the 
 bing section included I get the following error:

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

 Traceback (most recent call last):
   File "C:\web2py\gluon\restricted.**py", line 205, in restricted


 exec ccode in environment
   File "C:\web2py\applications\**metasearch2\views\manage/**results.html", 
 line 86, in 

 NameError: name 'results' is not defined

 Can anyone please tell me what's going on? If I run this program in 
 IDLE it returns the bing results so it is definitely a web2py issue.

>>>
>>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread Bruce Wade
Ok exactly it is complaining that {{=results}} does not exist.

Reneed to return dict(results=something) from your results action in your
controller

On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:

> This is my results.html, all of it :)
>
> {{extend 'layout.html'}}
>
> {{=results}}
>
> On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>
>> I am assuming by your error inside results.html you have a variable
>> defined as results however you are passing a tuple blekkoresults,bingresults 
>> we would need to see results.html
>>
>> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>>
>> No tried that and got 'unsupported format character 'A' at index 7'
>>>
>>>
>>> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>>>
 Maybe you should encode your bing url.

 Richard

 On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:

 I am trying to get a json response from 2 URL's and showing in on a
> results page. I'm getting an error saying that the page I'm redirecting to
> in order to show the json data is not defined but this only happens with
> one of the url's being contacted. I'm probably not being very clear with
> this so I will show you some code:
>
>
> import urllib2
>
> def index():
> form = FORM(''...
> if form.process().accepted:
> session.term=request.vars.**quer**y
> redirect(URL('results'))
> elif form.errors: ...
> return dict(form=form)
>
> def __process():
> term = session.term
> term = urllib2.quote("'" + term + "'")
> return dict(term=term)
>
> def results():
> import requests
>
> blekko = "http://www.blekko.com/?q=%(**te**rm)s+/json&auth=
> " % __process()
> blekkoresults = urllib2.urlopen(blekko).read()
>
> bing = "https://api.datamarket.azure.
> com/Data.ashx/Bing/SearchWeb/**W**eb?Query=%(term)s&$top=50&$**for**
> mat=json"
> API_KEY = 'mykey'
> r = requests.get(bing % __process(), auth=('', API_KEY))
> bingresults = r.json
>
>return blekkoresults, bingresults
>
> The line 'bing= ' is causing the issue. If I comment out the bing
> section of the code, the blekko part returns no problem. However, with the
> bing section included I get the following error:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.**py**", line 205, in restricted
>
>
> exec ccode in environment
>   File 
> "C:\web2py\applications\**metase**arch2\views\manage/**results.**html", 
> line 86, in 
>
> NameError: name 'results' is not defined
>
> Can anyone please tell me what's going on? If I run this program in
> IDLE it returns the bing results so it is definitely a web2py issue.
>


>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com  -
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
Thanks Bruce will try that. Why does 'return blekkoresults' work though?

On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:
>
> Ok exactly it is complaining that {{=results}} does not exist.
>
> Reneed to return dict(results=something) from your results action in your 
> controller
>
> On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:
>
>> This is my results.html, all of it :)
>>
>> {{extend 'layout.html'}}
>>
>> {{=results}}
>>
>> On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>>
>>> I am assuming by your error inside results.html you have a variable 
>>> defined as results however you are passing a tuple 
>>> blekkoresults,bingresults we would need to see results.html
>>>
>>> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>>>
>>> No tried that and got 'unsupported format character 'A' at index 7'


 On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:

> Maybe you should encode your bing url.
>
> Richard
>
> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>
> I am trying to get a json response from 2 URL's and showing in on a 
>> results page. I'm getting an error saying that the page I'm redirecting 
>> to 
>> in order to show the json data is not defined but this only happens with 
>> one of the url's being contacted. I'm probably not being very clear with 
>> this so I will show you some code:
>>
>>
>> import urllib2
>>
>> def index():
>> form = FORM(''...  
>> if form.process().accepted:
>> session.term=request.vars.**quer**y
>> redirect(URL('results'))
>> elif form.errors: ...
>> return dict(form=form)
>>
>> def __process():
>> term = session.term
>> term = urllib2.quote("'" + term + "'")
>> return dict(term=term)
>>
>> def results():
>> import requests
>>
>> blekko = "http://www.blekko.com/?q=%(**te**rm)s+/json&auth=
>> " % __process()
>> blekkoresults = urllib2.urlopen(blekko).read()
>>
>> bing = "https://api.datamarket.azure.
>> com/Data.ashx/Bing/SearchWeb/**W**eb?Query=%(term)s&$top=50&$**for**
>> mat=json"
>> API_KEY = 'mykey'
>> r = requests.get(bing % __process(), auth=('', API_KEY))
>> bingresults = r.json
>>
>>return blekkoresults, bingresults
>>
>> The line 'bing= ' is causing the issue. If I comment out the bing 
>> section of the code, the blekko part returns no problem. However, with 
>> the 
>> bing section included I get the following error:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.**py**", line 205, in restricted
>>
>>
>>
>> exec ccode in environment
>>   File 
>> "C:\web2py\applications\**metase**arch2\views\manage/**results.**html", 
>> line 86, in 
>>
>>
>> NameError: name 'results' is not defined
>>
>> Can anyone please tell me what's going on? If I run this program in 
>> IDLE it returns the bing results so it is definitely a web2py issue.
>>
>
>
>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com  - 
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread Bruce Wade
It shouldn't look at your javascript console, if you are using ajax to call
this.

On Thu, Jul 5, 2012 at 1:30 PM, adohertyd  wrote:

> Thanks Bruce will try that. Why does 'return blekkoresults' work though?
>
>
> On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:
>
>> Ok exactly it is complaining that {{=results}} does not exist.
>>
>> Reneed to return dict(results=something) from your results action in your
>> controller
>>
>> On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:
>>
>> This is my results.html, all of it :)
>>>
>>> {{extend 'layout.html'}}
>>>
>>> {{=results}}
>>>
>>> On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>>>
 I am assuming by your error inside results.html you have a variable
 defined as results however you are passing a tuple 
 blekkoresults,bingresults we would need to see results.html

 On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:

 No tried that and got 'unsupported format character 'A' at index 7'
>
>
> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>
>> Maybe you should encode your bing url.
>>
>> Richard
>>
>> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>>
>> I am trying to get a json response from 2 URL's and showing in on a
>>> results page. I'm getting an error saying that the page I'm redirecting 
>>> to
>>> in order to show the json data is not defined but this only happens with
>>> one of the url's being contacted. I'm probably not being very clear with
>>> this so I will show you some code:
>>>
>>>
>>> import urllib2
>>>
>>> def index():
>>> form = FORM(''...
>>> if form.process().accepted:
>>> session.term=request.vars.**query
>>> redirect(URL('results'))
>>> elif form.errors: ...
>>> return dict(form=form)
>>>
>>> def __process():
>>> term = session.term
>>> term = urllib2.quote("'" + term + "'")
>>> return dict(term=term)
>>>
>>> def results():
>>> import requests
>>>
>>> blekko = "http://www.blekko.com/?q=%(**term)s+/json&auth=
>>> " % __process()
>>> blekkoresults = urllib2.urlopen(blekko).read()
>>>
>>> bing = "https://api.datamarket.azure.**
>>> com/Data.ashx/Bing/SearchWeb/**Web?Query=%(term)s&$top=50&$**for
>>> mat=json"
>>> API_KEY = 'mykey'
>>> r = requests.get(bing % __process(), auth=('', API_KEY))
>>> bingresults = r.json
>>>
>>>return blekkoresults, bingresults
>>>
>>> The line 'bing= ' is causing the issue. If I comment out the bing
>>> section of the code, the blekko part returns no problem. However, with 
>>> the
>>> bing section included I get the following error:
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>>
>>> Traceback (most recent call last):
>>>   File "C:\web2py\gluon\restricted.**py", line 205, in restricted
>>>
>>>
>>>
>>> exec ccode in environment
>>>   File 
>>> "C:\web2py\applications\**metasearch2\views\manage/**results.**htm**l",
>>>  line 86, in 
>>>
>>>
>>> NameError: name 'results' is not defined
>>>
>>> Can anyone please tell me what's going on? If I run this program in
>>> IDLE it returns the bing results so it is definitely a web2py issue.
>>>
>>
>>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**bruc**elwade
 http://www.wadecybertech.com
 http://www.fittraineronline.**co**m - 
 Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com  -
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
Yeah it works now. Thanks very much Bruce much appreciated. Still have 
quite a bit to learn about all of this stuff.

On Thursday, 5 July 2012 21:32:10 UTC+1, Bruce Wade wrote:
>
> It shouldn't look at your javascript console, if you are using ajax to 
> call this.
>
> On Thu, Jul 5, 2012 at 1:30 PM, adohertyd wrote:
>
>> Thanks Bruce will try that. Why does 'return blekkoresults' work though?
>>
>>
>> On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:
>>
>>> Ok exactly it is complaining that {{=results}} does not exist.
>>>
>>> Reneed to return dict(results=something) from your results action in 
>>> your controller
>>>
>>> On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:
>>>
>>> This is my results.html, all of it :)

 {{extend 'layout.html'}}

 {{=results}}

 On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:

> I am assuming by your error inside results.html you have a variable 
> defined as results however you are passing a tuple 
> blekkoresults,bingresults we would need to see results.html
>
> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>
> No tried that and got 'unsupported format character 'A' at index 7'
>>
>>
>> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>>
>>> Maybe you should encode your bing url.
>>>
>>> Richard
>>>
>>> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>>>
>>> I am trying to get a json response from 2 URL's and showing in on a 
 results page. I'm getting an error saying that the page I'm 
 redirecting to 
 in order to show the json data is not defined but this only happens 
 with 
 one of the url's being contacted. I'm probably not being very clear 
 with 
 this so I will show you some code:


 import urllib2

 def index():
 form = FORM(''...  
 if form.process().accepted:
 session.term=request.vars.**query
  redirect(URL('results'))
 elif form.errors: ...
 return dict(form=form)

 def __process():
 term = session.term
 term = urllib2.quote("'" + term + "'")
 return dict(term=term)

 def results():
 import requests

 blekko = "http://www.blekko.com/?q=%(**term)s+/json&auth=
 " % __process()
 blekkoresults = urllib2.urlopen(blekko).read()

 bing = "https://api.datamarket.azure.**
 com/Data.ashx/Bing/SearchWeb/**Web?Query=%(term)s&$top=50&$**
 format=json"
 API_KEY = 'mykey'
 r = requests.get(bing % __process(), auth=('', API_KEY))
 bingresults = r.json

return blekkoresults, bingresults

 The line 'bing= ' is causing the issue. If I comment out the bing 
 section of the code, the blekko part returns no problem. However, with 
 the 
 bing section included I get the following error:

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

 Traceback (most recent call last):
   File "C:\web2py\gluon\restricted.**py", line 205, in restricted




 exec ccode in environment
   File 
 "C:\web2py\applications\**metasearch2\views\manage/**results.**htm**l",
  line 86, in 



 NameError: name 'results' is not defined

 Can anyone please tell me what's going on? If I run this program in 
 IDLE it returns the bing results so it is definitely a web2py issue.

>>>
>>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/**bruc**elwade
> http://www.wadecybertech.com
> http://www.fittraineronline.**co**m - 
> Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>
>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com  - 
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread Bruce Wade
No problem, I have ran into that problem when I was first learning :D

On Thu, Jul 5, 2012 at 1:34 PM, adohertyd  wrote:

> Yeah it works now. Thanks very much Bruce much appreciated. Still have
> quite a bit to learn about all of this stuff.
>
>
> On Thursday, 5 July 2012 21:32:10 UTC+1, Bruce Wade wrote:
>
>> It shouldn't look at your javascript console, if you are using ajax to
>> call this.
>>
>> On Thu, Jul 5, 2012 at 1:30 PM, adohertyd wrote:
>>
>> Thanks Bruce will try that. Why does 'return blekkoresults' work though?
>>>
>>>
>>> On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:
>>>
 Ok exactly it is complaining that {{=results}} does not exist.

 Reneed to return dict(results=something) from your results action in
 your controller

 On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:

 This is my results.html, all of it :)
>
> {{extend 'layout.html'}}
>
> {{=results}}
>
> On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>
>> I am assuming by your error inside results.html you have a variable
>> defined as results however you are passing a tuple 
>> blekkoresults,bingresults we would need to see results.html
>>
>> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>>
>> No tried that and got 'unsupported format character 'A' at index 7'
>>>
>>>
>>> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>>>
 Maybe you should encode your bing url.

 Richard

 On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:

 I am trying to get a json response from 2 URL's and showing in on a
> results page. I'm getting an error saying that the page I'm 
> redirecting to
> in order to show the json data is not defined but this only happens 
> with
> one of the url's being contacted. I'm probably not being very clear 
> with
> this so I will show you some code:
>
>
> import urllib2
>
> def index():
> form = FORM(''...
> if form.process().accepted:
> session.term=request.vars.**quer**y
>  redirect(URL('results'))
> elif form.errors: ...
> return dict(form=form)
>
> def __process():
> term = session.term
> term = urllib2.quote("'" + term + "'")
> return dict(term=term)
>
> def results():
> import requests
>
> blekko = "http://www.blekko.com/?q=%(**te**
> rm)s+/json&auth=" % __process()
> blekkoresults = urllib2.urlopen(blekko).read()
>
> bing = "https://api.datamarket.azure.
> com/Data.ashx/Bing/SearchWeb/**W**eb?Query=%(term)s&$top=50&$*
> *for**mat=json"
> API_KEY = 'mykey'
> r = requests.get(bing % __process(), auth=('', API_KEY))
> bingresults = r.json
>
>return blekkoresults, bingresults
>
> The line 'bing= ' is causing the issue. If I comment out the bing
> section of the code, the blekko part returns no problem. However, 
> with the
> bing section included I get the following error:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.**py**", line 205, in 
> restricted
>
>
>
>
> exec ccode in environment
>   File 
> "C:\web2py\applications\**metase**arch2\views\manage/**results.**html",
>  line 86, in 
>
>
>
> NameError: name 'results' is not defined
>
> Can anyone please tell me what's going on? If I run this program
> in IDLE it returns the bing results so it is definitely a web2py 
> issue.
>


>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com- 
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**bruc**elwade
 http://www.wadecybertech.com
 http://www.fittraineronline.**co**m - 
 Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com 

Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
Bruce,

One more thing, if I want to output the 2 sets of json data, how do I do 
it? return dict(results=bingresult...) I want to link the 3 results now

On Thursday, 5 July 2012 21:35:44 UTC+1, Bruce Wade wrote:
>
> No problem, I have ran into that problem when I was first learning :D
>
> On Thu, Jul 5, 2012 at 1:34 PM, adohertyd  wrote:
>
>> Yeah it works now. Thanks very much Bruce much appreciated. Still have 
>> quite a bit to learn about all of this stuff.
>>
>>
>> On Thursday, 5 July 2012 21:32:10 UTC+1, Bruce Wade wrote:
>>
>>> It shouldn't look at your javascript console, if you are using ajax to 
>>> call this.
>>>
>>> On Thu, Jul 5, 2012 at 1:30 PM, adohertyd wrote:
>>>
>>> Thanks Bruce will try that. Why does 'return blekkoresults' work though?


 On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:

> Ok exactly it is complaining that {{=results}} does not exist.
>
> Reneed to return dict(results=something) from your results action in 
> your controller
>
> On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:
>
> This is my results.html, all of it :)
>>
>> {{extend 'layout.html'}}
>>
>> {{=results}}
>>
>> On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>>
>>> I am assuming by your error inside results.html you have a variable 
>>> defined as results however you are passing a tuple 
>>> blekkoresults,bingresults we would need to see results.html
>>>
>>> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>>>
>>> No tried that and got 'unsupported format character 'A' at index 7'


 On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:

> Maybe you should encode your bing url.
>
> Richard
>
> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>
> I am trying to get a json response from 2 URL's and showing in on 
>> a results page. I'm getting an error saying that the page I'm 
>> redirecting 
>> to in order to show the json data is not defined but this only 
>> happens with 
>> one of the url's being contacted. I'm probably not being very clear 
>> with 
>> this so I will show you some code:
>>
>>
>> import urllib2
>>
>> def index():
>> form = FORM(''...  
>> if form.process().accepted:
>> session.term=request.vars.**quer**y
>>  redirect(URL('results'))
>> elif form.errors: ...
>> return dict(form=form)
>>
>> def __process():
>> term = session.term
>> term = urllib2.quote("'" + term + "'")
>> return dict(term=term)
>>
>> def results():
>> import requests
>>
>> blekko = "http://www.blekko.com/?q=%(**te**
>> rm)s+/json&auth=" % __process()
>> blekkoresults = urllib2.urlopen(blekko).read()
>>
>> bing = "https://api.datamarket.azure.
>> com/Data.ashx/Bing/SearchWeb/**W**eb?Query=%(term)s&$top=50&$
>> **for**mat=json"
>> API_KEY = 'mykey'
>> r = requests.get(bing % __process(), auth=('', API_KEY))
>> bingresults = r.json
>>
>>return blekkoresults, bingresults
>>
>> The line 'bing= ' is causing the issue. If I comment out the bing 
>> section of the code, the blekko part returns no problem. However, 
>> with the 
>> bing section included I get the following error:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.**py**", line 205, in 
>> restricted
>>
>>
>>
>>
>>
>> exec ccode in environment
>>   File 
>> "C:\web2py\applications\**metase**arch2\views\manage/**results.**html",
>>  line 86, in 
>>
>>
>>
>>
>> NameError: name 'results' is not defined
>>
>> Can anyone please tell me what's going on? If I run this program 
>> in IDLE it returns the bing results so it is definitely a web2py 
>> issue.
>>
>
>
>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com- 
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/**bruc**elwade

Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread Bruce Wade
return dict(results_1=first_results, results_2=second_results,
results_n=n_results) # You can have as many return values in the dictionary
that you want. (Maybe there is a limit but I have no idea what it is)
The dictionary names/keys can be whatever you want to call them.

Then in your results.html

{{=results_1}}
{{=results_2}}
{{=results_3}}

On Thu, Jul 5, 2012 at 1:41 PM, adohertyd  wrote:

> Bruce,
>
> One more thing, if I want to output the 2 sets of json data, how do I do
> it? return dict(results=bingresult...) I want to link the 3 results now
>
> On Thursday, 5 July 2012 21:35:44 UTC+1, Bruce Wade wrote:
>
>> No problem, I have ran into that problem when I was first learning :D
>>
>> On Thu, Jul 5, 2012 at 1:34 PM, adohertyd  wrote:
>>
>> Yeah it works now. Thanks very much Bruce much appreciated. Still have
>>> quite a bit to learn about all of this stuff.
>>>
>>>
>>> On Thursday, 5 July 2012 21:32:10 UTC+1, Bruce Wade wrote:
>>>
 It shouldn't look at your javascript console, if you are using ajax to
 call this.

 On Thu, Jul 5, 2012 at 1:30 PM, adohertyd wrote:

 Thanks Bruce will try that. Why does 'return blekkoresults' work though?
>
>
> On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:
>
>> Ok exactly it is complaining that {{=results}} does not exist.
>>
>> Reneed to return dict(results=something) from your results action in
>> your controller
>>
>> On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:
>>
>> This is my results.html, all of it :)
>>>
>>> {{extend 'layout.html'}}
>>>
>>> {{=results}}
>>>
>>> On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:
>>>
 I am assuming by your error inside results.html you have a variable
 defined as results however you are passing a tuple 
 blekkoresults,bingresults we would need to see results.html

 On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:

 No tried that and got 'unsupported format character 'A' at index 7'
>
>
> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>
>> Maybe you should encode your bing url.
>>
>> Richard
>>
>> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>>
>> I am trying to get a json response from 2 URL's and showing in on
>>> a results page. I'm getting an error saying that the page I'm 
>>> redirecting
>>> to in order to show the json data is not defined but this only 
>>> happens with
>>> one of the url's being contacted. I'm probably not being very clear 
>>> with
>>> this so I will show you some code:
>>>
>>>
>>> import urllib2
>>>
>>> def index():
>>> form = FORM(''...
>>> if form.process().accepted:
>>> session.term=request.vars.**query
>>>  redirect(URL('results'))
>>> elif form.errors: ...
>>> return dict(form=form)
>>>
>>> def __process():
>>> term = session.term
>>> term = urllib2.quote("'" + term + "'")
>>> return dict(term=term)
>>>
>>> def results():
>>> import requests
>>>
>>> blekko = "http://www.blekko.com/?q=%(**te
>>> rm)s+/json&auth=" % __process()
>>> blekkoresults = urllib2.urlopen(blekko).read()
>>>
>>> bing = "https://api.datamarket.azure.**
>>> com/Data.ashx/Bing/SearchWeb/**W
>>> eb?Query=%(term)s&$top=50&$**format=json"
>>> API_KEY = 'mykey'
>>> r = requests.get(bing % __process(), auth=('', API_KEY))
>>> bingresults = r.json
>>>
>>>return blekkoresults, bingresults
>>>
>>> The line 'bing= ' is causing the issue. If I comment out the
>>> bing section of the code, the blekko part returns no problem. 
>>> However, with
>>> the bing section included I get the following error:
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>>
>>> Traceback (most recent call last):
>>>   File "C:\web2py\gluon\restricted.**py", line 205, in 
>>> restricted
>>>
>>>
>>>
>>>
>>>
>>> exec ccode in environment
>>>   File 
>>> "C:\web2py\applications\**metasearch2\views\manage/**results.**htm**l",
>>>  line 86, in 
>>>
>>>
>>>
>>>
>>> NameError: name 'results' is not defined
>>>
>>> Can anyone please tell me what's going on? If I run this program
>>> in IDLE it returns the bing results so it is definitely a web2py 
>>> issue.
>>>
>>
>>>

[web2py] Best deployment scenario under Windows

2012-07-05 Thread Jim S
Hi

I'm deploying my app in a Windows environment.  

To answer the first obvious questions, it's because I have to connect to an 
IBM AS/400 database and ODBC connection is really tough for me on Linux. 
 So the question could be - How do I connect to DB2/400 from ubuntu, but I 
digress...

I'd like to force all users to an HTTPS connection, about 75 total for our 
in-house app.

I'm thinking that a solution utilizing nginx would be preferable, but it 
may be overkill for my user base.  

What is the best way to get this to happen?  Can I configure the Rocket web 
server to handle this, or would that be discouraged?

Any thoughts/input would really be appreciated.

-Jim


Re: [web2py] Redirect not working can't find issue

2012-07-05 Thread adohertyd
Brilliant that has made life so much easier. Thanks again Bruce

On Thursday, 5 July 2012 21:46:48 UTC+1, Bruce Wade wrote:
>
> return dict(results_1=first_results, results_2=second_results, 
> results_n=n_results) # You can have as many return values in the dictionary 
> that you want. (Maybe there is a limit but I have no idea what it is)
> The dictionary names/keys can be whatever you want to call them.
>
> Then in your results.html
>
> {{=results_1}}
> {{=results_2}}
> {{=results_3}}
>
> On Thu, Jul 5, 2012 at 1:41 PM, adohertyd wrote:
>
>> Bruce,
>>
>> One more thing, if I want to output the 2 sets of json data, how do I do 
>> it? return dict(results=bingresult...) I want to link the 3 results now
>>
>> On Thursday, 5 July 2012 21:35:44 UTC+1, Bruce Wade wrote:
>>
>>> No problem, I have ran into that problem when I was first learning :D
>>>
>>> On Thu, Jul 5, 2012 at 1:34 PM, adohertyd  wrote:
>>>
>>> Yeah it works now. Thanks very much Bruce much appreciated. Still have 
 quite a bit to learn about all of this stuff.


 On Thursday, 5 July 2012 21:32:10 UTC+1, Bruce Wade wrote:

> It shouldn't look at your javascript console, if you are using ajax to 
> call this.
>
> On Thu, Jul 5, 2012 at 1:30 PM, adohertyd wrote:
>
> Thanks Bruce will try that. Why does 'return blekkoresults' work 
>> though?
>>
>>
>> On Thursday, 5 July 2012 21:24:53 UTC+1, Bruce Wade wrote:
>>
>>> Ok exactly it is complaining that {{=results}} does not exist.
>>>
>>> Reneed to return dict(results=something) from your results action in 
>>> your controller
>>>
>>> On Thu, Jul 5, 2012 at 1:23 PM, adohertyd  wrote:
>>>
>>> This is my results.html, all of it :)

 {{extend 'layout.html'}}

 {{=results}}

 On Thursday, 5 July 2012 21:20:59 UTC+1, Bruce Wade wrote:

> I am assuming by your error inside results.html you have a 
> variable defined as results however you are passing a tuple 
> blekkoresults, bingresults we would need to see results.html
>
> On Thu, Jul 5, 2012 at 1:16 PM, adohertyd wrote:
>
> No tried that and got 'unsupported format character 'A' at index 7'
>>
>>
>> On Thursday, 5 July 2012 21:08:20 UTC+1, Richard wrote:
>>
>>> Maybe you should encode your bing url.
>>>
>>> Richard
>>>
>>> On Thu, Jul 5, 2012 at 4:05 PM, adohertyd wrote:
>>>
>>> I am trying to get a json response from 2 URL's and showing in 
 on a results page. I'm getting an error saying that the page I'm 
 redirecting to in order to show the json data is not defined but 
 this only 
 happens with one of the url's being contacted. I'm probably not 
 being very 
 clear with this so I will show you some code:


 import urllib2

 def index():
 form = FORM(''...  
 if form.process().accepted:
 session.term=request.vars.**query
  redirect(URL('results'))
 elif form.errors: ...
 return dict(form=form)

 def __process():
 term = session.term
 term = urllib2.quote("'" + term + "'")
 return dict(term=term)

 def results():
 import requests

 blekko = "http://www.blekko.com/?q=%(**te
 rm)s+/json&auth=" % __process()
 blekkoresults = urllib2.urlopen(blekko).read()

 bing = "https://api.datamarket.azure.**
 com/Data.ashx/Bing/SearchWeb/**W
 eb?Query=%(term)s&$top=50&$**format=json"
 API_KEY = 'mykey'
 r = requests.get(bing % __process(), auth=('', API_KEY))
 bingresults = r.json

return blekkoresults, bingresults

 The line 'bing= ' is causing the issue. If I comment out the 
 bing section of the code, the blekko part returns no problem. 
 However, with 
 the bing section included I get the following error:

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

 Traceback (most recent call last):
   File "C:\web2py\gluon\restricted.**py", line 205, in 
 restricted






 exec ccode in environment
   File 
 "C:\web2py\applications\**metasearch2\views\manage/**results.**htm**l",
  line 86, in 

>>

Re: [web2py] Best deployment scenario under Windows

2012-07-05 Thread Richard Vézina
I would not use Rocket for sure for kind of production app...

Apache works fine to me until now, but I plan to migrate to nginx soon when
I will find a good tutorial and when I get time :)

Richard

On Thu, Jul 5, 2012 at 4:48 PM, Jim S  wrote:

> Hi
>
> I'm deploying my app in a Windows environment.
>
> To answer the first obvious questions, it's because I have to connect to
> an IBM AS/400 database and ODBC connection is really tough for me on Linux.
>  So the question could be - How do I connect to DB2/400 from ubuntu, but I
> digress...
>
> I'd like to force all users to an HTTPS connection, about 75 total for our
> in-house app.
>
> I'm thinking that a solution utilizing nginx would be preferable, but it
> may be overkill for my user base.
>
> What is the best way to get this to happen?  Can I configure the Rocket
> web server to handle this, or would that be discouraged?
>
> Any thoughts/input would really be appreciated.
>
> -Jim
>


[web2py] [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Santiago
Hello,

Do you know why the same query, takes more than 40 minutes to get resolved 
using DAL and less than a second using raw SQL ?  

This is the code using DAL

db(db.voting_center).select()

This is the code using raw SQL

db.executesql('SELECT  voting_center.id, voting_center.election, 
voting_center.full_id_indra, voting_center.latitude, 
voting_center.longitude, voting_center.geometry, voting_center.circuit, 
voting_center.name, voting_center.identification, voting_center.cue, 
voting_center.annex, voting_center.source, voting_center.external_id, 
voting_center.locality, voting_center.address, voting_center.provisional, 
voting_center.definitive FROM voting_center WHERE (voting_center.id > 0);')

electoral-dev=# select count(1) from voting_center;
 count 
---
 66442
(1 row)

 Column |  Type  | 
Modifiers  | Storage  | Description 
+++--+-
 id | integer| not null default 
nextval('voting_center_id_seq'::regclass) | plain| 
 election   | integer| not null 
  | plain| 
 latitude   | character varying(512) | 
   | extended | 
 longitude  | character varying(512) | 
   | extended | 
 circuit| integer| 
   | plain| 
 identification | character varying(512) | not null 
  | extended | 
 cue| character varying(512) | 
   | extended | 
 annex  | character varying(512) | 
   | extended | 
 source | character varying(512) | 
   | extended | 
 external_id| character varying(512) | 
   | extended | 
 locality   | character varying(512) | 
   | extended | 
 address| character varying(512) | 
   | extended | 
 provisional| integer| 
   | plain| 
 definitive | integer| 
   | plain| 
 geometry   | geometry   | 
   | main | 
 name   | character varying(512) | not null 
  | extended | 
 full_id_indra  | character varying(12)  | 
   | extended | 

Thanks in advance
Santiago



Re: [web2py] [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Richard Vézina
This is a old version, I would suggest to try you app under at least to
1.99.4 and see if it improves.

Richard

On Thu, Jul 5, 2012 at 5:08 PM, Santiago  wrote:

> Hello,
>
> Do you know why the same query, takes more than 40 minutes to get resolved
> using DAL and less than a second using raw SQL ?
>
> This is the code using DAL
>
> db(db.voting_center).select()
>
> This is the code using raw SQL
>
> db.executesql('SELECT  voting_center.id, voting_center.election,
> voting_center.full_id_indra, voting_center.latitude,
> voting_center.longitude, voting_center.geometry, voting_center.circuit,
> voting_center.name, voting_center.identification, voting_center.cue,
> voting_center.annex, voting_center.source, voting_center.external_id,
> voting_center.locality, voting_center.address, voting_center.provisional,
> voting_center.definitive FROM voting_center WHERE (voting_center.id >
> 0);')
>
> electoral-dev=# select count(1) from voting_center;
>  count
> ---
>  66442
> (1 row)
>
>  Column |  Type  |
> Modifiers  | Storage  | Description
>
> +++--+-
>  id | integer| not null default
> nextval('voting_center_id_seq'::regclass) | plain|
>  election   | integer| not null
> | plain|
>  latitude   | character varying(512) |
>| extended |
>  longitude  | character varying(512) |
>| extended |
>  circuit| integer|
>| plain|
>  identification | character varying(512) | not null
> | extended |
>  cue| character varying(512) |
>| extended |
>  annex  | character varying(512) |
>| extended |
>  source | character varying(512) |
>| extended |
>  external_id| character varying(512) |
>| extended |
>  locality   | character varying(512) |
>| extended |
>  address| character varying(512) |
>| extended |
>  provisional| integer|
>| plain|
>  definitive | integer|
>| plain|
>  geometry   | geometry   |
>| main |
>  name   | character varying(512) | not null
> | extended |
>  full_id_indra  | character varying(12)  |
>| extended |
>
> Thanks in advance
> Santiago
>
>


Re: [web2py] [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Richard Vézina
Also, your request should not be : db().select(db.voting_center) instead of
db(db.voting_center).select()

Richard

On Thu, Jul 5, 2012 at 5:12 PM, Richard Vézina
wrote:

> This is a old version, I would suggest to try you app under at least to
> 1.99.4 and see if it improves.
>
> Richard
>
>
> On Thu, Jul 5, 2012 at 5:08 PM, Santiago wrote:
>
>> Hello,
>>
>> Do you know why the same query, takes more than 40 minutes to get
>> resolved using DAL and less than a second using raw SQL ?
>>
>> This is the code using DAL
>>
>> db(db.voting_center).select()
>>
>> This is the code using raw SQL
>>
>> db.executesql('SELECT  voting_center.id, voting_center.election,
>> voting_center.full_id_indra, voting_center.latitude,
>> voting_center.longitude, voting_center.geometry, voting_center.circuit,
>> voting_center.name, voting_center.identification, voting_center.cue,
>> voting_center.annex, voting_center.source, voting_center.external_id,
>> voting_center.locality, voting_center.address, voting_center.provisional,
>> voting_center.definitive FROM voting_center WHERE (voting_center.id >
>> 0);')
>>
>> electoral-dev=# select count(1) from voting_center;
>>  count
>> ---
>>  66442
>> (1 row)
>>
>>  Column |  Type  |
>> Modifiers  | Storage  | Description
>>
>> +++--+-
>>  id | integer| not null default
>> nextval('voting_center_id_seq'::regclass) | plain|
>>  election   | integer| not null
>> | plain|
>>  latitude   | character varying(512) |
>>  | extended |
>>  longitude  | character varying(512) |
>>  | extended |
>>  circuit| integer|
>>  | plain|
>>  identification | character varying(512) | not null
>> | extended |
>>  cue| character varying(512) |
>>  | extended |
>>  annex  | character varying(512) |
>>  | extended |
>>  source | character varying(512) |
>>  | extended |
>>  external_id| character varying(512) |
>>  | extended |
>>  locality   | character varying(512) |
>>  | extended |
>>  address| character varying(512) |
>>  | extended |
>>  provisional| integer|
>>  | plain|
>>  definitive | integer|
>>  | plain|
>>  geometry   | geometry   |
>>  | main |
>>  name   | character varying(512) | not null
>> | extended |
>>  full_id_indra  | character varying(12)  |
>>  | extended |
>>
>> Thanks in advance
>> Santiago
>>
>>
>


Re: [web2py] [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Richard Vézina
Also, also, pbreit had recently put into light that selecting only the
columns you need help to improve speed...

db().select(db.table.field1, db.table.field2) # better than
db().select(db.table.ALL)

Richard

On Thu, Jul 5, 2012 at 5:14 PM, Richard Vézina
wrote:

> Also, your request should not be : db().select(db.voting_center) instead
> of db(db.voting_center).select()
>
> Richard
>
>
> On Thu, Jul 5, 2012 at 5:12 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> This is a old version, I would suggest to try you app under at least to
>> 1.99.4 and see if it improves.
>>
>> Richard
>>
>>
>> On Thu, Jul 5, 2012 at 5:08 PM, Santiago wrote:
>>
>>> Hello,
>>>
>>>  Do you know why the same query, takes more than 40 minutes to get
>>> resolved using DAL and less than a second using raw SQL ?
>>>
>>> This is the code using DAL
>>>
>>> db(db.voting_center).select()
>>>
>>> This is the code using raw SQL
>>>
>>> db.executesql('SELECT  voting_center.id, voting_center.election,
>>> voting_center.full_id_indra, voting_center.latitude,
>>> voting_center.longitude, voting_center.geometry, voting_center.circuit,
>>> voting_center.name, voting_center.identification, voting_center.cue,
>>> voting_center.annex, voting_center.source, voting_center.external_id,
>>> voting_center.locality, voting_center.address, voting_center.provisional,
>>> voting_center.definitive FROM voting_center WHERE (voting_center.id >
>>> 0);')
>>>
>>> electoral-dev=# select count(1) from voting_center;
>>>  count
>>> ---
>>>  66442
>>> (1 row)
>>>
>>>  Column |  Type  |
>>> Modifiers  | Storage  | Description
>>>
>>> +++--+-
>>>  id | integer| not null default
>>> nextval('voting_center_id_seq'::regclass) | plain|
>>>  election   | integer| not null
>>>   | plain|
>>>  latitude   | character varying(512) |
>>>  | extended |
>>>  longitude  | character varying(512) |
>>>  | extended |
>>>  circuit| integer|
>>>  | plain|
>>>  identification | character varying(512) | not null
>>>   | extended |
>>>  cue| character varying(512) |
>>>  | extended |
>>>  annex  | character varying(512) |
>>>  | extended |
>>>  source | character varying(512) |
>>>  | extended |
>>>  external_id| character varying(512) |
>>>  | extended |
>>>  locality   | character varying(512) |
>>>  | extended |
>>>  address| character varying(512) |
>>>  | extended |
>>>  provisional| integer|
>>>  | plain|
>>>  definitive | integer|
>>>  | plain|
>>>  geometry   | geometry   |
>>>  | main |
>>>  name   | character varying(512) | not null
>>>   | extended |
>>>  full_id_indra  | character varying(12)  |
>>>  | extended |
>>>
>>> Thanks in advance
>>> Santiago
>>>
>>>
>>
>


[web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Anthony
After executing the query, the DAL processes the returned results in order 
to create a Rows object. That process takes longer the more fields and the 
more rows there are, but 40 minutes still sounds excessive for 66K rows. 
How long does it take if you do 
db.executesql(db(db.voting_center)._select()), which will run the SQL 
generated by the DAL but will not parse the results into a Rows object? 
What does your db.voting_center table definition look like? Any virtual 
fields (in particular, that do additional queries)?

Anthony

On Thursday, July 5, 2012 5:08:01 PM UTC-4, Santiago wrote:
>
> Hello,
>
> Do you know why the same query, takes more than 40 minutes to get resolved 
> using DAL and less than a second using raw SQL ?  
>
> This is the code using DAL
>
> db(db.voting_center).select()
>
> This is the code using raw SQL
>
> db.executesql('SELECT  voting_center.id, voting_center.election, 
> voting_center.full_id_indra, voting_center.latitude, 
> voting_center.longitude, voting_center.geometry, voting_center.circuit, 
> voting_center.name, voting_center.identification, voting_center.cue, 
> voting_center.annex, voting_center.source, voting_center.external_id, 
> voting_center.locality, voting_center.address, voting_center.provisional, 
> voting_center.definitive FROM voting_center WHERE (voting_center.id > 
> 0);')
>
> electoral-dev=# select count(1) from voting_center;
>  count 
> ---
>  66442
> (1 row)
>
>  Column |  Type  | 
> Modifiers  | Storage  | Description 
>
> +++--+-
>  id | integer| not null default 
> nextval('voting_center_id_seq'::regclass) | plain| 
>  election   | integer| not null   
> | plain| 
>  latitude   | character varying(512) | 
>| extended | 
>  longitude  | character varying(512) | 
>| extended | 
>  circuit| integer| 
>| plain| 
>  identification | character varying(512) | not null   
> | extended | 
>  cue| character varying(512) | 
>| extended | 
>  annex  | character varying(512) | 
>| extended | 
>  source | character varying(512) | 
>| extended | 
>  external_id| character varying(512) | 
>| extended | 
>  locality   | character varying(512) | 
>| extended | 
>  address| character varying(512) | 
>| extended | 
>  provisional| integer| 
>| plain| 
>  definitive | integer| 
>| plain| 
>  geometry   | geometry   | 
>| main | 
>  name   | character varying(512) | not null   
> | extended | 
>  full_id_indra  | character varying(12)  | 
>| extended | 
>
> Thanks in advance
> Santiago
>
>
On Thursday, July 5, 2012 5:08:01 PM UTC-4, Santiago wrote:
>
> Hello,
>
> Do you know why the same query, takes more than 40 minutes to get resolved 
> using DAL and less than a second using raw SQL ?  
>
> This is the code using DAL
>
> db(db.voting_center).select()
>
> This is the code using raw SQL
>
> db.executesql('SELECT  voting_center.id, voting_center.election, 
> voting_center.full_id_indra, voting_center.latitude, 
> voting_center.longitude, voting_center.geometry, voting_center.circuit, 
> voting_center.name, voting_center.identification, voting_center.cue, 
> voting_center.annex, voting_center.source, voting_center.external_id, 
> voting_center.locality, voting_center.address, voting_center.provisional, 
> voting_center.definitive FROM voting_center WHERE (voting_center.id > 
> 0);')
>
> electoral-dev=# select count(1) from voting_center;
>  count 
> ---
>  66442
> (1 row)
>
>  Column |  Type  | 
> Modifiers  | Storage  | Description 
>
> +++--+-
>  id | integer

Re: [web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Santiago Gilabert
db.executesql(db(db.voting_center)._select()) takes only a few seconds

It has one virtual field, but it is lazy. I think it is not necessary, but
I'm pasting the code below, is case you want to take a look.

class VotingCenterVirtualField(object):
  def delete_results(self):
def lazy(self=self):
  r1 = r2 = r3 = True

  if self.voting_center.definitive:
r = db.result(self.voting_center.definitive)
log_delete(r.as_dict())
r1 = r.delete_results() and r.delete_record()
  if self.voting_center.provisional:
r = db.result(self.voting_center.provisional)
log_delete(r.as_dict())
r2 = r.delete_results() and r.delete_record()

  for ps in self.voting_center.polling_station.select():
r3 = r3 and db.polling_station(ps.id).delete_results()

  return r1 and r2 and r3
return lazy

Thanks,
Regards
Santiago

On Thu, Jul 5, 2012 at 6:17 PM, Anthony  wrote:

> After executing the query, the DAL processes the returned results in order
> to create a Rows object. That process takes longer the more fields and the
> more rows there are, but 40 minutes still sounds excessive for 66K rows.
> How long does it take if you do
> db.executesql(db(db.voting_center)._select()), which will run the SQL
> generated by the DAL but will not parse the results into a Rows object?
> What does your db.voting_center table definition look like? Any virtual
> fields (in particular, that do additional queries)?
>
> Anthony
>
>
> On Thursday, July 5, 2012 5:08:01 PM UTC-4, Santiago wrote:
>>
>> Hello,
>>
>> Do you know why the same query, takes more than 40 minutes to get
>> resolved using DAL and less than a second using raw SQL ?
>>
>> This is the code using DAL
>>
>> db(db.voting_center).select()
>>
>> This is the code using raw SQL
>>
>> db.executesql('SELECT  voting_center.id, voting_center.election,
>> voting_center.full_id_indra, voting_center.latitude,
>> voting_center.longitude, voting_center.geometry, voting_center.circuit,
>> voting_center.name, voting_center.identification, voting_center.cue,
>> voting_center.annex, voting_center.source, voting_center.external_id,
>> voting_center.locality, voting_center.address, voting_center.provisional,
>> voting_center.definitive FROM voting_center WHERE (voting_center.id >
>> 0);')
>>
>> electoral-dev=# select count(1) from voting_center;
>>  count
>> ---
>>  66442
>> (1 row)
>>
>>  Column |  Type  |
>> Modifiers  | Storage  | Description
>> +-**---+--**
>> --**+--+--**---
>>  id | integer| not null default
>> nextval('voting_center_id_seq'**::regclass) | plain|
>>  election   | integer| not null
>> | plain|
>>  latitude   | character varying(512) |
>>  | extended |
>>  longitude  | character varying(512) |
>>  | extended |
>>  circuit| integer|
>>  | plain|
>>  identification | character varying(512) | not null
>> | extended |
>>  cue| character varying(512) |
>>  | extended |
>>  annex  | character varying(512) |
>>  | extended |
>>  source | character varying(512) |
>>  | extended |
>>  external_id| character varying(512) |
>>  | extended |
>>  locality   | character varying(512) |
>>  | extended |
>>  address| character varying(512) |
>>  | extended |
>>  provisional| integer|
>>  | plain|
>>  definitive | integer|
>>  | plain|
>>  geometry   | geometry   |
>>  | main |
>>  name   | character varying(512) | not null
>> | extended |
>>  full_id_indra  | character varying(12)  |
>>  | extended |
>>
>> Thanks in advance
>> Santiago
>>
>>
> On Thursday, July 5, 2012 5:08:01 PM UTC-4, Santiago wrote:
>>
>> Hello,
>>
>> Do you know why the same query, takes more than 40 minutes to get
>> resolved using DAL and less than a second using raw SQL ?
>>
>> This is the code using DAL
>>
>> db(db.voting_center).select()
>>
>> This is the code using raw SQL
>>
>> db.executesql('SELECT  voting_center.id, voting_center.election,
>> voting_center.full_id_indra, voting_center.latitude,
>> voting_center.longitude, voting_center.geometry, voting_center.circuit,
>> voting_center.name, voting_center.identification, voting_center.cue,
>> voting_center.annex, voting_center.source, voting_center.external_id,
>> voting_center.locality, v

[web2py] Updated deplopyment docs?

2012-07-05 Thread RKS
Are there any updated deployment docs available? At work we run web2py no 
problems but we have our own servers. At home, for all my testing sites, I 
use shared hosting. Below is some correspondence I've had today with my 
shared host:

[After emailing them the link to the deployment recipes in the 
documentation:]

"We have looked at the page and unfortunately it doesn't look like it
>> will work well with our shared Web hosting service. In particular we
>> don't support mod_wsgi and you wouldn't be able to run the web2py
>> built-in web server and proxy off to it either, since you don't have
>> root access or the ability to run daemons (so the two installation
>> methods they discuss in detail won't work).
>>
>> In fact the whole page assumes that you are installing Web2py on a
>> dedicated or virtual private server rather than a shared Web hosting
>> server. So it's likely that there would be other problems as well."
>>
>
[After forwarding the section on mod_python:]

"Unfortunately, no -- we don't use mod_python, mod_wsgi, or any of the
>> other things mentioned on that page. In our experience,few shared
>> hosting providers use either mod_python or mod_wsgi now, which makes us
>> think that page is perhaps outdated, to be honest.
>>
>> We're very sorry about that. I wish we had a better answer! We had
>> several people here review what they suggest, though, and we're sure
>> that none of those options will work on our servers. It really does seem
>> like you probably need to use a Virtual Private Server or a dedicated
>> server to run that software."
>>
>
So are there any updated instructions on deployment? I'm really just 
looking to have a live testing bed where I can load w2p applications and 
view them from external services like browserlabs etc. Hence the need for 
it to be live. With this host I do have shell access but no sudo or Apache 
config permissions. They're running the latest apache and are already set 
up to support Django and run several django sites already, so I think w2p 
is certainly doable there.


[web2py] Re: MySQL migration fails adding unique=

2012-07-05 Thread MichaelF
Thanks for that. I didn't realize field-level migrations don't work with 
MySQL. I'm no expert on web2py migrations (or even web2py!); is it just 
with MySQL that it has these problems?

I suppose I could do this as an alternative to what you suggested: In 
web2py add a new field with unique, then in MySQL UPDATE all records, 
setting newField = oldField. I'd have to handle duplicates here, but at 
least I wouldn't lost all my data. Then, when satisfied, delete oldField 
and maybe rename newField to oldField.

On Thursday, July 5, 2012 12:26:31 PM UTC-6, Jim S wrote:
>
> I believe that field level migrations do not work with MySQL.  I get 
> around this by removing the column, saving, run the app to force migration, 
> and then add the field back the way I want it.  I know this causes you to 
> lose the data in that column, but I only do this in my test environment and 
> have migrations turned off in production.
>
> Alternatively, you could update the column def in web2py, change manually 
> in mysql and then run with migrate=False, fake_migrate=True to get things 
> back in sync.
>
> Hope that helps.
>
> -Jim
>
> On Wednesday, July 4, 2012 10:29:10 AM UTC-5, MichaelF wrote:
>>
>> I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 
>> 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
>> (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
>> to add `unique=True` the web2py migration fails with this error: `"> 'exceptions.KeyError'> 'institution_name'"` where institution_name is the 
>> name of the field in question.
>>
>> I've recreated the problem using a single-table application in web2py 
>> using MySQL. Here's the model code:
>>
>> To start off (field not defined as unique):
>>
>> ... (usual model/db.py boilerplate)
>> db = DAL('mysql://w2ptest:abcde...@mysql5.server.com:3307/abc_web2py
>> ')
>> ...
>> db.define_table('Institution',
>> Field('Institution_name', 'string', length=60, 
>> required=True),
>> format='%(Institution_name)s')
>>
>> I go to the appadmin page and everything looks fine. Then, making 
>> Institution_name unique:
>>
>> db.define_table('Institution',
>> Field('Institution_name', 'string', length=60, 
>> required=True,
>>unique=True),
>> format='%(Institution_name)s')
>>
>> I then refresh the appadmin page and get a ticket with the error. The 
>> error line in the traceback is the last line of the modified statement 
>> above. And, to make things worse, I can go in and undo the `unique=True`, 
>> but web2py doesn't respond if I refresh the appadmin page...or any page 
>> served by that web server, even in other applications! The cpu is 
>> not pinned while in this state. I have to recreate the app and 
>> database to clear the problem. (Well, I think I have to go that far. Just 
>> restarting web2py doesn't clear it in the full case, but does clear it in 
>> my little one-table test case.) I try to stop the server 
>> (web2py_no_console.exe), but it fails to respond.
>>
>> Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
>> abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
>> but I'd rather not, particularly as then I have to `try` that statement 
>> because MySQL has no `...IF NOT EXIST...` capability for index creation.
>>
>> Also, if I start off the model with `unique=True` in the first place, 
>> everything is fine, and MySQL even shows the unique index as created.
>>
>>

Re: [web2py] [Version 1.96.4] DAL timing issue.

2012-07-05 Thread Anthony

>
> Also, your request should not be : db().select(db.voting_center) instead 
> of db(db.voting_center).select()


If he wants to select all records and all fields, then 
db(db.voting_center).select() is the correct query.

Anthony 


[web2py] Re: Best practice using scheduler as a task queue?

2012-07-05 Thread nick name
This might have been solved in this week, but in case it wasn't:

You're tackling a general database problem, not a specific task queue or 
web2py problem. So you need to solve it with the database: set up another 
table to refer to you the task table, such as:

db.define_table('tasks_that_were_set_up', 
   Field('name', 'string', unique=true),
   Field('scheduler', db.scheduler_task, notnull=True, required=True, 
unique=True, ondelete='CASCADE'),
)

Make your insert code insert a task to this table as well:

try:
 rid = db.scheduler_task.insert(name='task7',)
 db.tasks_that_were_set_up.insert(name='task7', scheduler=rid)
 print 'Task was just added to db'
except db.integrity_error_class():
 print 'Tasks were already in db */

Now, if the task gets removed from the scheduler_task table, because of the 
cascading on_delete (which is the default - I just put it there for 
emphasis), the record in tasks_that_were_set_up will be removed as well.
And otherwise, because of the unique constraint, the insert to 
tasks_that_were_set_up can only succeed once -- and thanks to the 
transaction nature -- therefore so does scheduler_task.insert.



Re: [web2py] Re: Thinking of building a bug tracker...

2012-07-05 Thread Derek
It's got a lot more issues than that. It's pretty unusable at the moment. 
After you get it working, then you have to assign projects to people via ID 
number, and vice versa. You have to edit the database to get all new people 
loaded into the system (ie - there is no custom admin module to promote 
users to managers, etc). It's not a viable project, only there to show you 
what you can do if you half-ass a project to complete a poorly designed 
issue tracker.

On Thursday, July 5, 2012 8:38:36 AM UTC-7, Richard wrote:
>
> Hello,
>
> Here a patch for web2py_issuetracker...
> I didn't read the whole app, so I hope it still works as intended.
>
>
> # HG changeset patch
> # User Richard Vézina 
> # Date 1341502246 14400
> # Node ID d4a6372008825fa571f3f7b021b3e79fab7e7df4
> # Parent  e4535bcdef395d6e8b1f777e8466e1fc74a2d0d1
> Fix not working app
>
> diff -r e4535bcdef39 -r d4a637200882 controllers/default.py
> --- a/controllers/default.py mar nov 01 08:23:10 2011 -0500
> +++ b/controllers/default.py jeu jui 05 11:30:46 2012 -0400
> @@ -18,11 +18,15 @@
>  
>  
>  def projects():
> -COLUMNS=('project.name
> ','project.author','project.repo','project.license')
> -LINKS=[lambda row: A('issues',_href=URL('issues',args=row.id))]
> +FIELDS=[db.project.name,
> +db.project.author,
> +db.project.repo,
> +db.project.license,
> +db.project.created_by] # created_by seems to be required in 
> the fields list
> +LINKS=[lambda row: A('issues', _href=URL('issues', args=row.id))]
>  def check(row): return (row.created_by == auth.user_id)
> -grid = SQLFORM.grid(db.project,editable=check,deletable=check,
> -columns = COLUMNS,links=LINKS)
> +grid = SQLFORM.grid(db.project, editable=check, deletable=check,
> +fields = FIELDS, field_id=db.project.id, 
> links=LINKS)
>  return dict(grid=grid)
>  
>  def issues():
> @@ -49,13 +53,17 @@
>  auth.user.email in (project.members_email or [])):
>  db.issue.owner.writable = False
>  db.issue.status.writable = False
> -COLUMNS=('issue.status','issue.summary','issue.created_on',
> - 'issue.author','issue.labels')
> -LINKS=[lambda row: A('issue',_href=URL('issue',args=row.uuid))]
> -grid = SQLFORM.grid(query, columns = COLUMNS,links=LINKS,
> -details=False,editable=False,
> +FIELDS=[db.issue.status,
> +db.issue.summary,
> +db.issue.created_on,
> +db.issue.author,
> +db.issue.labels,
> +db.issue.uuid] # uuid seems to be required in the fields list
> +LINKS=[lambda row: A('issue', _href=URL('issue', args=row.uuid))]
> +grid = SQLFORM.grid(query, fields = FIELDS, links=LINKS,
> +details=False, editable=False,
>  deletable=project.created_on==auth.user_id,
> -create=auth.user_id,args=[project.id],
> +create=auth.user_id, args=[project.id],
>  oncreate=lambda form:do_mail([db.issue(
> form.vars.id)]))
>  return dict(grid=grid, project=project)
>  
>
> I will open a ticket on google code and post it there too, in case this 
> mail get lost.
>
> Richard
>
> On Sat, Jun 2, 2012 at 3:26 PM, Anthony  wrote:
>
>> Yes, that's one of Julio's, creator of http://www.qa-stack.com/ and 
>> http://pyforum.org/. All three are listed on the Powered By site.
>>
>> Anthony
>>
>>
>> On Saturday, June 2, 2012 3:13:40 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> I had not seen it. Looks really slick.
>>>
>>> On Friday, 1 June 2012 23:49:31 UTC-5, Bruce Wade wrote:

 i-track is the winner I already have it integrated into my project and 
 will build off of it.

 On Fri, Jun 1, 2012 at 7:01 AM, Bruce Wade wrote:

> issue tracker there is an error when you click on projects on the demo 
> not a good example :D
> i-track looks like a very good starting point if we want to build of 
> an existing product.
>
>
> On Fri, Jun 1, 2012 at 12:37 AM, Jason (spot) Brower <
> encomp...@gmail.com> wrote:
>
>> issue tracker I know of... 
>> I am looking at itracker now
>> Thanks. :)
>>
>>
>> On Fri, Jun 1, 2012 at 10:31 AM, stefaan wrote:
>>
>>>
>>>
>>>
>>> I have noticed one other tracker in web2py, but I couldn't demo it. 

 Have you seen these? 
>>>
>>> http://code.google.com/p/**web2py-issuetracker/
>>> http://www.i-track.org/ 
>>>
>>>
>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/**brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.**com  - 
> Fitness Personal Trainers Online
> http://www.war

[web2py] Re: Updated deplopyment docs?

2012-07-05 Thread pbreit
Deploying any Python on shared hosting is difficult because Python is 
generally poorly supported in shared hosting environments.

Does your host provide any information about deploying Python apps?


Re: [web2py] Re: Updated deplopyment docs?

2012-07-05 Thread Bruce Wade
You can install your own version of python in your home directory on most
shared host environments then at that point it doesn't matter which python
version they use.

On Thu, Jul 5, 2012 at 4:00 PM, pbreit  wrote:

> Deploying any Python on shared hosting is difficult because Python is
> generally poorly supported in shared hosting environments.
>
> Does your host provide any information about deploying Python apps?
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Customizing Auth to work with legacy db & app

2012-07-05 Thread Jerry
Hello,

We have a legacy Cold Fusion app running off a MS SQL db server and plan to 
gradually move functionality from CF to web2py.
Both systems will run concurrently, accessing the same db.
Thanks to the web2py (awesome piece of software! thank you Massimo and the 
other contributors!) DAL, we can access the legacy database no problem.

The db has a User table with fields like:
FirstName, LastName, Email, Password etc.
The field names do not match the names used in web2py 
auth.settings.table_user_name (first_name, last_name, email, passwd etc.)

We would love to use web2py Auth for login/register/profile forms, 
decoration of controller actions with @auth, and handling password resets.

It looks like there will be a lot of customization of the Auth settings to 
get it to work with our legacy database.
The only alternative I can think of is not using Auth at all. Everything 
custom - our own login form, register page, password reset - and we don't 
get @auth. decorators.

What would you recommend? I'm guessing this has been done before but I 
haven't found a solution.
Is there another way of doing this that makes more sense?

Thanks in advance,

Jerry.


Re: [web2py] Customizing Auth to work with legacy db & app

2012-07-05 Thread vinicius...@gmail.com

Hi Jerry.

You can define a db object to connect just to your auth table on MS SQL.
This way, you can customize Auth to your needs.

Remember web2py, by default, store passwords crypted (see CRYPT 
validator). If it's not your scenario, you'll need to override this 
implementation.


A few months ago I needed to customize Auth. I inherited from the 
original and implemented my own methods like loging user in without 
password (in a very special situation), and registering them making 
integration with other tables.


By the way, you'll need to check if the web2py RBAC is enough for you. 
Maybe you'll have to make it use tables used today by your legacy system.


So, I recommend you to customize Auth and enjoy all web2py 
authentication and authorization infrastructure.


--
Vinicius Assef



On 07/05/2012 06:04 PM, Jerry wrote:

Hello,

We have a legacy Cold Fusion app running off a MS SQL db server and plan
to gradually move functionality from CF to web2py.
Both systems will run concurrently, accessing the same db.
Thanks to the web2py (awesome piece of software! thank you Massimo and
the other contributors!) DAL, we can access the legacy database no problem.

The db has a User table with fields like:
FirstName, LastName, Email, Password etc.
The field names do not match the names used in web2py
auth.settings.table_user_name (first_name, last_name, email, passwd etc.)

We would love to use web2py Auth for login/register/profile forms,
decoration of controller actions with @auth, and handling password resets.

It looks like there will be a lot of customization of the Auth settings
to get it to work with our legacy database.
The only alternative I can think of is not using Auth at all. Everything
custom - our own login form, register page, password reset - and we
don't get @auth. decorators.

What would you recommend? I'm guessing this has been done before but I
haven't found a solution.
Is there another way of doing this that makes more sense?

Thanks in advance,

Jerry.




[web2py] Re: Rocket server truncating long responses

2012-07-05 Thread Massimo Di Pierro
I never actually saw that issue. I thought the official rocket repo was on 
launchpad. I was not aware it moved to github. Anyway, I have implemented 
your suggested correction (increased timeout and caching exception)

Massimo

On Thursday, 5 July 2012 12:49:48 UTC-5, nick name wrote:
>
> On Tuesday, June 26, 2012 3:43:16 PM UTC-4, Massimo Di Pierro wrote:
>>
>> If you can reproduce. Chould you try wireshark to do a packet capture? I 
>> would like to see what is going on.
>> Tim is a new dad and has not been responsive. I will try an attempt to 
>> fix this myself (although I cannot repcoduce it) else we wil revert to 
>> cherrypy. 
>>
>
> I was away for a couple of weeks and only now catching up.
>
> I've posted the instructions to reproduce this several times, e.g. 
> https://github.com/explorigin/Rocket/issues/1#issuecomment-3734231 ; I've 
> just noticed that Tim actually checked in the changes I suggested into the 
> Rocket source on github <
> https://github.com/explorigin/Rocket/commit/fd5e63e1036274d50c48184bdf4c230f17a67e7e>
>  
> , but as far as I remember, they didn't actually solve the problem - only 
> helped reliable demonstrate that they are happening (and when).
>
> I don't think the packet capture will be helpful -- dropping of data 
> happens inside Python's sendall() and Rocket's handling of that.
>
> I will reapply my patch that Tim adopted later this week and try to 
> recreate to see if the problem is solved.
>


[web2py] Re: Standalone DAL leaves mysql connections opened

2012-07-05 Thread Massimo Di Pierro
Looks like I prematurely close the issue. There is now a db.close() in 
trunk. Please check it out.

massimo

On Thursday, 5 July 2012 13:05:47 UTC-5, nick name wrote:
>
> On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote:
>>
>> why not simply?
>>
>> db.commit()
>> db.close()
>>
>> if db in an on object attribute like self.db you can do
>>
>> if self.db:
>>self.db.commit()
>>self.db.close()
>>self.db = 0
>>
>> you can also do:
>>
>> BaseAdapter.close_all_instances('commit')
>>
>
> This is not enough, as was documented on issue  
> http://code.google.com/p/web2py/issues/detail?id=731.
>  
> The code that works for me for sqlite is as follows:
>
> def closebase(base):
> if not base: return
> # see: http://code.google.com/p/web2py/issues/detail?id=731
> # see: https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion
> # was: base._adapter.close()
> from gluon.dal import thread
> thread.instances.remove(base._adapter)
> base._adapter.close()
>
> and then I call closebase(db); db = None which is enough for me with 
> sqlite -- but apparently, the original poster has tried that, and that is 
> not sufficient for mysql.
>


[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread Massimo Di Pierro
I did not know you were storing it in a blob. Try:


def getImage(url,db): 
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = {'User-Agent': user_agent}

req = urllib2.Request(url,"",headers)

try:
response = urllib2.urlopen(req)
except urllib2.URLError, e:
if hasattr(e, 'reason'):
print 'We failed to reach a server.'
print 'Reason: ', e.reason
elif hasattr(e, 'code'):
print 'The server couldn\'t fulfill the request.'
print 'Error code: ', e.code
id = 
db.image.insert(url=url,image_uplaod=db.image.image_upload.store(response,filename=url))
db.commit() # not sure if needed, depends on where executed
return id

def imageLookup():
id = request.vars.id
response.headers['Content-Type']='image/jpeg' 
return db.image[id].image_file

On Thursday, 5 July 2012 14:16:55 UTC-5, RCTYCO wrote:
>
> Thank you for the quick response.
>
> I added the lines above : (  id = 
> db.image.insert(url=url,image=db.image.image_upload.store(response,filename=url))
> db.commit() )
>
> It uploaded the information (url and renamed the file) but I don't believe 
> it upload the image to the database.
>
> This is what it uploaded. Image_file is empty. 
> id,url,image_upload,image_file
> '1', 'http://eandata.com/image/products/000/000/015/000151122.jpg', 
> 'image.image_upload.94df8d0ebb1047e0.303030303030303135313132322e6a7067.jpg', 
> 
>
> This is my model.
> Model
> db.define_table('image',
> Field('url','string'),
> Field('image_upload','upload',uploadfield='image_file'),
> Field('image_file','blob'))
>
> Any suggestions?
>


[web2py] Re: MySQL migration fails adding unique=

2012-07-05 Thread Massimo Di Pierro
It is not like that field level migrations do not work. They work if, for 
example you change a field type. They do not work it you change an 
attribute (unique, notnull).

On Thursday, 5 July 2012 16:40:42 UTC-5, MichaelF wrote:
>
> Thanks for that. I didn't realize field-level migrations don't work with 
> MySQL. I'm no expert on web2py migrations (or even web2py!); is it just 
> with MySQL that it has these problems?
>
> I suppose I could do this as an alternative to what you suggested: In 
> web2py add a new field with unique, then in MySQL UPDATE all records, 
> setting newField = oldField. I'd have to handle duplicates here, but at 
> least I wouldn't lost all my data. Then, when satisfied, delete oldField 
> and maybe rename newField to oldField.
>
> On Thursday, July 5, 2012 12:26:31 PM UTC-6, Jim S wrote:
>>
>> I believe that field level migrations do not work with MySQL.  I get 
>> around this by removing the column, saving, run the app to force migration, 
>> and then add the field back the way I want it.  I know this causes you to 
>> lose the data in that column, but I only do this in my test environment and 
>> have migrations turned off in production.
>>
>> Alternatively, you could update the column def in web2py, change manually 
>> in mysql and then run with migrate=False, fake_migrate=True to get things 
>> back in sync.
>>
>> Hope that helps.
>>
>> -Jim
>>
>> On Wednesday, July 4, 2012 10:29:10 AM UTC-5, MichaelF wrote:
>>>
>>> I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 
>>> 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
>>> (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
>>> to add `unique=True` the web2py migration fails with this error: `">> 'exceptions.KeyError'> 'institution_name'"` where institution_name is the 
>>> name of the field in question.
>>>
>>> I've recreated the problem using a single-table application in web2py 
>>> using MySQL. Here's the model code:
>>>
>>> To start off (field not defined as unique):
>>>
>>> ... (usual model/db.py boilerplate)
>>> db = DAL('mysql://w2ptest:abcde...@mysql5.server.com:3307/abc_web2py
>>> ')
>>> ...
>>> db.define_table('Institution',
>>> Field('Institution_name', 'string', length=60, 
>>> required=True),
>>> format='%(Institution_name)s')
>>>
>>> I go to the appadmin page and everything looks fine. Then, making 
>>> Institution_name unique:
>>>
>>> db.define_table('Institution',
>>> Field('Institution_name', 'string', length=60, 
>>> required=True,
>>>unique=True),
>>> format='%(Institution_name)s')
>>>
>>> I then refresh the appadmin page and get a ticket with the error. The 
>>> error line in the traceback is the last line of the modified statement 
>>> above. And, to make things worse, I can go in and undo the `unique=True`, 
>>> but web2py doesn't respond if I refresh the appadmin page...or any page 
>>> served by that web server, even in other applications! The cpu is 
>>> not pinned while in this state. I have to recreate the app and 
>>> database to clear the problem. (Well, I think I have to go that far. Just 
>>> restarting web2py doesn't clear it in the full case, but does clear it in 
>>> my little one-table test case.) I try to stop the server 
>>> (web2py_no_console.exe), but it fails to respond.
>>>
>>> Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
>>> abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
>>> but I'd rather not, particularly as then I have to `try` that statement 
>>> because MySQL has no `...IF NOT EXIST...` capability for index creation.
>>>
>>> Also, if I start off the model with `unique=True` in the first place, 
>>> everything is fine, and MySQL even shows the unique index as created.
>>>
>>>

[web2py] please help us test web2py

2012-07-05 Thread Massimo Di Pierro
There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL 
please help us check the new trunk did not break anything.

We have salted password auth = Auth(...,salt=True). Check it out. 

We also have ability to deploy to openstack from admin.

Thanks to all those who have and still are putting lots of time on this.

massimo


[web2py] Re: When does translation take place.

2012-07-05 Thread Annet
Thanks for your replies. 

... and it will also be translated when you apply any operators, such as 
> testing for equality, concatenation, length, etc. So, T('Timetable') == 
> 'Timetable' will be False unless the translation language is English.
>

I'll leave the fields and menu item names as they are.


Kind regards,

Annet 


Re: [web2py] Re: RFC: web2py-based workflow engine

2012-07-05 Thread Andrew
Hi Ross,
How's the workflow engine going ?

Regards
Andrew W


[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread RCTYCO
Thanks.

I need to solve the problem of the file not been uploaded to the blob field.

I believe i am doing it correctly.

I defined the model 
db.define_table('image',
Field('url','string'),
Field('image_file','blob'),
Field('image_upload','upload',uploadfield='image_file'))


I stepped through the code for the store function 
(db.image.image_upload.store(response,filename=url))).

I expect line 7345 to turn out to be true to it eval to false. So my file 
is never uploaded to the blob file. 
File: gluon.dal

Line 7345:   if isinstance(self.uploadfield,Field):
Line 7346:blob_uploadfield_name = self.uploadfield.uploadfield
Line 7347:keys={self.uploadfield.name: newfilename,
Line 7348:  blob_uploadfield_name: file.read()}
Line 7349:self.uploadfield.table.insert(**keys)


I am assuming that I am messing up my define_table. Or I am using the wrong 
field when i call the store function. 



On Thursday, July 5, 2012 7:36:39 PM UTC-7, Massimo Di Pierro wrote:
>
> I did not know you were storing it in a blob. Try:
>
>
> def getImage(url,db): 
> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
> headers = {'User-Agent': user_agent}
> 
> req = urllib2.Request(url,"",headers)
> 
> try:
> response = urllib2.urlopen(req)
> except urllib2.URLError, e:
> if hasattr(e, 'reason'):
> print 'We failed to reach a server.'
> print 'Reason: ', e.reason
> elif hasattr(e, 'code'):
> print 'The server couldn\'t fulfill the request.'
> print 'Error code: ', e.code
> id = 
> db.image.insert(url=url,image_uplaod=db.image.image_upload.store(response,filename=url))
> db.commit() # not sure if needed, depends on where executed
> return id
>
> def imageLookup():
> id = request.vars.id
> response.headers['Content-Type']='image/jpeg' 
> return db.image[id].image_file
>
> On Thursday, 5 July 2012 14:16:55 UTC-5, RCTYCO wrote:
>>
>> Thank you for the quick response.
>>
>> I added the lines above : (  id = 
>> db.image.insert(url=url,image=db.image.image_upload.store(response,filename=url))
>> db.commit() )
>>
>> It uploaded the information (url and renamed the file) but I don't 
>> believe it upload the image to the database.
>>
>> This is what it uploaded. Image_file is empty. 
>> id,url,image_upload,image_file
>> '1', 'http://eandata.com/image/products/000/000/015/000151122.jpg', 
>> 'image.image_upload.94df8d0ebb1047e0.303030303030303135313132322e6a7067.jpg',
>>  
>> 
>>
>> This is my model.
>> Model
>> db.define_table('image',
>> Field('url','string'),
>> Field('image_upload','upload',uploadfield='image_file'),
>> Field('image_file','blob'))
>>
>> Any suggestions?
>>
>

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread RCTYCO
Do I have to do something like 

db.define_table('image',
Field('url','string'),
Field('image_file','blob'),
Field('image_upload','upload',uploadfield= 
Field('image_file','blob'))

Where i provided a filed in the uploadfield

On Thursday, July 5, 2012 10:30:22 PM UTC-7, RCTYCO wrote:
>
> Thanks.
>
> I need to solve the problem of the file not been uploaded to the blob 
> field.
>
> I believe i am doing it correctly.
>
> I defined the model 
> db.define_table('image',
> Field('url','string'),
> Field('image_file','blob'),
> Field('image_upload','upload',uploadfield='image_file'))
>
>
> I stepped through the code for the store function 
> (db.image.image_upload.store(response,filename=url))).
>
> I expect line 7345 to turn out to be true to it eval to false. So my file 
> is never uploaded to the blob file. 
> File: gluon.dal
>
> Line 7345:   if isinstance(self.uploadfield,Field):
> Line 7346:blob_uploadfield_name = self.uploadfield.uploadfield
> Line 7347:keys={self.uploadfield.name: newfilename,
> Line 7348:  blob_uploadfield_name: file.read()}
> Line 7349:self.uploadfield.table.insert(**keys)
>
>
> I am assuming that I am messing up my define_table. Or I am using the 
> wrong field when i call the store function. 
>
>
>
> On Thursday, July 5, 2012 7:36:39 PM UTC-7, Massimo Di Pierro wrote:
>>
>> I did not know you were storing it in a blob. Try:
>>
>>
>> def getImage(url,db): 
>> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
>> headers = {'User-Agent': user_agent}
>> 
>> req = urllib2.Request(url,"",headers)
>> 
>> try:
>> response = urllib2.urlopen(req)
>> except urllib2.URLError, e:
>> if hasattr(e, 'reason'):
>> print 'We failed to reach a server.'
>> print 'Reason: ', e.reason
>> elif hasattr(e, 'code'):
>> print 'The server couldn\'t fulfill the request.'
>> print 'Error code: ', e.code
>> id = 
>> db.image.insert(url=url,image_uplaod=db.image.image_upload.store(response,filename=url))
>> db.commit() # not sure if needed, depends on where executed
>> return id
>>
>> def imageLookup():
>> id = request.vars.id
>> response.headers['Content-Type']='image/jpeg' 
>> return db.image[id].image_file
>>
>> On Thursday, 5 July 2012 14:16:55 UTC-5, RCTYCO wrote:
>>>
>>> Thank you for the quick response.
>>>
>>> I added the lines above : (  id = 
>>> db.image.insert(url=url,image=db.image.image_upload.store(response,filename=url))
>>> db.commit() )
>>>
>>> It uploaded the information (url and renamed the file) but I don't 
>>> believe it upload the image to the database.
>>>
>>> This is what it uploaded. Image_file is empty. 
>>> id,url,image_upload,image_file
>>> '1', 'http://eandata.com/image/products/000/000/015/000151122.jpg', 
>>> 'image.image_upload.94df8d0ebb1047e0.303030303030303135313132322e6a7067.jpg',
>>>  
>>> 
>>>
>>> This is my model.
>>> Model
>>> db.define_table('image',
>>> Field('url','string'),
>>> Field('image_upload','upload',uploadfield='image_file'),
>>> Field('image_file','blob'))
>>>
>>> Any suggestions?
>>>
>>

[web2py] Re: {{=LOAD()}} and JavaScript function

2012-07-05 Thread Annet
Hi Anthony,

I believe that's what my code does. This line:
>
> {{show_tab = this_tab if not show_tab else show_tab}}
>
> sets the value of show_tab to the first tab (if any) that gets written to 
> the view. Is that not what you want?
>

Yes, that's what I want, however, I also want the content of the first tab 
if any to be loaded. This is what the code does:


  
  
  
 


This is what it should do:


  
Text
Table content
  
  
  
 

 
Kind regards,

Annet