Re: [web2py] web2py python3

2020-11-01 Thread Neil
For anyone else who runs into this. I had this problem when migrating from 
py2 to py3. Clearing out the errors folder worked for me. 

On Wednesday, 13 May 2020 at 06:27:40 UTC-7 roge...@gmail.com wrote:

> Does this help?
>
> https://stackoverflow.com/questions/39146039/pickle-typeerror-a-bytes-like-object-is-required-not-str
>   
>
> On Wed, 13 May 2020 at 04:43, patito feo  wrote:
>
>> Hi,
>>
>> Having this error when using python3.
>>
>>  File "//web2py/applications/admin/controllers/default.py" 
>> , 
>> line 1627, in errors
>> error = pickle.load(fullpath_file)
>>   File "/ 
>> /web2py/gluon/html.py",
>>  line 692, in XML_unpickle
>> return XML(marshal.loads(data))
>> TypeError: a bytes-like object is required, not 'str'
>>
>> Any ideas?
>>
>> Cheers,
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/da00b94c-bd5b-42cb-a669-12103c434c14%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2df18a17-f33f-486a-ab71-22bc7d0ccbeen%40googlegroups.com.


[web2py] Re: Cannot import module 'applications.welcome.modules.pytz

2017-12-01 Thread Neil
I just had the same problem. I used the `umask` solution here:

https://stackoverflow.com/questions/36898474/how-to-install-a-module-for-all-users-with-pip-on-linux

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


[web2py] Reset Password Not Working in Production

2015-02-25 Thread Neil Oswald
Hi,

Good day!

After clicking the reset_password link I received from email,
I got redirected to the homepage not on the reset password page.

The strange thing is that this problem only occur in my production
site. The reset works perfectly in my local machine.

I've done some checking in firebug and it said something like
a "303 See Other" error.

Any help is appreciated. 

Thanks.

Neil Oswald



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


[web2py] Re: Crash on SQLFORM submission

2014-01-13 Thread Neil
Figured it out - I was on the wrong track. It was something the user was 
typing in.

There is a field called "Year of birth", and the user was typing in date, 
month, year & ?? (e.g. "2909501950"). It passed the integer validator, but 
it is out of range for a postgresql integer. 

I guess I should implement my own integer validator?

Thanks,
Neil

On Monday, 13 January 2014 18:10:43 UTC, Neil wrote:
>
> This doesn't seem to be the case:
>
>- I looked at the database, and the types match the definition in the 
>model
>- I can't see how that would only cause problems for one user out of 
>thousands. 
>
> Any other things I can check out?
>
> On Monday, 13 January 2014 14:21:55 UTC, Massimo Di Pierro wrote:
>>
>> DataError is not a web2py or a python error. It is an error from the 
>> driver. I suspect you have an "integer" field which you changed to 
>> "string". Web2py knows about the change but the database does not and 
>> refuses to store a string in it. Delete everything under "databases". You 
>> will lose data but you will have a clean migration.
>>
>>

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


[web2py] Re: Crash on SQLFORM submission

2014-01-13 Thread Neil
This doesn't seem to be the case:

   - I looked at the database, and the types match the definition in the 
   model
   - I can't see how that would only cause problems for one user out of 
   thousands. 

Any other things I can check out?

On Monday, 13 January 2014 14:21:55 UTC, Massimo Di Pierro wrote:
>
> DataError is not a web2py or a python error. It is an error from the 
> driver. I suspect you have an "integer" field which you changed to 
> "string". Web2py knows about the change but the database does not and 
> refuses to store a string in it. Delete everything under "databases". You 
> will lose data but you will have a clean migration.
>
>

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


[web2py] Crash on SQLFORM submission

2014-01-13 Thread Neil
I'm having a problem that I can't get to the bottom of. The crash happens 
when a user submits an automatically generated SQLFORM. Here is the 
traceback from the ticket:

  File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py", line 
2189, in process
self.validate(**kwargs)
  File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py", line 
2128, in validate
if self.accepts(**kwargs):
  File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/sqlhtml.py", 
line 1571, in accepts
self.vars.id = self.table.insert(**fields)
  File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py", line 
8598, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File "/home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py", line 
1210, in insert
raise e
DataError: integer out of range


Here is the table:

db.define_table('user_demographics',
Field('sex', type='string', length=8),
Field('year_of_birth', type='integer'),
Field('country', type='string', length=25),
Field('therapist_1', type='string', length=5),
Field('therapist_2', type='string', length=5),
Field('medication', type='string', length=5),
Field('find_out', type='string'),
Field('find_out_2', type='text', length=1000),)

and here is the code:

@auth.requires_login()
def user_main():
user_form = SQLFORM(db.user_demographics)
if user_form.process().accepted:
redirect(URL(r=request, c='social_anxiety', f='page', vars=dict(
page_id=next_page_id)))
elif user_form.errors:
response.flash = 'Please take a look at your answers'

Some notes that might be relevant:

   - There is only one user who has this problem (thousands of other users 
   have used the system successfully). However, they have it *consistently*. 
   Furthermore, this is just one example - they have problems with any form 
   with text/string input. 
   - *I can't reproduce the error*. e.g. If I try to put in a really 
   small/large integer for the year, it is always handled gracefully. If I 
   disable JavaScript, the validator still comes back with useful error 
   messages. 
   - The user is in a non-English country
   
Based on this, I do not think the problem is the input, but something 
specific to this particular user's system (OS + browser). Any ideas on how 
I might reproduce this? I'm stumped. 

To make matters worse, I have very limited opportunity to debug with the 
user's assistance.

Thanks
Neil

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


[web2py] Re: How to use jquery get JSON in order to call web2py exteral API

2013-11-12 Thread Neil
I'm probably too late for this person, but if anyone else comes across this 
problem (like I just did) the answer is here:

https://groups.google.com/d/msg/web2py/kSUtyNcUQGI/Ta1VowPcJMgJ

As I understand it getJSON() is just a wrapper for ajax(). If you use 
ajax(), you have a few more options including one called crossDomain, which 
should be set to true. For example:

  jQuery(document).ready(function ($) {
//attach a jQuery live event to the button
$('#submit-samples').click(function(){
  $.ajax({
type: 'GET',
url: "[url]",
processData: true,
data: {},
crossDomain: true,
dataType: "json",
success: function (data) {
  alert(data); 
}
  });
});
  });

Next, if you add the following to your controller function:

if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = 
'http://www.[site].com'

it will allow access from any site(s) you specify. Alternatively, you can 
set it to '*' to accept requests from any site.

On Monday, 24 June 2013 22:22:36 UTC+1, Nam Soo In wrote:
>
> in controller
>
>
> from gluon.tools import Service
> service = Service()
>
> def call():
> session.forget()
> return service()
>
> @service.json
> def pullDataToMap():
>   ...logic..
>   return result
>
> result looks like this
> {'San_Jose':102,'Paris':2,'London':38}
>
> I am trying to call that function in javascript
>
> so
> 
>   $(document).ready(function(){
> console.log("hi")
>   $.getJSON('
> https://test.corp.nam.com/test/default/call/json/pullDataToMap', 
> function(data) {
>   console.log(data);
>   });
>  
>  
> });
>   
>
>
> it seems like it is not calling HTTPRequest and I am not getting any data.
> I am getting this error in console windows
> XMLHttpRequest cannot load 
> https://test.corp.nam.com/test/default/call/json/pullDataToMap. Origin 
> null is not allowed by Access-Control-Allow-Origin. 
>
> If I just put that url into the browser I can see the results 
>
> Any thought?
> Thank you in advance.
>
>

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


[web2py] Re: One of the best things that happened to web2py

2013-10-29 Thread Neil
Wow, this is excellent - everything seems to work really well. 

On Monday, 28 October 2013 09:41:35 UTC-7, Massimo Di Pierro wrote:
>>
>> I am happy to announce a great new opportunity for web2py users:
>>
>>  https://www.pythonanywhere.com/try-web2py
>>
>> Basically they give you the opportunity to create a web2py instance 
>> directly from the browser without sign-up. The instance only lives for 24 
>> hrs unless you sign-up. In that case it will persist.
>> The basic plan is also free.
>>
>> This is a great new way to show web2py to your friends and convince them 
>> to try it without commitment. It also works great for teaching web2py. 
>>
>> I encourage you to try it. 
>>
>> web2py.com is hosted on PythonAnywhere and we are very happy with it.
>>
>> Massimo
>>
>

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


[web2py] Re: debugging with winpdb

2013-08-02 Thread Neil
Now that PyCharm officially supports web2py, I've playing around its 
debugger. So far, so good. Note that the latest PyCharm 3.0 EAP build can 
be used for free for a few more weeks.

On Friday, 2 August 2013 02:21:46 UTC+1, Mark Finkelstein wrote:
>
> I've been trying to get winpdb to play nice with web2py, but I've gotten 
> the following:
>
> >> winpdb python web2py.py -a password -p 8000
> Failed to parse arguments: Unknown option -c
>
> I saw some previous posts seemingly getting this setup working, any tips? 
> What debugging environments do other people use?
>

-- 

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




[web2py] Re: ordering request.vars for PayPal IPN

2013-07-18 Thread Neil
Hi Simon,

I've got a live system working with PayPal. Here's my handler:

def ipn_handler():
parameters = request.vars
if len(request.vars.keys()) > 0:
params = "cmd=_notify-validate&" + urllib.urlencode(parameters)
headers = {"Content-type": "application/x-www-form-urlencoded",
   "Content-Length": "%s" % (len(params))}

r1 = None
try:
conn = httplib.HTTPSConnection("www.paypal.com")
conn.request("POST", "/cgi-bin/webscr", params, headers )
r1 = conn.getresponse()
except:
... handle error ...
return
if parameters['payment_status'] == "Completed":
... do stuff ...

It is adapted from code in the web2py cookbook. To be honest, I've never 
thought about the order of the URL. However, all I can say is that the 
above code has been running for about a year now without a problem.

Neil

On Thursday, 18 July 2013 21:02:03 UTC+1, SimonD wrote:
>
> OK, I think I have stumbled on a solution. Which I thought would be useful 
> to share here.
>
> Playing with request.env, I noted that this too was Storage.
>
> Hence: request.env.query_string appears to give me exactly what I need. 
> i.e. it is essentially the "raw" string of vars. Unaltered and in the 
> original order, just as PayPal wants to see.
> So, anyone planning to deploy PayPal's IPN, might like to make a note.
>
> This doesn't appear to be detailed  anywhere ??  If it is, then I have 
> overlooked a useful source of API information (that might have led me this 
> answer a lot earlier and not wasted forum space). If anyone knows where I 
> would have found this detailed, I would really appreciate the URLs 
> please..
>
> Thanks
> Simon
>
> On Thursday, July 18, 2013 5:46:23 PM UTC+1, SimonD wrote:
>>
>> Hello, I would be sure that someone has come across this already. I hope 
>> so.
>> I am writing a handler for PayPal IPN. Actually, a little easier that I 
>> thought it would be except for one issue: -
>>
>> request.vars creates a Storage object, but the key:value pairs are not in 
>> the same sequence as they are in the URL. It almost seems to be a 
>> randomised order.
>> For 99.9% of occasions this is OK. However, as part of the  IPN handler 
>> authentication, PayPal expects to receive the URL (var) string back exactly 
>> as they posted it to my application, specifically with the vars in the same 
>> order. Their documentation re-states this requirement in multiple places !.
>> I suspect (although I don't know), that PayPal is simply matching the 
>> return var string to the one it posts. i.e. not actually wasting server 
>> cycles with intelligent var matching :-(
>> I am also not on a LIVE server so, although PayPal have a test sandbox, 
>> it is not a lot of use at this point.
>>
>> I cannot identify any other function in web2py to pull the raw URL 
>> string. I think the only function is request.vars.
>> I note that request.args has an index method (i.e.  request.args(i) ) so 
>> that the args can be pulled in sequence. But request.vars does not have 
>> this method.
>>
>> To test my random order theory, here is a test function()
>>
>> import urllib
>> def sample():
>> #sample of ipn_handler code
>> getvars=request.vars
>> test1=urllib.urlencode(dict(getvars))
>> 
>> getvars=request.vars
>> test2=''
>> for item in getvars:
>> test2=CAT(test2,'&',item,'=',getvars[item])
>> 
>> test3=request.vars
>> 
>> return dict(test1=test1,test2=test2,test3=test3)
>>
>> and the view (extract)
>> test1: {{=test1}}
>> test2: {{=test2}}
>> test3: {{=test3}}
>>
>> So, if my url vars are as follows:-
>> ?a=11&b=22&c=33&d=44&e=55&f=66&g=77&h=88
>>
>> ...this is what the view shows.
>> test1: a=11&c=33&b=22&e=55&d=44&g=77&f=66&h=88
>> test2: &a=11&c=33&b=22&e=55&d=44&g=77&f=66&h=88
>> test3: > 'g': '77', 'f': '66', 'h': '88'}>
>>
>> You can see that I have testing two ways to create a return var string 
>> (test1 and test2), and also shown the Storage object (test3)
>> test1, test2 and test3 show an identical sequence. But it is different to 
>> the actual posted URL var sequence.
>> BTW - the actual IPN string is not d

[web2py] Re: Nice open source CMS (still maintained) in Web2py?

2013-04-24 Thread Neil
Hello,

This topic came up last month, and if my memory serves me correctly there 
were a few options available. I'd recommend searching this group for "CMS", 
and take a look at some of the more recent posts.

Neil

On Wednesday, 24 April 2013 14:57:52 UTC+1, alastor...@gmail.com wrote:
>
> Hi Folks,
>
> I discovered recently web2py and I really like it!
>
> I wonder if it exist  a nice open source CMS (still maintained...) in 
> web2py?
> I don't need something overcomplicated. I prefer something basic but 
> comfortable to use...
>
> The goal is to create my personal website first, then contribute (if my 
> skills are sufficient...)
>
> Thank you
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-23 Thread Neil
Thanks Niphlod & Anthony - I'm glad we finally got to the bottom of this. I 
thought I was going crazy for a while there!

In the short term, I'll use Niphlod's trick of setting a dummy session 
variable to make sure the session is saved to disk. 

In the medium term, I vote for option 1 (always saving a session file, even 
if session is empty). As we've seen, the current logic can lead to 
unpredictable behavior (I still can't reproduce on my Ubuntu netbook - my 
best guess is that since it is old and slow, the ajax requests 
aren't overlapping). I'd say it is a little risky to rely on the developer 
to remember to add initialization code to every page that contains 2+ 
ajax components. It is easy to lose track of that sort of thing. On the 
other hand, allowing a developer to turn off sessions in general is a good 
optimization for those who know what they are doing.

On Tuesday, 23 April 2013 03:00:11 UTC+1, Anthony wrote:
>
> The problem is that we made a change so that no session file is created at 
> all if this is a new session and the session remains empty. So, when the 
> index page is requested, no session file is created. Next, the form1 Ajax 
> request comes in, and because there is no session file, there is nothing to 
> read or lock. Meanwhile, the form2 Ajax request comes in, and again, there 
> is no file to read or lock. So, both requests start with an empty session 
> and add their respective formkeys to it. Next, the form1 request creates a 
> session file and writes its version of the session to it. Finally, the 
> form2 request opens and completely overwrites that session file with its 
> version of the session (which does not include the form1 formkey).
>
> What to do about this? I suppose one option would be to always create a 
> new session file when a new session is started, even if the session is 
> empty on the first request of the session (in the above example, an empty 
> session file would be created on accessing the index page). Some apps never 
> use the session, though, and would therefore have a bunch of unnecessary 
> session files (though I suppose you could still use the global settings to 
> turn off sessions).
>
> Another option is to leave it up to the developer to save something to the 
> session in the parent page request when the page contains multiple Ajax 
> requests that will be accessing the session. Maybe we could provide a 
> convenience method for this, such as session.save(), which would force 
> saving the file even if the session is empty (such a method might have 
> other uses, such as saving and then unlocking a session in the middle of a 
> request).
>
> Other ideas?
>
> I think there's a bigger problem with sessions in cookies and the db -- 
> they aren't locked at all, so you can get race conditions with them even 
> once the session has initially been saved.
>
> Anthony
>
> On Monday, April 22, 2013 4:59:16 PM UTC-4, Niphlod wrote:
>>
>> umpf I can't understand why this is not working "ok".
>>
>> The problem lies indeed in the fact that one ajax request overwrites the 
>> session, if the session file is not there yet. 
>> I can only guess that the logic is failing to acquire a lock before 
>> creating the (new) file 
>> If a request has completed yet, hence the session file is present, all 
>> goes perfectly ok (it's probably the reason why nobody else ever noticed 
>> "the glitch", and why prepending a "session.hello = 'world'" to the index 
>> function makes all go smoothly, it actually creates the session file before 
>> the two ajax requests come in)
>> can anyone testing this confirm this behaviour?
>> steps to reproduce:
>> - delete session file in the session/ dir
>> - open the index page
>> - session file ends up with one or another formname keys, never both
>> - reload the page
>> - session file holds both formnames
>> - put session.hello = 'world' in the index() function before the return 
>> dict()
>> - delete the session file in the sessions/ dir
>> - reload the page
>> - session file holds both formnames
>>
>> If this is indeed the behaviour, we narrowed it down to a "glitch" that 
>> happens in one case only: 2 concurrent requests comes in and there is no 
>> session file yet.
>> We can start from there to coordinate efforts for the patch. it's 
>> definitely not an issue with javascript.
>>
>>
>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
I've been doing a little debugging. When the page loads, 
_try_store_in_file(self, 
request, response) in globals.py is called twice. The first time it saves 
formname1, and the second time it seems to overwrite the original file with 
formname2 (occasionally the order is reversed). How would a lock would fix 
this? I can see how that would prevent simultaneous access to the file, but 
how would it prevent data from being overwritten?

On Monday, 22 April 2013 17:54:21 UTC+1, Anthony wrote:
>
> If you are saving sessions in files, the session file should be locked by 
> each request, so there shouldn't be any race conditions. However, if you 
> are saving sessions in the db, you could get race conditions (e.g., both 
> Ajax requests read the same empty session, then form1 saves its session 
> with its formkey, then form2 overwrites that session with just the form2 
> formkey).
>
> Anthony
>
> On Monday, April 22, 2013 12:13:25 PM UTC-4, Neil wrote:
>>
>> Good thought, but that doesn't seem to be a factor since it works in 
>> incognito after the first submit, and I can reproduce in regular mode. 
>>
>> For some reason, on initial page load it is not saving both formkeys. Is 
>> it possible that there is a conflict when saving the the sessions file? 
>> i.e. both ajax components are trying to save at the same time, and only one 
>> ends up getting saved? Or one is overwriting the other?
>>
>> On Monday, 22 April 2013 17:01:59 UTC+1, Niphlod wrote:
>>>
>>> completely "out-of-side" observation (I'll make sure I get this tested 
>>> once I get home to report the behaviour on my pc)  
>>>
>>> are you sure that your "incognito-mode" browser accepts cookies ?
>>>
>>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
Good thought, but that doesn't seem to be a factor since it works in 
incognito after the first submit, and I can reproduce in regular mode. 

For some reason, on initial page load it is not saving both formkeys. Is it 
possible that there is a conflict when saving the the sessions file? i.e. 
both ajax components are trying to save at the same time, and only one ends 
up getting saved? Or one is overwriting the other?

On Monday, 22 April 2013 17:01:59 UTC+1, Niphlod wrote:
>
> completely "out-of-side" observation (I'll make sure I get this tested 
> once I get home to report the behaviour on my pc)  
>
> are you sure that your "incognito-mode" browser accepts cookies ?
>
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
A little more progress - I can now predict when the problem will 
occur server side, before hitting submit. This is what I do:

1) clear all my web2py session files
2) open an incognito brower
3) go to the page with multiple ajax forms
4) take a look at the new session file. If it looks like this:

(dp1
S'_formkey[formname2]'
p2
S'e1983c3d-2695-4383-8ea4-f32d0687a0eb'
p3
sS'_session_hash'
p4
S'f36cc8f46f69c9d7b245d52c5630a427'
p5
s.

I know that the first submission for form 1 will fail. Once I submit it 
once, '_formkey[formname1]' is added to the session dictionary and it works 
from then on. Does this give any more clues?

On Monday, 22 April 2013 15:44:21 UTC+1, Neil wrote:
>
> Good suggestion - I think we may be getting somewhere. When it fails, the 
> server is getting a '_formkey[formname2]' when submitting form 1. I'll try 
> to dig a little deeper.
>
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
Good suggestion - I think we may be getting somewhere. When it fails, the 
server is getting a '_formkey[formname2]' when submitting form 1. I'll try 
to dig a little deeper.

On Monday, 22 April 2013 15:26:03 UTC+1, Anthony wrote:
>
> Not sure what's going on. In the browser, maybe use the developer tools to 
> confirm what is being sent (i.e., session cookie, value of the hidden 
> _formkey field). On the server, check that there is a "_formkey[formname1]" 
> key in the session and that it matches the _formkey value submitted with 
> the form. We need to figure out where it is failing.
>
>>
>>>
>>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
My first submit failed on Mac (both Chrome and Safari). However, I can't 
get it to happen on Ubuntu. 

I can now reproduce in the following situations:

   - running web2py locally and remote
   - 2 server OSs (windows & linux)
   - 2 webservers (rocket & uwgsi/nginx)
   - 2 front-end OSs (windows & mac - not ubuntu)
   - 4 browsers (firefox, chrome, IE, safari)
   - multiple versions of web2py
   
Not sure where that leaves me (except in a state of confusion).


> What else about my system could lead to this behavior? I'm going to go try 
> on a Mac.
>
>
>> Hmm, tried it from IE9, Chrome, and FF on Windows 7 and from Chrome and 
>> FF on Ubuntu -- multiple times in each browser, including clearing cookies, 
>> and never observed the problem.
>>
>> Do you ever clear the cookies and then submit without reloading the page 
>> or restarting the browser -- that will cause the error because the form 
>> will be submitted without the original session cookie?
>>
>> Anthony
>>
>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
Wow, really! That's really frustrating... 

Nope, I never tried clearing cookies and then submitting. I always clear my 
history, shut down the browser, restart the browser, copy the URL, and then 
the first submit (sometimes) fails. 

What else about my system could lead to this behavior? I'm going to go try 
on a Mac.

Thanks for your help with this.


> Hmm, tried it from IE9, Chrome, and FF on Windows 7 and from Chrome and FF 
> on Ubuntu -- multiple times in each browser, including clearing cookies, 
> and never observed the problem.
>
> Do you ever clear the cookies and then submit without reloading the page 
> or restarting the browser -- that will cause the error because the form 
> will be submitted without the original session cookie?
>
> Anthony
>
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
Just to clarify, I used the "new simple application" option with trunk (I 
didn't copy over the app from a previous version). Just to be 100% sure I 
also copied the web2py.js and web2py_ajax.html files over from the welcome 
app with no success.

On Monday, 22 April 2013 14:53:28 UTC+1, Neil wrote:
>
> I didn't upgrade - when I ran locally I downloaded trunk from github and 
> used that version with rocket. Same problem.
>
> On Monday, 22 April 2013 14:47:14 UTC+1, Anthony wrote:
>>
>>
>>> web2py.js is inside your app (in /appname/static/js), so it does not get 
>> updated when you upgrade web2py. When you upgrade web2py, you have to 
>> manually copy the new version of web2py.js (and /views/web2py_ajax.html) 
>> from the new "welcome" app to your own app.
>>
>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
I didn't upgrade - when I ran locally I downloaded trunk from github and 
used that version with rocket. Same problem.

On Monday, 22 April 2013 14:47:14 UTC+1, Anthony wrote:
>
>
>> web2py.js is inside your app (in /appname/static/js), so it does not get 
> updated when you upgrade web2py. When you upgrade web2py, you have to 
> manually copy the new version of web2py.js (and /views/web2py_ajax.html) 
> from the new "welcome" app to your own app.
>
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
Note: it is still frustratingly unpredictable. I followed my own 
instructions 10 times before it happened again...

On Monday, 22 April 2013 14:10:33 UTC+1, Neil wrote:
>
> 1) go to http://www.ai-therapy.com/ajax_test/
> 2) enter something in Form 1, and press submit
> 3) did it work *the first time*? (the second, and subsequent, submit 
> usually works for me)
> 4) if I clear the cookies and restart the browser, the first submit fails 
> about 50% of the time. 
>
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
This is turning out to be an elusive one! Notes:

1) I don't think I'm using an old web2py.js, unless it is accidentally 
being packaged with the latest source.
2) weheh: Nope, no uploading involved - all the code is above.
3) I guessed it is related to the multiple forms issue since 
the behavior seems similar. In particular, it usually happens for a first 
submit, and it happens with forms on different tabs.

I've now reproduced this with a variety of web2py versions (*including trunk
*), servers & browsers. I've uploaded the minimal example to my production 
server (web2py version 2.3.3, nginx), so give this a try:

1) go to http://www.ai-therapy.com/ajax_test/
2) enter something in Form 1, and press submit
3) did it work *the first time*? (the second, and subsequent, submit 
usually works for me)
4) if I clear the cookies and restart the browser, the first submit fails 
about 50% of the time. 

I've now seen it happen with chrome, fireforx & IE.

Does that give any clues?

On Monday, 22 April 2013 12:24:14 UTC+1, Anthony wrote:
>
> I had already tried something similar, and now I have tried your exact 
> code, and I cannot reproduce the problem (running from trunk with Rocket on 
> Windows 7). Is it possible you are using an old version of web2py.js?
>
> I've been playing around with it a bit more, and it seems to be the same 
>> underlying problem that Anthony described above.
>>
>
> What do you observe that leads you to that conclusion?
>
> Anthony 
>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
I've been playing around with it a bit more, and it seems to be the same 
underlying problem that Anthony described above. The question is: why 
doesn't the formname fix work for ajax components?

On Monday, 22 April 2013 09:19:06 UTC+1, Neil wrote:
>
> Thanks for that. Unfortunately, there seems to be a little more to it. 
>
> He is a minimal example (using web2py 2.4.6/rocket/windows, although 
> the behavior is the same with other configurations).
>
> controllers/default.py:
>
> def index():
> return dict()
>
> def f1():
> val1 = ""
> form1 = FORM('Form 1 input:', INPUT(_name='f1input', requires=
> IS_NOT_EMPTY()), INPUT(_type='submit'))
> if form1.accepts(request,session,formname="formname1"):
> val1 = form1.vars.f1input
> elif form1.errors:
> response.flash = 'Form 1 has errors'
> return dict(form1=form1, val1=val1)
>
> def f2():
> val2 = ""
> form2 = FORM('Form 2 input:', INPUT(_name='f2input', requires=
> IS_NOT_EMPTY()), INPUT(_type='submit'))
> if form2.accepts(request,session,formname="formname2"):
> val2 = form2.vars.f2input
> elif form2.errors:
> response.flash = 'Form 2 has errors'
> return dict(form2=form2, val2=val2)
>
> views/default/f1.load:
>
> {{=val1}}
> {{=form1}}
>
> views/default/f2.load:
>
> {{=val2}}
> {{=form2}}
>
> views/default/index.html:
>
> {{extend 'layout.html'}}
> {{=LOAD('default','f1.load',ajax=True)}}
> {{=LOAD('default','f2.load',ajax=True)}}
>
>
> The behavior is unpredictable. Sometimes the first submit for form 1 
> doesn't do anything.  You may need to refresh several times to reproduce.
>
> Bug, or I have I done something wrong?
>
> Neil
>
> On Sunday, 21 April 2013 20:19:25 UTC+1, Anthony wrote:
>>
>> Probably both forms have the same formname, either because they are both 
>> based on the same DAL table or because they are both SQLFORM.factory forms. 
>> To avoid the problem, assign unique formnames to each via 
>> .process(formname='myform1'), etc. This is discussed in the book: 
>> http://web2py.com/books/default/chapter/29/07#Multiple-forms-per-page.
>>
>> Note, the problem isn't really limited to multiple forms on the same 
>> page, but to multiple forms with the same name in the same browser session 
>> (even if loaded into different tabs/windows that are open at the same 
>> time). The problem is that the value of the formkey is stored in the 
>> session with a key like "_formkey[formname]". If a second form is created 
>> before the first form has been submitted, the formkey associated with that 
>> particular formname will be overwritten, so when the first form is 
>> submitted, it will not be accepted. However, the submission itself will 
>> once again replace the formkey value, so if you immediately submit a second 
>> time, it will work.
>>
>> Anthony
>>
>> On Sunday, April 21, 2013 5:03:06 AM UTC-4, Neil wrote:
>>>
>>> I'm having this problem now - is there a trick to having two ajax forms 
>>> on one page?
>>>
>>> Basically, as above, I have to hit submit twice for anything result. Has 
>>> anyone successfully had 2+ ajax forms on the same page?
>>>
>>> On Wednesday, 21 July 2010 08:37:54 UTC+1, mdipierro wrote:
>>>>
>>>> will look into this.. it must be a JS issue. 
>>>>
>>>> On Jul 20, 9:10 pm, ionel  wrote: 
>>>> > Hello, 
>>>> > 
>>>> > I try to add two ajax forms into a page with something like this: 
>>>> > 
>>>> > {{=LOAD(url=URL(r=request,f='add_person.load'), ajax=True)}} 
>>>> > {{=LOAD(url=URL(r=request,f='add_image.load'), ajax=True)}} 
>>>> > 
>>>> > If the form has errors, the error messages are displayed after a 
>>>> > second submit. So, I need to click two times the submit button to 
>>>> > display them. 
>>>> > 
>>>> > The second form has a normal behavior. 
>>>> > 
>>>> > Thanks. 
>>>> > 
>>>> > i.a.
>>>
>>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-22 Thread Neil
Thanks for that. Unfortunately, there seems to be a little more to it. 

He is a minimal example (using web2py 2.4.6/rocket/windows, although 
the behavior is the same with other configurations).

controllers/default.py:

def index():
return dict()

def f1():
val1 = ""
form1 = FORM('Form 1 input:', INPUT(_name='f1input', requires=
IS_NOT_EMPTY()), INPUT(_type='submit'))
if form1.accepts(request,session,formname="formname1"):
val1 = form1.vars.f1input
elif form1.errors:
response.flash = 'Form 1 has errors'
return dict(form1=form1, val1=val1)

def f2():
val2 = ""
form2 = FORM('Form 2 input:', INPUT(_name='f2input', requires=
IS_NOT_EMPTY()), INPUT(_type='submit'))
if form2.accepts(request,session,formname="formname2"):
val2 = form2.vars.f2input
elif form2.errors:
response.flash = 'Form 2 has errors'
return dict(form2=form2, val2=val2)

views/default/f1.load:

{{=val1}}
{{=form1}}

views/default/f2.load:

{{=val2}}
{{=form2}}

views/default/index.html:

{{extend 'layout.html'}}
{{=LOAD('default','f1.load',ajax=True)}}
{{=LOAD('default','f2.load',ajax=True)}}


The behavior is unpredictable. Sometimes the first submit for form 1 
doesn't do anything.  You may need to refresh several times to reproduce.

Bug, or I have I done something wrong?

Neil

On Sunday, 21 April 2013 20:19:25 UTC+1, Anthony wrote:
>
> Probably both forms have the same formname, either because they are both 
> based on the same DAL table or because they are both SQLFORM.factory forms. 
> To avoid the problem, assign unique formnames to each via 
> .process(formname='myform1'), etc. This is discussed in the book: 
> http://web2py.com/books/default/chapter/29/07#Multiple-forms-per-page.
>
> Note, the problem isn't really limited to multiple forms on the same page, 
> but to multiple forms with the same name in the same browser session (even 
> if loaded into different tabs/windows that are open at the same time). The 
> problem is that the value of the formkey is stored in the session with a 
> key like "_formkey[formname]". If a second form is created before the first 
> form has been submitted, the formkey associated with that particular 
> formname will be overwritten, so when the first form is submitted, it will 
> not be accepted. However, the submission itself will once again replace the 
> formkey value, so if you immediately submit a second time, it will work.
>
> Anthony
>
> On Sunday, April 21, 2013 5:03:06 AM UTC-4, Neil wrote:
>>
>> I'm having this problem now - is there a trick to having two ajax forms 
>> on one page?
>>
>> Basically, as above, I have to hit submit twice for anything result. Has 
>> anyone successfully had 2+ ajax forms on the same page?
>>
>> On Wednesday, 21 July 2010 08:37:54 UTC+1, mdipierro wrote:
>>>
>>> will look into this.. it must be a JS issue. 
>>>
>>> On Jul 20, 9:10 pm, ionel  wrote: 
>>> > Hello, 
>>> > 
>>> > I try to add two ajax forms into a page with something like this: 
>>> > 
>>> > {{=LOAD(url=URL(r=request,f='add_person.load'), ajax=True)}} 
>>> > {{=LOAD(url=URL(r=request,f='add_image.load'), ajax=True)}} 
>>> > 
>>> > If the form has errors, the error messages are displayed after a 
>>> > second submit. So, I need to click two times the submit button to 
>>> > display them. 
>>> > 
>>> > The second form has a normal behavior. 
>>> > 
>>> > Thanks. 
>>> > 
>>> > i.a.
>>
>>

-- 

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




[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2013-04-21 Thread Neil
I'm having this problem now - is there a trick to having two ajax forms on 
one page?

Basically, as above, I have to hit submit twice for anything result. Has 
anyone successfully had 2+ ajax forms on the same page?

On Wednesday, 21 July 2010 08:37:54 UTC+1, mdipierro wrote:
>
> will look into this.. it must be a JS issue. 
>
> On Jul 20, 9:10 pm, ionel  wrote: 
> > Hello, 
> > 
> > I try to add two ajax forms into a page with something like this: 
> > 
> > {{=LOAD(url=URL(r=request,f='add_person.load'), ajax=True)}} 
> > {{=LOAD(url=URL(r=request,f='add_image.load'), ajax=True)}} 
> > 
> > If the form has errors, the error messages are displayed after a 
> > second submit. So, I need to click two times the submit button to 
> > display them. 
> > 
> > The second form has a normal behavior. 
> > 
> > Thanks. 
> > 
> > i.a.

-- 

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




[web2py] Re: orderby on an integer field appears to order as if field is a string

2013-02-17 Thread Neil Johnson
Thanks Massimo,

I think what happened was I coded this up without the integer tag on count, 
then realised I needed it, and added it. The first commit occurred with the 
integer tag , so as far as I could see it was always an integer.

Recreating the table fixed it

Neil

On Saturday, February 16, 2013 11:59:34 PM UTC, Neil Johnson wrote:
>
> Hello
>
> I have a query like so 
> result = db(db.tag_count.user_id == user_id).select(db.tag_count.name, 
> db.tag_count.count, orderby=~ db.tag_count.count, limitby=(0, 10))
>
> where db.tag_count is defined as 
>
> db.define_table('tag_count',
> Field('name'),
> Field('user_id', db.auth_user),
> Field('count', 'integer'),
> format='%(title)s')
>
>
> Which aims to return the rows with the highest tag counts
>
> In reality it returns the tag_count based on alphabetical rather numerical 
> order. A sample ordering might be 21, 2,12,1 i.e. 2 > 12 where I would want 
> 21,12,2,1
>
> I am using web2py 2.3.2 and SQLite
>
> Any thoughts on what I'm doing wrong?
>
> Many thanks, 
>
> Neil
>
>

-- 

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




[web2py] orderby on an integer field appears to order as if field is a string

2013-02-16 Thread Neil Johnson
Hello

I have a query like so 
result = db(db.tag_count.user_id == user_id).select(db.tag_count.name, 
db.tag_count.count, orderby=~ db.tag_count.count, limitby=(0, 10))

where db.tag_count is defined as 

db.define_table('tag_count',
Field('name'),
Field('user_id', db.auth_user),
Field('count', 'integer'),
format='%(title)s')


Which aims to return the rows with the highest tag counts

In reality it returns the tag_count based on alphabetical rather numerical 
order. A sample ordering might be 21, 2,12,1 i.e. 2 > 12 where I would want 
21,12,2,1

I am using web2py 2.3.2 and SQLite

Any thoughts on what I'm doing wrong?

Many thanks, 

Neil

-- 

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




[web2py] Re: Error when changing Postgresql password

2013-02-04 Thread Neil
Worked perfectly - thanks.

On Monday, February 4, 2013 8:08:47 PM UTC, Limedrop wrote:
>
> (a) Because when you changed the DAL connection string, web2py thinks it 
> might be a new database and tries to recreate the tables from scratch.
>
> (b) You could try: 
> db = DAL(...,fake_migrate_all=True)  
> run the app and, if successful, then:
> db = DAL(...,fake_migrate_all=False)  
> But read the instructions in the book first  
> http://web2py.com/books/default/chapter/29/06?search=fake_migrate
>
>

-- 

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




[web2py] Error when changing Postgresql password

2013-02-04 Thread Neil
I've changed the user password for my Postgresql database. When I make the 
update to the DAL connection string, I then get the following error:

postgresql error ... (relation 
"auth_user" already exists)

when going to the site. Notes:

   - I've made no other changes to the database or model files
   - I know the password is correct, because when I deliberately use the 
   wrong password I get a different message (about not being able to connect 
   to the database).
   - When I revert to the old password (in both the connection string and 
   the database), everything starts working again.

Anyone know (a) what is causing this, and (b) how I can get around it?

Neil

-- 

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




[web2py] Re: https at webfaction.

2013-01-31 Thread Neil
The function:

request.requires_https()

might be what you're looking for. 

On Wednesday, January 30, 2013 2:46:08 PM UTC, Annet wrote:
>
> I the past I hosted a web2py application at Webfaction. I had a dedicated 
> IP address, and added:
>
> domains: mydomain.com, www.mydomain.com and admin.mydomain.com
> application: web2py
> websites: a normal and an encrypted website.
>
> and added domains mydomain.com and www.domain.com and application web2py 
> to the normal website
> and domain admin.mydomain.com and  application web2py to the encrypted 
> website.
>
> For some reason this was sufficient to access my application and access 
> appadmin, I didn't have to add
> any additional code.
>
> Today I posted the following question:
>
>
> I am developing a web application in web2py, the controllers follow the 
> pattern:
> addressbook/cmsaddressbook
> about/cms/about
> calendar/cmscalendar
> I know I can create a secure website, however, I don't want the entire 
> site to be secure, 
> just cmsaddressbook, cmsabout and cmscalendar. Is that possible?
>
>
> I got the following reply:
>
>
> Yes, this can be done by redirecting to HTTPS in your application for the 
> needed URLs. 
> To do so, your application must still have an HTTPS version with an HTTPS 
> website record,
>  and you'll need an SSL certificate installed. 
>
> Once that's done, you can redirect to HTTPS for certain URLs based on 
> context. This would 
> be similar to the following: 
> http://community.webfaction.com/questions/3211/apache-conf-http-and-https 
> In short, your application can use the value of the 
> %{HTTP:X-Forwarded-SSL} HTTP variable to 
> determine if the user arrived via HTTP or HTTPS, and then redirect to 
> HTTPS for only the pages you
> want to use HTTPS for.
>
>
> I think I do understand the first part of this reply, but I have no idea 
> how the second part is related to
> web2py's features. How does appadmin make me arrive via https?
>
>
> Kind regards,
>
> Annet.
>
>

-- 

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




[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-19 Thread Neil
Yup, it works, but I think I left out a key step. In more detail:

- In the webfaction control panel, set up two different applications. one 
is a "custom" type, and one is a "static" type.
- Put a link from the static folder under the web2py application to the 
static application's home folder
- In the control panel, create a website for your domain. A website can be 
handled by multiple applications. Set it up so that the root "/" is served 
by the custom app, and "/static" is served by the static app. I also have a 
wordpress app that serves "/blog". You can have any number of other 
applications.

For example, with my website any request to:
http://www.ai-therapy.com/
is handled by the custom app, which is uwsgi/web2py. All static content is 
under:
http://www.ai-therapy.com/static
Webfaction's nginx server knows to direct this to the static app, so uwsgi 
never even knows the request has occurred. Similarly, /blog/* goes directly 
to the wordpress app. Anything else handled by the "Custom on /" app, so 
gets mapped to web2py applications, controllers, functions, etc..

Hope that makes more sense.


On Wednesday, December 19, 2012 5:48:09 AM UTC, HittingSmoke wrote:
>
> So I've been thinking more and more about this over the past few days and 
> I'm 99% sure that would just serve the static content in the same exact way 
> it would otherwise (through uwsgi) just from the folder of the other app... 
> Can you confirm that nginx is actually serving the static 
> content separately?
>
> On Monday, December 17, 2012 11:34:51 AM UTC-8, Neil wrote:
>>
>> What I've done for that is set up another webfaction application of type 
>> "static" to server all the css, images, audio, videos, etc. That creates a 
>> new folder, for example:
>>
>> /home/[USER]/webapps/static_web2py_myapp
>>
>> Then, in my web2py/applications/[my_app]/ folder, I put a symbolic link 
>> called "static" to the above folder. Seems to do the trick.
>>
>> On Monday, December 17, 2012 7:17:35 PM UTC, HittingSmoke wrote:
>>>
>>> Bah, I actually asked a Webfaction staff member if this were possible 
>>> and I was told no, that the frontend Nginx server could only be used on 
>>> static/PHP sites.
>>>
>>> Now that I'm looking into it I'm seeing one major issue that without 
>>> proper configuration of Nginx for web2py, it would be serving static files 
>>> through uwsgi instead of directly though Nginx. That requires a special 
>>> entry in nginx.conf. Would that not mean reduced performance and higher RAM 
>>> usage from uwsgi?
>>>
>>> On Monday, December 17, 2012 4:32:21 AM UTC-8, Neil wrote:
>>>>
>>>> I'm also not a sysadmin, but I did go through the process of setting up 
>>>> web2py on webfaction recently as well. I also found that script but it 
>>>> seemed to be overly complicated. In particular, there is no need to 
>>>> download, build & run nginx, as you can use webfaction's instance. If 
>>>> there 
>>>> is an advantage to running your own I'd be curious to hear about it. 
>>>> Simplified steps I followed:
>>>>
>>>> 1. download & build latest uwsgi
>>>> 2. download & unpack latest web2py
>>>> 3. set up a "custom app" using webfaction's control panel, taking note 
>>>> of the port
>>>> 4. run the uwsgi binary, specifying parameters in the command line. For 
>>>> the socket parameter use 127.0.0.1 and the port webfaction assigned for 
>>>> your custom app. There are a few other posts in this group about selecting 
>>>> good uwsgi parameters so that you don't run out of memory (seems to be a 
>>>> common pitfall on webfaction)
>>>>
>>>> Hope that's useful.
>>>>
>>>> Neil
>>>>
>>>>
>>>> On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:
>>>>>
>>>>> I've been learning web2py on Webfaction off and on for a while now. 
>>>>> The web2py install script on the Webfaction wiki is quite outdated and 
>>>>> runs 
>>>>> on an Apache instance that can barely stay within the default memory 
>>>>> limits 
>>>>> without serious tweaking. Responsiveness with web2py/apache out of the 
>>>>> box 
>>>>> with the default install script is unimpressive as well.
>>>>>
>>>>> A while back I tried a lighttpd setup with web2p

[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread Neil
What I've done for that is set up another webfaction application of type 
"static" to server all the css, images, audio, videos, etc. That creates a 
new folder, for example:

/home/[USER]/webapps/static_web2py_myapp

Then, in my web2py/applications/[my_app]/ folder, I put a symbolic link 
called "static" to the above folder. Seems to do the trick.

On Monday, December 17, 2012 7:17:35 PM UTC, HittingSmoke wrote:
>
> Bah, I actually asked a Webfaction staff member if this were possible and 
> I was told no, that the frontend Nginx server could only be used on 
> static/PHP sites.
>
> Now that I'm looking into it I'm seeing one major issue that without 
> proper configuration of Nginx for web2py, it would be serving static files 
> through uwsgi instead of directly though Nginx. That requires a special 
> entry in nginx.conf. Would that not mean reduced performance and higher RAM 
> usage from uwsgi?
>
> On Monday, December 17, 2012 4:32:21 AM UTC-8, Neil wrote:
>>
>> I'm also not a sysadmin, but I did go through the process of setting up 
>> web2py on webfaction recently as well. I also found that script but it 
>> seemed to be overly complicated. In particular, there is no need to 
>> download, build & run nginx, as you can use webfaction's instance. If there 
>> is an advantage to running your own I'd be curious to hear about it. 
>> Simplified steps I followed:
>>
>> 1. download & build latest uwsgi
>> 2. download & unpack latest web2py
>> 3. set up a "custom app" using webfaction's control panel, taking note of 
>> the port
>> 4. run the uwsgi binary, specifying parameters in the command line. For 
>> the socket parameter use 127.0.0.1 and the port webfaction assigned for 
>> your custom app. There are a few other posts in this group about selecting 
>> good uwsgi parameters so that you don't run out of memory (seems to be a 
>> common pitfall on webfaction)
>>
>> Hope that's useful.
>>
>> Neil
>>
>>
>> On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:
>>>
>>> I've been learning web2py on Webfaction off and on for a while now. The 
>>> web2py install script on the Webfaction wiki is quite outdated and runs on 
>>> an Apache instance that can barely stay within the default memory limits 
>>> without serious tweaking. Responsiveness with web2py/apache out of the box 
>>> with the default install script is unimpressive as well.
>>>
>>> A while back I tried a lighttpd setup with web2py on Webfaction. The 
>>> memory usage went way down and responsiveness was better but the web server 
>>> was quite unstable. I found myself having to restart it constantly and I 
>>> couldn't track down the cause of the breakages. After the host upped the 
>>> default RAM limit on CentOS6 systems to 256MB things got better as it made 
>>> Apache more manageable on custom installs but it still sucked overall.
>>>
>>> So I found an install script for nginx/uWSGI on the WF community 
>>> support 
>>> forum<http://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi>but
>>>  it was horribly outdated and had multiple issues pointed out in the 
>>> comments that went unfixed. I spent a couple hours today fixing the ignored 
>>> errors, updating it to the latest nginx and uwsgi versions and fixing the 
>>> errors which that brought on. After getting it working my RAM usage has 
>>> decreased and responsiveness of my web2py apps has noticeably increased. I 
>>> figured I'd share the script for anyone interested.
>>>
>>> I'm not a sysadmin, more of a hobbyist so any critique of my server 
>>> configs here are greatly welcome. Please note that the comments are not 
>>> mine. I merely updated the parts of the script that were required for it to 
>>> work. All else was left as-is.
>>>
>>> Also, if anyone with knowledge of XML-RPC want's to make an actual 
>>> Webfaction install 
>>> script<https://docs.webfaction.com/xmlrpc-api/tutorial.html> for 
>>> nginx/uwsgi/web2py that would be awesome. It could be added to the script 
>>> wiki.
>>>
>>> #!/bin/sh
>>>
>>>
>>> # TODO's:
>>> # * find free port for communication for nginx and uwsgi
>>> # * test conjob creation properly
>>>
>>>
>>> echo 'Install script for nginx (1.2.6), uwsgi (1.4.3) and web2py 
>>> (latest stable)'
>>> echo

[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread Neil
This thread has a more detailed exampled of a script:

https://groups.google.com/forum/?fromgroups=#!searchin/web2py/uwsgi$20webfaction/web2py/PWpwayGa4Io/bBVyehyZ3ogJ

On Monday, December 17, 2012 12:32:21 PM UTC, Neil wrote:
>
>  There are a few other posts in this group about selecting good uwsgi 
> parameters so that you don't run out of memory (seems to be a common 
> pitfall on webfaction)
>
>>
>>

-- 





[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread Neil
I'm also not a sysadmin, but I did go through the process of setting up 
web2py on webfaction recently as well. I also found that script but it 
seemed to be overly complicated. In particular, there is no need to 
download, build & run nginx, as you can use webfaction's instance. If there 
is an advantage to running your own I'd be curious to hear about it. 
Simplified steps I followed:

1. download & build latest uwsgi
2. download & unpack latest web2py
3. set up a "custom app" using webfaction's control panel, taking note of 
the port
4. run the uwsgi binary, specifying parameters in the command line. For the 
socket parameter use 127.0.0.1 and the port webfaction assigned for your 
custom app. There are a few other posts in this group about selecting good 
uwsgi parameters so that you don't run out of memory (seems to be a common 
pitfall on webfaction)

Hope that's useful.

Neil


On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:
>
> I've been learning web2py on Webfaction off and on for a while now. The 
> web2py install script on the Webfaction wiki is quite outdated and runs on 
> an Apache instance that can barely stay within the default memory limits 
> without serious tweaking. Responsiveness with web2py/apache out of the box 
> with the default install script is unimpressive as well.
>
> A while back I tried a lighttpd setup with web2py on Webfaction. The 
> memory usage went way down and responsiveness was better but the web server 
> was quite unstable. I found myself having to restart it constantly and I 
> couldn't track down the cause of the breakages. After the host upped the 
> default RAM limit on CentOS6 systems to 256MB things got better as it made 
> Apache more manageable on custom installs but it still sucked overall.
>
> So I found an install script for nginx/uWSGI on the WF community support 
> forum<http://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi>but
>  it was horribly outdated and had multiple issues pointed out in the 
> comments that went unfixed. I spent a couple hours today fixing the ignored 
> errors, updating it to the latest nginx and uwsgi versions and fixing the 
> errors which that brought on. After getting it working my RAM usage has 
> decreased and responsiveness of my web2py apps has noticeably increased. I 
> figured I'd share the script for anyone interested.
>
> I'm not a sysadmin, more of a hobbyist so any critique of my server 
> configs here are greatly welcome. Please note that the comments are not 
> mine. I merely updated the parts of the script that were required for it to 
> work. All else was left as-is.
>
> Also, if anyone with knowledge of XML-RPC want's to make an actual 
> Webfaction install 
> script<https://docs.webfaction.com/xmlrpc-api/tutorial.html> for 
> nginx/uwsgi/web2py that would be awesome. It could be added to the script 
> wiki.
>
> #!/bin/sh
>
>
> # TODO's:
> # * find free port for communication for nginx and uwsgi
> # * test conjob creation properly
>
>
> echo 'Install script for nginx (1.2.6), uwsgi (1.4.3) and web2py (latest 
> stable)'
> echo 'If you wish to create cronjobs comment out the last lines of this 
> script'
>
>
> # port betweet nginx and uwsgi
> nginx_uwsgi_port=9001
>
>
> # Get web2py admin password
> echo "Web2py admin password:"
> read  web2py_password
>
>
> # Get webfaction application name
> echo "Webfaction application name:"
> read  webfaction_app_name
>
>
> # Get webfaction port number
> echo "Webfaction application port:"
> read  webfaction_app_port
>
>
> # port betweet nginx and uwsgi
> echo "Port number for communication between nginx and uswgi (eg. 9001):"
> read nginx_uwsgi_port
>
>
> ### 
> ### web2py
> ###
> cd ~/webapps/${webfaction_app_name}
> wget http://www.web2py.com/examples/static/web2py_src.zip
> unzip web2py_src.zip
> rm web2py_src.zip
> cd web2py
> python -c "from gluon.main import save_password; 
> save_password('${web2py_password}',${webfaction_app_port})"
> cd ..
>
>
> ###
> ### nginx
> ###
> mkdir downs
> cd downs
>
>
> # download and install nginx in the appname directory
> wget http://nginx.org/download/nginx-1.2.6.tar.gz
> tar xvf nginx-1.2.6.tar.gz
> cd nginx-1.2.6
>
>
> ./configure \
>   --prefix=/home/${USER}/webapps/${webfaction_app_name}/nginx \
>   --sbin-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/sbin/nginx 
> \
>   --conf-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/nginx.conf 
> \
>   --error-log-path=/home/${USER}/webapps/$

[web2py] Re: Webfaction Deployment and Tuning Web2py Slice.

2012-11-07 Thread Neil
I'm certainly no expert, but I'm also on webfaction and you may want to 
consider using nginx/uwsgi. At least in my case, there was very little I 
needed to worry about in terms of configuration/memory management. Just two 
tricks:

- no need to install nginx, as you can just use webfaction's nginx instance 
(there is a recipe floating around that has you build/install a local copy. 
there may be some advantages to this, but I found it to be unnecessary)
- make sure to use uwsgi's "reload-on-rss" option to make sure the process 
doesn't keep consuming more and more memory - webfaction kill your 
processes if you go over your limit. There's a number of posts on this 
topic in this forum.

In general, it's a fast server and relatively straightforward set up. Might 
be more suitable for your needs than fiddling with apache config files.

Neil

On Tuesday, November 6, 2012 5:52:52 PM UTC, Mark Graves wrote:
>
> Dear Fellow Web2py Developers,
>
> Sorry for the extended email, I wanted to introduce myself and give some 
> background.
>
> I am enjoying web2py tremendously.  Two years ago, I came to web2py from 
> php where I had hacked together multiple web applications, despite a 
> non-programming background.  I am a second year medical student in Chicago, 
> and I've always had some ideas as to how to make people's lives better 
> through technology.  Now, I'm taking some time off from school to try to do 
> exactly that.
>
> It has been a wonderful learning experience for programming and web 
> application development.  I even managed to help three people who had never 
> written a single line of code begin writing web applications that they had 
> always dreamed about and never believed they could. (btw Massimo, if you 
> happen to see this, one is a bio major from Depaul)
>
> Now, I am trying to give back to my community.  Specifically, as I am 
> preparing to deploy an application for a production environment, I have 
> been learning about hosting, the most frustrating part of my learning 
> curve. Getting a local copy of web2py up and going is one thing.  Having a 
> fully functional, web deployed app is another. (I know this may sound 
> irresponsible - to put potentially insecure applications on the web, and I 
> believe empowerment, open information, and experience are the keys)
>
> I chose webfaction as my hosting environment because I had heard about 
> them on this board.  Now, I am trying to write a web2py slice to document 
> my process of going from local development to production with multiple 
> developers in a professional hosting environment.  It is both a learning 
> experience for me and an opportunity to give other non-programmers a better 
> understanding of the process, which I would have appreciated in the process.
>
> I am soliciting your help to try to offer this help better than I can.
>
> The areas I want to cover for webfaction are:
> 1.) 1 click web2py instance deployment script -- DONE(already on their 
> wiki)
> 2.) Version control using hg -- WORKING (using hgweb as a separate 
> application)
> 3.) Apache Optimization/mod_wsgi / Memory management  -- WORKING 
> (following the book and Graham Dumpleton's suggestions on the server)
> 4.) exposed /admin with ssh - WORKING
> 5.) Version control from admin interface - WORKING
> 6.) deployment under subdomain / sub url
>
> The area where I'd like the most help is the Apache/memory management 
> stuff.  Apache/mod_wsgi are confusing as a newbie non programmer.  I don't 
> think it has to be. I want to make production web application development 
> UNDERSTANDABLE for non programmers, to attract more people like myself to 
> the field and to the framework.
>
> If you are willing to lend your expertise please let me know, so we can 
> make this community better for everyone.
>
> Sincerely,
>
> Mark Graves
> GravesMedical Founder
>
>

-- 





[web2py] Re: Import error with 2.2.1

2012-11-06 Thread Neil
Solved it. Your first intuition was correct - conflict in "modules", which 
I should have picked up on immediately with the additional debug info.

On Tuesday, November 6, 2012 4:26:30 PM UTC, Massimo Di Pierro wrote:
>
> I tried the same statements (on Mac) and I cannot reproduce the problem. 
> Anyway, note the logic:
>
> NATIVE_IMPORTER = __builtin__.__import__
> ...
> def custom_importer(name, globals=None, locals=None, fromlist=None, 
> level=-1):
> 
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level) # line 
> 87
>
> So basically the custom_importer is doing nothing but delegating the 
> native_importer (__builtin__.__import__) with the same arguments.
>
> If you have any idea please let me know. If you can give me access to the 
> server I can try some debugging.
>
> massimo
>
> On Tuesday, 6 November 2012 01:58:38 UTC-6, Neil wrote:
>>
>> It seems to be there, as I can import it from a normal python shell. Here 
>> is what I get from the web2py shell:
>>
>> >>> from matplotlib.projections.geo import AitoffAxes
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File 
>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>> line 87, in custom_importer
>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>   File 
>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py",
>>  
>> line 1, in 
>> from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
>> ImportError: cannot import name AitoffAxes
>>
>> Email me if you would like me to arrange access to the server for a 
>> faster debug cycle (unfortunately I'm a little too busy to investigate this 
>> myself at the moment).
>>
>> On Tuesday, November 6, 2012 4:43:39 AM UTC, Massimo Di Pierro wrote:
>>>
>>> can you do
>>>
>>> from matplotlib.projections.geo import AitoffAxes
>>>
>>> I assume it is there.
>>>
>>> On Monday, 5 November 2012 16:10:14 UTC-6, Neil wrote:
>>>>
>>>> No problem. Here is what I get:
>>>>
>>>> >>> import matplotlib.pylab
>>>> Traceback (most recent call last):
>>>>   File "", line 1, in 
>>>>   File 
>>>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>>>> line 87, in custom_importer
>>>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>>>   File 
>>>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/pylab.py",
>>>>  
>>>> line 221, in 
>>>> from matplotlib import mpl  # pulls in most modules
>>>>   File 
>>>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>>>> line 87, in custom_importer
>>>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>>>   File 
>>>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl.py",
>>>>  
>>>> line 10, in 
>>>> from matplotlib import figure
>>>>   File 
>>>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>>>> line 87, in custom_importer
>>>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>>>   File 
>>>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/figure.py",
>>>>  
>>>> line 29, in 
>>>> from projections import projection_factory, get_projection_names, \
>>>>   File 
>>>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>>>> line 87, in custom_importer
>>>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>>>   File 
>>>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py",
>>>>  
>>>> line 1, in 
>>>> from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
>>>> ImportError: cannot import name AitoffAxes
>>>>
>>>> On Friday, November 2, 2012 3:48:53 PM UTC, Massimo Di Pierro wrote:
>>>>>
>>>>> I need your help. In gluon/custom_import.py can you replace
>>>>>
>>>>> except Impor

[web2py] Re: Import error with 2.2.1

2012-11-05 Thread Neil
It seems to be there, as I can import it from a normal python shell. Here 
is what I get from the web2py shell:

>>> from matplotlib.projections.geo import AitoffAxes
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
"/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py",
 
line 1, in 
from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
ImportError: cannot import name AitoffAxes

Email me if you would like me to arrange access to the server for a faster 
debug cycle (unfortunately I'm a little too busy to investigate this myself 
at the moment).

On Tuesday, November 6, 2012 4:43:39 AM UTC, Massimo Di Pierro wrote:
>
> can you do
>
> from matplotlib.projections.geo import AitoffAxes
>
> I assume it is there.
>
> On Monday, 5 November 2012 16:10:14 UTC-6, Neil wrote:
>>
>> No problem. Here is what I get:
>>
>> >>> import matplotlib.pylab
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File 
>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>> line 87, in custom_importer
>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>   File 
>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/pylab.py",
>>  
>> line 221, in 
>> from matplotlib import mpl  # pulls in most modules
>>   File 
>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>> line 87, in custom_importer
>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>   File 
>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl.py",
>>  
>> line 10, in 
>> from matplotlib import figure
>>   File 
>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>> line 87, in custom_importer
>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>   File 
>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/figure.py",
>>  
>> line 29, in 
>> from projections import projection_factory, get_projection_names, \
>>   File 
>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>> line 87, in custom_importer
>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>   File 
>> "/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py",
>>  
>> line 1, in 
>> from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
>> ImportError: cannot import name AitoffAxes
>>
>> On Friday, November 2, 2012 3:48:53 PM UTC, Massimo Di Pierro wrote:
>>>
>>> I need your help. In gluon/custom_import.py can you replace
>>>
>>> except ImportError, e1: # line 84
>>> import_tb = sys.exc_info()[2]
>>> try:
>>> return NATIVE_IMPORTER(name, globals, locals, fromlist, 
>>> level) # line 87
>>> except ImportError, e3:
>>> raise ImportError, e1, import_tb  # there an import 
>>> error in the module
>>>
>>> with
>>>
>>> except ImportError, e1: # line 84
>>> import_tb = sys.exc_info()[2]
>>> return NATIVE_IMPORTER(name, globals, locals, fromlist, 
>>> level) # line 87
>>>
>>> and see what changes?
>>>
>>>
>>>
>>> On Friday, 2 November 2012 09:09:03 UTC-5, Neil wrote:
>>>>
>>>> Can't see any potential conflicts. I have the problem for both 
>>>> track_changes(True) and track_changes(False). When I import from shell:
>>>>
>>>> [aicbt@web331 web2py2.2.1]$ python web2py.py -S init
>>>> web2py Web Framework
>>>> Created by Massimo Di Pierro, Copyright 2007-2012
>>>> Version 2.2.1 (2012-10-21 16:57:04) stable
>>>> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
>>>> MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), IMAP(imaplib)
>>>> WARNING:web2py:import IPython error; use default python shell
>>>> Python 2.7.3 (default, May 18 2012, 14:51:16)
>>>> [GCC 4.4.6 20110731 (Red Hat 4.4.6

[web2py] Re: Import error with 2.2.1

2012-11-05 Thread Neil
No problem. Here is what I get:

>>> import matplotlib.pylab
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
"/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/pylab.py",
 
line 221, in 
from matplotlib import mpl  # pulls in most modules
  File 
"/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
"/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl.py",
 
line 10, in 
from matplotlib import figure
  File 
"/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
"/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/figure.py",
 
line 29, in 
from projections import projection_factory, get_projection_names, \
  File 
"/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
"/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py",
 
line 1, in 
from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
ImportError: cannot import name AitoffAxes

On Friday, November 2, 2012 3:48:53 PM UTC, Massimo Di Pierro wrote:
>
> I need your help. In gluon/custom_import.py can you replace
>
> except ImportError, e1: # line 84
> import_tb = sys.exc_info()[2]
> try:
> return NATIVE_IMPORTER(name, globals, locals, fromlist, 
> level) # line 87
> except ImportError, e3:
> raise ImportError, e1, import_tb  # there an import error 
> in the module
>
> with
>
> except ImportError, e1: # line 84
> import_tb = sys.exc_info()[2]
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level) 
> # line 87
>
> and see what changes?
>
>
>
> On Friday, 2 November 2012 09:09:03 UTC-5, Neil wrote:
>>
>> Can't see any potential conflicts. I have the problem for both 
>> track_changes(True) and track_changes(False). When I import from shell:
>>
>> [aicbt@web331 web2py2.2.1]$ python web2py.py -S init
>> web2py Web Framework
>> Created by Massimo Di Pierro, Copyright 2007-2012
>> Version 2.2.1 (2012-10-21 16:57:04) stable
>> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
>> MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), IMAP(imaplib)
>> WARNING:web2py:import IPython error; use default python shell
>> Python 2.7.3 (default, May 18 2012, 14:51:16)
>> [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> (InteractiveConsole)
>> >>> import matplotlib.pylab
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File 
>> "/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
>> line 77, in custom_importer
>> raise ImportError, 'Cannot import module %s' % str(e)
>> ImportError: Cannot import module 'matplotlib'
>>
>> This shell command works with web2py version 2.1. Also, "import 
>> matplotlib" (without the pylab) works fine for 2.2.1.
>>
>> On Friday, November 2, 2012 1:22:03 PM UTC, Massimo Di Pierro wrote:
>>>
>>> Do you have anything in your app/modules/*  that may conflict? Did you 
>>> set track_changes(True) or not? If you do web2py.py -S yourapp can you 
>>> import form the web2py shell?
>>>
>>> On Friday, 2 November 2012 02:18:47 UTC-5, Neil wrote:
>>>>
>>>> A little more info:
>>>>
>>>> - On linux (works fine on Windows)
>>>> - matplotlib is an egg in the lib directory
>>>> - "import matplotlib" works, but "import matplotlib.pylab" doesn't
>>>> - Has worked fine in every version up to 2.1
>>>>
>>>> Any ideas for a workaround or to debug further?
>>>>
>>>> On Thursday, November 1, 2012 9:52:57 PM UTC, Massimo Di Pierro wrote:
>>>>>
>>>>> Where is matplotlib installed?
>>>>>
>>>>> On Thursday, 1 November 2012 15:51:14 UTC-5, Neil wrote:
>>>>>>
>>>>>> I just upgraded from 2.1 to 2.2.1, and I can no longer import 
>>>>>> matplotlib. I get the following error:
>>>>>>
>>>>>> ImportError: Cannot import module 'matplotlib'
>>>>>>
>>>>>>
>>>>>> Is this related to the custom import? Perhaps it is the same as issue 
>>>>>> 1125?
>>>>>>
>>>>>>

-- 





[web2py] Re: Import error with 2.2.1

2012-11-02 Thread Neil
Can't see any potential conflicts. I have the problem for both 
track_changes(True) and track_changes(False). When I import from shell:

[aicbt@web331 web2py2.2.1]$ python web2py.py -S init
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.2.1 (2012-10-21 16:57:04) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), IMAP(imaplib)
WARNING:web2py:import IPython error; use default python shell
Python 2.7.3 (default, May 18 2012, 14:51:16)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import matplotlib.pylab
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py", 
line 77, in custom_importer
raise ImportError, 'Cannot import module %s' % str(e)
ImportError: Cannot import module 'matplotlib'

This shell command works with web2py version 2.1. Also, "import matplotlib" 
(without the pylab) works fine for 2.2.1.

On Friday, November 2, 2012 1:22:03 PM UTC, Massimo Di Pierro wrote:
>
> Do you have anything in your app/modules/*  that may conflict? Did you set 
> track_changes(True) or not? If you do web2py.py -S yourapp can you import 
> form the web2py shell?
>
> On Friday, 2 November 2012 02:18:47 UTC-5, Neil wrote:
>>
>> A little more info:
>>
>> - On linux (works fine on Windows)
>> - matplotlib is an egg in the lib directory
>> - "import matplotlib" works, but "import matplotlib.pylab" doesn't
>> - Has worked fine in every version up to 2.1
>>
>> Any ideas for a workaround or to debug further?
>>
>> On Thursday, November 1, 2012 9:52:57 PM UTC, Massimo Di Pierro wrote:
>>>
>>> Where is matplotlib installed?
>>>
>>> On Thursday, 1 November 2012 15:51:14 UTC-5, Neil wrote:
>>>>
>>>> I just upgraded from 2.1 to 2.2.1, and I can no longer import 
>>>> matplotlib. I get the following error:
>>>>
>>>> ImportError: Cannot import module 'matplotlib'
>>>>
>>>>
>>>> Is this related to the custom import? Perhaps it is the same as issue 1125?
>>>>
>>>>

-- 





[web2py] Re: Import error with 2.2.1

2012-11-02 Thread Neil
A little more info:

- On linux (works fine on Windows)
- matplotlib is an egg in the lib directory
- "import matplotlib" works, but "import matplotlib.pylab" doesn't
- Has worked fine in every version up to 2.1

Any ideas for a workaround or to debug further?

On Thursday, November 1, 2012 9:52:57 PM UTC, Massimo Di Pierro wrote:
>
> Where is matplotlib installed?
>
> On Thursday, 1 November 2012 15:51:14 UTC-5, Neil wrote:
>>
>> I just upgraded from 2.1 to 2.2.1, and I can no longer import matplotlib. 
>> I get the following error:
>>
>> ImportError: Cannot import module 'matplotlib'
>>
>>
>> Is this related to the custom import? Perhaps it is the same as issue 1125?
>>
>>

-- 





[web2py] Import error with 2.2.1

2012-11-01 Thread Neil
I just upgraded from 2.1 to 2.2.1, and I can no longer import matplotlib. I 
get the following error:

ImportError: Cannot import module 'matplotlib'


Is this related to the custom import? Perhaps it is the same as issue 1125?

-- 





Re: [web2py] Re: Cannot login via web2py mobile admin (V 2.0.6)

2012-10-09 Thread Neil
New mobile admin looks great. 

However, trunk doesn't seem to come with jquery.mobile-1.2.0.min.js 
& jquery.mobile-1.2.0.min.css, so it doesn't work out of the box. Not sure 
if this is by design, but for anyone else who's noticed it you can download 
from http://jquerymobile.com/download/

Neil

On Friday, October 5, 2012 4:58:16 PM UTC+1, Massimo Di Pierro wrote:
>
> There is a new link under the admin site page "Try mobile admin". If you 
> have never tried the mobile admin, you can click from the browser and it 
> will "emulate" an iPhone.
>
> On Friday, 5 October 2012 10:24:52 UTC-5, Massimo Di Pierro wrote:
>>
>> This should now be fixed!
>>
>> On Wednesday, 26 September 2012 05:39:24 UTC-5, Johann Spies wrote:
>>>
>>>
>>>
>>> On 25 September 2012 16:37, Oli  wrote:
>>>
>>>> I also have the same Problem with Samsung SII.
>>>>
>>>>
>>> And with the Motorola Razr XT910.
>>>
>>> I also cannot login into a normal app using the cellphone when using the 
>>> navbar.  However when going to a function that requires authentication, the 
>>> login-screen appears and from there I can login.
>>>
>>> Regards
>>> Johann 
>>>
>>> -- 
>>> Because experiencing your loyal love is better than life itself, 
>>> my lips will praise you.  (Psalm 63:3)
>>>
>>>

-- 





[web2py] Re: invalid table name: no_table

2012-10-01 Thread Neil
Fixed.

On Sunday, September 30, 2012 8:23:47 PM UTC+1, Massimo Di Pierro wrote:
>
> Please try again. I was messing up with trunk.
>
> On Sunday, 30 September 2012 12:43:16 UTC-5, Neil wrote:
>>
>> I just upgraded to 2.0.9, but had some problems with the editor, so I 
>> upgraded to trunk (incidentally, now Ctrl-s doesn't save the file for me in 
>> Chrome, but it works in Firefox).
>>
>> A simple component that used to work now gives the error:
>>
>>  invalid table name: no_table>
>>
>> This is the offending code:
>>
>> def contact():
>> form=SQLFORM.factory(
>> Field('your_email',requires=IS_EMAIL()),
>> Field('question', type='text', requires=IS_NOT_EMPTY()))
>>
>> Anyone know what would cause this?
>>
>> Neil
>>
>>
>>

-- 





[web2py] invalid table name: no_table

2012-09-30 Thread Neil
I just upgraded to 2.0.9, but had some problems with the editor, so I 
upgraded to trunk (incidentally, now Ctrl-s doesn't save the file for me in 
Chrome, but it works in Firefox).

A simple component that used to work now gives the error:

 invalid table name: no_table>

This is the offending code:

def contact():
form=SQLFORM.factory(
Field('your_email',requires=IS_EMAIL()),
Field('question', type='text', requires=IS_NOT_EMPTY()))

Anyone know what would cause this?

Neil


-- 





[web2py] Re: Responsive website (my first one, built using web2py)

2012-09-04 Thread Neil Harding
The web2py modifications include the 

{{is_mobile=request.user_agent().is_mobile}}
{{def SKYPE(number,phone):}}
{{=number}}
{{return}}


So I can use SKYPE('xxx-xxx-','+1xx') which expands to  to handle that. I use it as 
follows {{=DEFER(URL('static/images','staff.jpg'),'Staff')}} and that 
generates code like

resizeImage(
"/welcome/static/images/","staff.jpg","Staff","") 

You can see the source for resizeImage at the website, but I wrap the image 
in a  tag which opens the full size version of the image (unless it was 
already full size), and loads the image from 1280/ 1024/ 960/ 800/ etc 
directories. This means that mobile devices can be served a lower size 
image to cut down on the bandwidth used, and also allows for the tweaks 
rather than just a straight size reduction such as cropping a particular 
image at lower resolutions.

I added the code for DEFER to html.py as

class DEFER(XmlComponent):


tag = 'IMG'


def __init__(self,url,alt=None,_class=None):
self.url = url
self.text = ' wrapping around the image.

Neil Harding

On Tuesday, September 4, 2012 5:15:47 AM UTC-7, Alan wrote:
>
> responsive layouts are pretty amazing, working through my own design at 
> the moment after following the guide below:
>
>
> http://webdesign.tutsplus.com/tutorials/complete-websites/building-a-responsive-layout-with-skeleton-navigation/
>
> might want to take a look so that the menu alters to a select dropdown to 
> be more mobile friendly.
>
> not sure i get what you mean on modifying web2py, the media screen part of 
> the above tutorial should come in handy for scaled images along with the 
> flexslider code - this is what i intend to do.
>
>

-- 





[web2py] Responsive website (my first one, built using web2py)

2012-09-04 Thread Neil Harding
I just made my first website using responsive coding style, I modified 
web2py so that I can use DEFER(URL(),"alt text") and it will load from 320/ 
480/ 640/ sub directories depending on the client resolution. It seems to 
work ok, anyone got any feedback? I also added a SKYPE which does callto: 
or tel: depending on whether it is desktop or mobile (callto: is used by 
Skype, and tel: is common on mobile phones). You can see the site at 
http://www.residenciapacifica.com It's a fairly simple website with 
multiple columns on the index page, but the contact us page has responsive 
layout, and the images can also be clicked to bring up the full resolution 
automatically (unless you are running > 1280 pixels, in which case you are 
seeing the full resolution for the images already).

I can make the changes available, although I was using the previous of 
web2py, so I want to upgrade to that first.

Neil Harding

-- 





[web2py] map_hyphens and pattern-based routes

2012-08-16 Thread Neil
Hopefully this is an easy one. 

I'm using a pattern-based routes.py file. How can I enable 
"map_hyphens" functionality? Do I have to come up with a regex for my 
routes_in and routes_out, or is there a way to mix pattern-based and 
parameter-based systems?

Thanks,
Neil

-- 





Re: [web2py] User accessed site without logging in

2012-07-25 Thread Neil
This is very useful information - I was always unsure about using async. 
Thanks a lot!

On Wednesday, July 25, 2012 6:49:39 PM UTC+1, Roberto De Ioris wrote:
>
>
> You can get the updated stable-branch from here: 
>
> http://projects.unbit.it/hg/uwsgi-1.2 
>
> (the maintainance release will be tomorrow) 
>
> but generally you will get not advantages in using plain async mode with 
> web2py (probably that's why the bug popped up so late) 
>
>
>

-- 





Re: [web2py] User accessed site without logging in

2012-07-25 Thread Neil
I got to the point where I could reproduce this locally using incognito 
mode. Looks like it is a known uwsgi bug that was just patched 3 days ago:

http://stackoverflow.com/questions/11598935/uwsgi-resends-headers-in-async-mode
 

To anyone else using a recent version of uwsgi - you might want to turn off 
async, or you could get some very undesirable behaviour (and angry users)!

On Wednesday, July 25, 2012 2:49:48 PM UTC+1, Massimo Di Pierro wrote:
>
> The author of the post below says:
> "These are 2 distinct clients. I opened an incognito session, confirmed 
> that no cookie was sent in the headers, and the uwsgi log shows that it 
> received the same HTTP_COOKIE."
>
> This could very much be the problem. It would definitively cause the 
> behavior you see.
> I still do not understand what uwsgi is doing. Is it proxing cookies? And 
> what does facebooks and iDevices have to do with this? 
>
> I have a theory. the problems where from iDevices. Probably they are going 
> over phone networks. Perhaps they have IPv6 addresses. Perhaps uWSGI gets 
> confused by this or by some other weird parameter in the HTTP_HEADER coming 
> from these devices. One symptom is that it assigns cliend_addr = "unknown" 
> as we have seen before. It is possible that uWSGI by default caches cookies 
> from the same client addr. I do not understand why it would do that but it 
> could be. Perhaps uWSGI is as fast as it is because it skips some proper 
> header parsing.
>
> Massimo
>

-- 





Re: [web2py] User accessed site without logging in

2012-07-25 Thread Neil
Could this be related?

http://stackoverflow.com/questions/11092444/nginx-keeps-passing-the-same-http-cookie-to-uwsgi
 

It's a little beyond me, but I notice that HTTP_REFERER is facebook in both 
cases, and they are also using nginx+uwsgi.

On Wednesday, July 25, 2012 12:07:26 PM UTC+1, Neil wrote:
>
> Perhaps a coincidence, but:
>
> User 1 - Accessed my site through a Facebook link on iPhone
> User 2 - Accessed my site through a Facebook link on iPad
>
> Does FB do anything strange with links to external sites that could cause 
> the request.client to be unknown? I've accessed my site through the FB link 
> using my Android mobile, and no noticeable problems.
>
> On Wednesday, July 25, 2012 9:27:36 AM UTC+1, Neil wrote:
>>
>> Incidentally, no problems importing urandom.
>>
>> On Wednesday, July 25, 2012 8:10:53 AM UTC+1, Neil wrote:
>>>
>>>
>>>>>>>> Issue #2
>>>>>>>> ===
>>>>>>>>
>>>>>>>> There is a bug with may prevent urandom from working:
>>>>>>>>
>>>>>>>> http://community.webfaction.**com/questions/9333/**
>>>>>>>> importerror-cannot-import-**name-urandom<http://community.webfaction.com/questions/9333/importerror-cannot-import-name-urandom>
>>>>>>>> http://stackoverflow.com/**questions/10776797/error-when-**
>>>>>>>> importing-wsgihandler-with-**django<http://stackoverflow.com/questions/10776797/error-when-importing-wsgihandler-with-django>
>>>>>>>>
>>>>>>>> Can you check if you can import urandom on your version of python 
>>>>>>>> on webfaction?
>>>>>>>>
>>>>>>>>
>>>>>>>>

-- 





Re: [web2py] User accessed site without logging in

2012-07-25 Thread Neil
Perhaps a coincidence, but:

User 1 - Accessed my site through a Facebook link on iPhone
User 2 - Accessed my site through a Facebook link on iPad

Does FB do anything strange with links to external sites that could cause 
the request.client to be unknown? I've accessed my site through the FB link 
using my Android mobile, and no noticeable problems.

On Wednesday, July 25, 2012 9:27:36 AM UTC+1, Neil wrote:
>
> Incidentally, no problems importing urandom.
>
> On Wednesday, July 25, 2012 8:10:53 AM UTC+1, Neil wrote:
>>
>>
>>>>>>> Issue #2
>>>>>>> ===
>>>>>>>
>>>>>>> There is a bug with may prevent urandom from working:
>>>>>>>
>>>>>>> http://community.webfaction.**com/questions/9333/**
>>>>>>> importerror-cannot-import-**name-urandom<http://community.webfaction.com/questions/9333/importerror-cannot-import-name-urandom>
>>>>>>> http://stackoverflow.com/**questions/10776797/error-when-**
>>>>>>> importing-wsgihandler-with-**django<http://stackoverflow.com/questions/10776797/error-when-importing-wsgihandler-with-django>
>>>>>>>
>>>>>>> Can you check if you can import urandom on your version of python on 
>>>>>>> webfaction?
>>>>>>>
>>>>>>>
>>>>>>>

-- 





Re: [web2py] User accessed site without logging in

2012-07-25 Thread Neil
Incidentally, no problems importing urandom.

On Wednesday, July 25, 2012 8:10:53 AM UTC+1, Neil wrote:
>
>
>>>>>> Issue #2
>>>>>> ===
>>>>>>
>>>>>> There is a bug with may prevent urandom from working:
>>>>>>
>>>>>> http://community.webfaction.**com/questions/9333/**
>>>>>> importerror-cannot-import-**name-urandom<http://community.webfaction.com/questions/9333/importerror-cannot-import-name-urandom>
>>>>>> http://stackoverflow.com/**questions/10776797/error-when-**
>>>>>> importing-wsgihandler-with-**django<http://stackoverflow.com/questions/10776797/error-when-importing-wsgihandler-with-django>
>>>>>>
>>>>>> Can you check if you can import urandom on your version of python on 
>>>>>> webfaction?
>>>>>>
>>>>>>
>>>>>>

-- 





Re: [web2py] User accessed site without logging in

2012-07-25 Thread Neil
Quick update: 

-* I had another report of this happening during the night*. I have 
disabled everything past the main page until I can get to the bottom of this
- Waiting for more information from the user. i.e. to get their platform 
and the link they clicked
- I know that the user they were erroneously logged in as had been active 
on the site around the time.
- I rolled back to stable before this happened, so it isn't a problem with 
trunk
- Using webfaction/nginx/uwsgi (ver 1.2.4)

Neil


On Tuesday, July 24, 2012 11:53:26 PM UTC+1, Craig Younkins wrote:
>
> What is the deployment configuration? What wsgi server and what web server?
>
> Craig Younkins
>
>
> On Tue, Jul 24, 2012 at 5:55 PM, Massimo Di Pierro  wrote:
>
>> Is there an open issue about this? If not, can you open one with more 
>> details?
>>
>>
>> On Tuesday, 24 July 2012 16:31:52 UTC-5, howesc wrote:
>>
>>> one other scenario..
>>>
>>> i reported a few months back that running web2py on GAE with python2.7 
>>> and multi-threading had odd behaviors with the globals (request, response, 
>>> session).  i have yet tracked down the issues i was having (might have been 
>>> a coding error on my part).but if you are using GAE + multithreading 
>>> i'd be interested to know that.
>>>
>>> cfh
>>>
>>> On Tuesday, July 24, 2012 1:26:21 PM UTC-7, Massimo Di Pierro wrote:
>>>>
>>>> Perhaps it would be safe to block access to the site if request.client 
>>>> is "unknown".
>>>> I think we should change web2py to block access to any web2py app if 
>>>> request.client does not validate as an IP address.
>>>>
>>>> Massimo
>>>>
>>>> On Tuesday, 24 July 2012 15:24:06 UTC-5, Massimo Di Pierro wrote:
>>>>>
>>>>> Here is a possible cause of the problem although I am not sure.
>>>>> There are two possible issues which may conspire to create this 
>>>>> problem.
>>>>>
>>>>> Issue #1
>>>>> ===
>>>>>
>>>>> There is a session file in the app you sent me called:
>>>>>
>>>>> unknown-c4571a37...
>>>>>
>>>>> session files should be
>>>>>
>>>>> -.
>>>>>
>>>>> This means that one of the HEADERS http_x_forwarded_for or remote_addr 
>>>>> has a value "unknown". 
>>>>>
>>>>> A first google search retuned:
>>>>> http://nixforums.org/**about154671-Hacking-X-**Forwarded-For.html<http://nixforums.org/about154671-Hacking-X-Forwarded-For.html>
>>>>> which opens the possibility the the web server, in your case nginx, is 
>>>>> not finding the client ip address (how is that possible) and setting it 
>>>>> to 
>>>>> unknown. This should never happen. The client_addr is a required field 
>>>>> for 
>>>>> WSGI.
>>>>>
>>>>> This could be the result of a hacking attempt but it would required 
>>>>> both parties doing the hacking for the sessions to be mixed up.
>>>>>
>>>>> Issue #2
>>>>> ===
>>>>>
>>>>> There is a bug with may prevent urandom from working:
>>>>>
>>>>> http://community.webfaction.**com/questions/9333/**
>>>>> importerror-cannot-import-**name-urandom<http://community.webfaction.com/questions/9333/importerror-cannot-import-name-urandom>
>>>>> http://stackoverflow.com/**questions/10776797/error-when-**
>>>>> importing-wsgihandler-with-**django<http://stackoverflow.com/questions/10776797/error-when-importing-wsgihandler-with-django>
>>>>>
>>>>> Can you check if you can import urandom on your version of python on 
>>>>> webfaction?
>>>>>
>>>>>
>>>>> It is therefore theoretically possible that, given the concurrency 
>>>>> model of nginx, if two users visit the site very close to each other, 
>>>>> with 
>>>>> urandom missing, both declaring the same incorrect client ip (unknown), 
>>>>> they get assigned the same session id. This is because web2py has no way 
>>>>> of 
>>>>> distinguishing the two users and lacks a proper random number generator.
>>>>>
>>>>> TODO:
>>>>>
>>>>> 1) check if you can import urandom
>

[web2py] Re: User accessed site without logging in

2012-07-24 Thread Neil
Here is what she told me:

1. She clicked a link (from Facebook), and was taken directly to one of the 
pages for logged in users. I think this was her first visit to the site.
2. She went back to Facebook, and re-clicked the link, and was again taken 
to a user page
3. She clicked the "Logout" link, and could no longer access user pages. 
She never tried to logon or register.

Hardly seems possible to me, and I would have been very sceptical about the 
whole thing except that she told me the name of the other user (which she 
would have had no way of knowing).

I'll send you a copy of the app.

Neil

On Tuesday, July 24, 2012 4:43:44 PM UTC+1, Massimo Di Pierro wrote:
>
> We will investigate this throughly but please get as much information as 
> possible about what this person was doing. Did he try login? Could you also 
> send me a copy of your app (confidentially)?
>
> The fact is even if there were a session conflict (I do not believe that 
> is possible unless uuid is broken) a client must request the session via a 
> cookie. A new user always gets assigned a new session id and therefore an 
> empty session.
>
> Trunk contains experimental code for sessions in cookies. That code does 
> not work yet. I am assuming you are not using that anyway.
>
> Trunk also contains a new password crypt handling. One version of it was 
> broken (nobody could login). We are testing that too. 
>
> Massimo
>
>
>
>
>
> On Tuesday, 24 July 2012 07:18:45 UTC-5, Neil wrote:
>>
>> I just heard from someone who had never been to my site before. When she 
>> visited (on her phone), it was already logged on as another user. This 
>> other user (she told me his name) is located on the other side of the 
>> world, and may or may not have logged out. I'm rather worried - she was 
>> accessing functions decorated with @auth.requires_login() without even 
>> having an account, let alone logging in! Once she clicked "logout" she was 
>> no longer able to access any user pages.
>>
>> I understand this will be tough to debug with so little information. 
>> Furthermore, I've never observed this behaviour personally. However, it's 
>> concerning enough that I thought I'd see if anyone else 
>> has experienced such a thing. If not, any ideas how such a thing could even 
>> happen?
>>
>> I'm using trunk - I suppose I should roll back to stable?
>>
>> Neil
>>
>>

-- 





Re: [web2py] User accessed site without logging in

2012-07-24 Thread Neil
Good point about trunk. There are some features that I liked and got used 
to, but nothing essential.  

I'll try to summarize any relevant settings in the hope that someone can 
spot something.

In 0.py I have:

...
settings.login_method = 'local'
settings.login_config = ''
...

in db.py:

...
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()
auth.define_tables()
db.auth_user.last_name.requires = None
auth.settings.actions_disabled.append('register')
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = True
auth.settings.reset_password_requires_verification = False
auth.settings.login_next = URL("social_anxiety", "user_main")
auth.settings.logout_next = URL("default", "index")
...

and in default.py:


def index():
session.forget(response)
if auth.is_logged_in():
redirect(URL(c='social_anxiety', f='user_main'))
else:
return dict() 

def user(): 
if request.args(0) == 'register':
db.auth_user.first_name.comment = '(or an anonymous user name)'
elif request.args(0) == 'profile':
redirect(URL(c='default', f='user_profile'))

return dict(form = auth())

and in layout.html to create the navbar:

{{try:}}
{{=auth.navbar(referrer_actions=None)}}
{{except:pass}}

Anything stand out? In particular, anything that would apply one user's 
session to another user on a different computer?

Now that I look at it, "session.forget" in application/default/index seems 
like a bad idea. I put it in to see if I could speed up the main page and 
kind of forgot about it... Just removed it.

Neil


On Tuesday, July 24, 2012 2:11:25 PM UTC+1, Richard wrote:
>
> For sure using trunk is not very safe in production environnement, not 
> because it not secure, but because sometimes things brake when new features 
> are added. If you don't need edge feature, better to stick with stable.
>
> For the problem you describe, I think if you show us the way you activate 
> auth could help. I mean it is not just a matter of using decorator... 
>
> I am not the best one to help you fix this issue, but if you give us more 
> information like what's in you db.py and all the auth setting you set, I am 
> sure there is more knowledge users that will be kind and will help.
>
> Richard
>
>
>
> On Tue, Jul 24, 2012 at 8:18 AM, Neil:
>
>> I just heard from someone who had never been to my site before. When she 
>> visited (on her phone), it was already logged on as another user. This 
>> other user (she told me his name) is located on the other side of the 
>> world, and may or may not have logged out. I'm rather worried - she was 
>> accessing functions decorated with @auth.requires_login() without even 
>> having an account, let alone logging in! Once she clicked "logout" she was 
>> no longer able to access any user pages.
>>
>> I understand this will be tough to debug with so little information. 
>> Furthermore, I've never observed this behaviour personally. However, it's 
>> concerning enough that I thought I'd see if anyone else 
>> has experienced such a thing. If not, any ideas how such a thing could even 
>> happen?
>>
>> I'm using trunk - I suppose I should roll back to stable?
>>
>> Neil
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] User accessed site without logging in

2012-07-24 Thread Neil
I just heard from someone who had never been to my site before. When she 
visited (on her phone), it was already logged on as another user. This 
other user (she told me his name) is located on the other side of the 
world, and may or may not have logged out. I'm rather worried - she was 
accessing functions decorated with @auth.requires_login() without even 
having an account, let alone logging in! Once she clicked "logout" she was 
no longer able to access any user pages.

I understand this will be tough to debug with so little information. 
Furthermore, I've never observed this behaviour personally. However, it's 
concerning enough that I thought I'd see if anyone else 
has experienced such a thing. If not, any ideas how such a thing could even 
happen?

I'm using trunk - I suppose I should roll back to stable?

Neil

-- 





Re: [web2py] uWSGI and routes.py

2012-07-22 Thread Neil
Well, I got routes.py logging working, but today I can't reproduce any of 
my strange behaviour from yesterday. I have no idea what could have been 
causing it. I was moving around a lot between different 
servers/configurations/domains/webfaction applications, so perhaps 
something was being cached along the way? 

Alec (who started this thread) - are you still having any troubles with 
routes.py?

You can probably close the issue for now. I'll keep a close on on things, 
and let you know if it happens again. Thanks to everyone for their help - 
hoping to launch (www.ai-therapy.com) later this week! Learning web2py has 
been a pleasure.

On Saturday, July 21, 2012 10:06:32 PM UTC+1, Jonathan Lundell wrote:
>
> On 21 Jul 2012, at 1:38 PM, Neil wrote:
>
> I can confirm that I can't reproduce the behaviour using the same web2py 
> code locally with Rocket on windows. Also, I tried adding:
>
> logging = 'debug'  
>
> and
>
> default_ logging = 'debug'  
>
> to routes.py, and I couldn't get any logged info (on either platform). 
>
>
> Try logging = 'warning' (there is no default_logging, I don't think, in 
> this context). Seems the default threshold for logging is a little higher 
> than I thought. This will log to the console, assuming that you're running 
> in a mode where console logging works (it does running in the foreground 
> with Rocket). If not, you'll need to configure logging.conf to send logging 
> to a file.
>
>
>

-- 





Re: [web2py] uWSGI and routes.py

2012-07-21 Thread Neil
I can confirm that I can't reproduce the behaviour using the same web2py 
code locally with Rocket on windows. Also, I tried adding:

logging = 'debug'  

and

default_ logging = 'debug'  

to routes.py, and I couldn't get any logged info (on either platform). 

Neil

On Saturday, July 21, 2012 7:07:36 PM UTC+1, Jonathan Lundell wrote:
>
> On 21 Jul 2012, at 10:47 AM, Jonathan Lundell wrote: 
> > 
> > On 21 Jul 2012, at 7:42 AM, Massimo Di Pierro wrote: 
> >> Is this reproducible? Can you check if you get the same problem with 
> stable? 
> > 
> > Please try enabling router logging. In routes.py, there is (or should 
> be) a line like this: 
> > 
> > logging = 'debug' 
> > 
> > Try setting it to 'info', which is IIRC the default logging threshold, 
> and if necessary enable some kind of logging that you can see. 
> > 
> > Thanks. 
> > 
> >> 
> >> I do not think this is a uWSGI issue. Please open an issue on google 
> code. 
> > 
>
> FWIW, I tried the trunk with Rocket, running locally, using the example 
> router and reloading the welcome home page, and didn't see a problem. 
> Setting aside the server difference, should that have been enough to 
> reproduce it?

-- 





Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
Sure, I'll create a script once I have a more confidence that everything is 
working. I still don't completely understand some of the settings I've 
found to work, so I'm a little hesitant...

On Saturday, July 21, 2012 3:08:52 PM UTC+1, Massimo Di Pierro wrote:
>
> Neil, do you think it is work including a start-up script in 
> web2py/scripts/? Would you submit one?
>
> On Saturday, 21 July 2012 05:25:18 UTC-5, Neil wrote:
>>
>> I came across that same error when I tried:
>>
>> uwsgi --protocol=http --socket 127.0.0.1:yourporthere --pythonpath 
>> ~/web2py --module wsgihandler -d ~/tmp/uwsgi.log -t 20 --async 24 
>> --limit-as 64 -r --no-orphans -M -p 1 --touch-reload 
>> ~/tmp/uwsgireload.txt --reload-on-rss 50  
>>
>> (NOTE: ugreen not included). However, when I put ugreen back in and 
>> removed "--limit-as 64", it worked (with ver 1.2.4)
>>
>> Neil
>>
>> On Saturday, July 21, 2012 11:02:51 AM UTC+1, Alec Taylor wrote:
>>>
>>> When I currently visit the site it says: 
>>>
>>> "uWSGI Error 
>>>
>>> Python application not found" 
>>>
>>> The logfile says: 
>>>
>>> Python version: 2.7.3 (default, May 18 2012, 14:51:16)  [GCC 4.4.6 
>>> 20110731 (Red Hat 4.4.6-3)] 
>>> *** Python threads support is disabled. You can enable it with 
>>> --enable-threads *** 
>>> Python main interpreter initialized at 0x219d360 
>>> your server socket listen backlog is limited to 100 connections 
>>> *** Operational MODE: async *** 
>>> added /home/alectaylor/web2py/ to pythonpath. 
>>> Traceback (most recent call last): 
>>>   File "/home/alectaylor/web2py/wsgihandler.py", line 33, in  
>>> import gluon.main 
>>>   File "/home/alectaylor/web2py/gluon/__init__.py", line 15, in  
>>> from globals import current 
>>>   File "/home/alectaylor/web2py/gluon/globals.py", line 17, in  
>>> from storage import Storage, List 
>>>   File "/home/alectaylor/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 *** 
>>> spawned uWSGI master process (pid: 1809) 
>>> spawned uWSGI worker 1 (pid: 1810, cores: 24) 
>>>
>>>
>>> On Sat, Jul 21, 2012 at 7:56 PM, : 
>>> > What is the main issue in your opinion? Did you try running a simple 
>>> wsgi 
>>> > program without web2py? 
>>> > 
>>> > 
>>> > On Saturday, 21 July 2012 04:43:35 UTC-5, Alec Taylor wrote: 
>>> >> 
>>> >> I actually never got it to work on WebFaction... 
>>> >> 
>>> >> I might try every week or so and spend 30 minutes on it, but frankly 
>>> I 
>>> >> don't have the time. 
>>> >> 
>>> >> Also, heroku and openshift are giving me issues with web2py, but it's 
>>> >> something before I throw web2py on it, which is why I haven't posted 
>>> >> on this mailing-list about it >.< 
>>> >> 
>>> >> Lets just say I'm thoroughly annoyed I haven't been able to get 
>>> web2py 
>>> >> hosted and working live 
>>> >> 
>>> >> On Sat, Jul 21, 2012 at 7:15 PM,: 
>>> >> > Figured it out: I removed the "--limit-as 64" argument and now it 
>>> seems 
>>> >> > to 
>>> >> > work. I'm using uwsgi version 1.2.4. Could this cause any problems? 
>>> >> > 
>>> >> > Now, if I can get my static content served directly, I'm ready to 
>>> roll 
>>> >> > with 
>>> >> > Webfaction. Previously, when using nginx+uwsgi, it was using 1-10MB 
>>> of 
>>> >> > memory with every page view! I still don't really understand why 
>>> this 
>>> >> > was 
>>> >> > not being released with that configuration. With the 
>>> "--reload-on-rss" 
>>> >> > flag 
>>> >> > set, the uwsgi processes were being restarted every few minutes, 
>>> and 
>>> >> > that 
>>> >> > was just with one person viewing the site (me)! 
>>> >> > 
>>> >> > 
>>> >> > On Saturday, July 21, 2012 9:33:56 AM UTC+1, Neil wrote: 
>>> >> >> 
>>> >> >> I'm following these instructions, and get stuck at the same point: 
>>> >> >> 
>>> >> >> initializing 24 uGreen threads with stack size of 262144 (256 KB) 
>>> >> >> mprotect(): Invalid argument [plugins/ugreen/ugreen.c line 109] 
>>> >> >> 
>>> >> >> How did you fix this? 
>>> >> >> 
>>> >> >> On Thursday, July 5, 2012 4:17:48 PM UTC+1, Alec Taylor wrote: 
>>> >> >>> 
>>> >> >>> Alright, fixed that last error, 
>>> >> >> 
>>> >> >> 
>>> >> >> 
>>> >> > 
>>> >> > -- 
>>> >> > 
>>> >> > 
>>> >> > 
>>> > 
>>> > -- 
>>> > 
>>> > 
>>> > 
>>>
>>

-- 





[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Neil
Just checked, and I don't have this problem with stable. After a bit more 
testing, it appears that routes turns on and off sporadically. For example, 
if I set the default application to "examples", and hit refresh on the root 
domain 10 times, sometimes the welcome application loads and sometimes 
examples. I'll open an issue.

On Saturday, July 21, 2012 3:42:01 PM UTC+1, Massimo Di Pierro wrote:
>
> Is this reproducible? Can you check if you get the same problem with 
> stable? 
>
> I do not think this is a uWSGI issue. Please open an issue on google code.
>
>

-- 





[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Neil
Trunk. routes seems to work for a minute or two, and then stops until I 
click the reload button. Not sure if this is a uwsgi issue or not.

On Saturday, July 21, 2012 3:11:29 PM UTC+1, Massimo Di Pierro wrote:
>
> Using stable or trunk?
>
>
> On Saturday, 21 July 2012 07:06:02 UTC-5, Neil wrote:
>>
>> I'm going through this exact thing at the moment. I was wondering if it 
>> was because I am testing out the dev version of web2py, but I guess not. If 
>> I click the "reload routes" link on the main admin page it works. At least 
>> temporarily - I'm experiencing some strange behaviour. I know I have to 
>> click the button every time I restart uwsgi. Let me know if you figure 
>> anything out.
>>
>> On Saturday, July 21, 2012 12:16:28 PM UTC+1, Alec Taylor wrote:
>>>
>>> Does uWSGI work with routes.py?
>>>
>>> The section in chapter 1 of the "web2py Application Development 
>>> Cookbook" didn't mentioned routes...
>>>
>>> But when I copied my routes.py over and started the uWSGI server, I 
>>> became unable to get to any page apart from the `/admin/` ones. I couldn't 
>>> even access the welcome app!
>>>
>>> FYI: Here is my routes.py - http://pastebin.com/KuVAgiCR
>>>
>>> (I plan on changing that routes even further, see: 
>>> https://groups.google.com/forum/#!topic/web2py/Zmzo3BeQQ7g for my plans)
>>>
>>> How do I get routing to work properly with uWSGI?
>>>
>>> Thanks for all suggestions,
>>>
>>> Alec Taylor
>>>
>>

-- 





[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Neil
I'm going through this exact thing at the moment. I was wondering if it was 
because I am testing out the dev version of web2py, but I guess not. If I 
click the "reload routes" link on the main admin page it works. At least 
temporarily - I'm experiencing some strange behaviour. I know I have to 
click the button every time I restart uwsgi. Let me know if you figure 
anything out.

On Saturday, July 21, 2012 12:16:28 PM UTC+1, Alec Taylor wrote:
>
> Does uWSGI work with routes.py?
>
> The section in chapter 1 of the "web2py Application Development Cookbook" 
> didn't mentioned routes...
>
> But when I copied my routes.py over and started the uWSGI server, I became 
> unable to get to any page apart from the `/admin/` ones. I couldn't even 
> access the welcome app!
>
> FYI: Here is my routes.py - http://pastebin.com/KuVAgiCR
>
> (I plan on changing that routes even further, see: 
> https://groups.google.com/forum/#!topic/web2py/Zmzo3BeQQ7g for my plans)
>
> How do I get routing to work properly with uWSGI?
>
> Thanks for all suggestions,
>
> Alec Taylor
>

-- 





Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
I came across that same error when I tried:

uwsgi --protocol=http --socket 127.0.0.1:yourporthere --pythonpath 
~/web2py --module wsgihandler -d ~/tmp/uwsgi.log -t 20 --async 24 
--limit-as 64 -r --no-orphans -M -p 1 --touch-reload 
~/tmp/uwsgireload.txt --reload-on-rss 50  

(NOTE: ugreen not included). However, when I put ugreen back in and removed 
"--limit-as 64", it worked (with ver 1.2.4)

Neil

On Saturday, July 21, 2012 11:02:51 AM UTC+1, Alec Taylor wrote:
>
> When I currently visit the site it says: 
>
> "uWSGI Error 
>
> Python application not found" 
>
> The logfile says: 
>
> Python version: 2.7.3 (default, May 18 2012, 14:51:16)  [GCC 4.4.6 
> 20110731 (Red Hat 4.4.6-3)] 
> *** Python threads support is disabled. You can enable it with 
> --enable-threads *** 
> Python main interpreter initialized at 0x219d360 
> your server socket listen backlog is limited to 100 connections 
> *** Operational MODE: async *** 
> added /home/alectaylor/web2py/ to pythonpath. 
> Traceback (most recent call last): 
>   File "/home/alectaylor/web2py/wsgihandler.py", line 33, in  
> import gluon.main 
>   File "/home/alectaylor/web2py/gluon/__init__.py", line 15, in  
> from globals import current 
>   File "/home/alectaylor/web2py/gluon/globals.py", line 17, in  
> from storage import Storage, List 
>   File "/home/alectaylor/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 *** 
> spawned uWSGI master process (pid: 1809) 
> spawned uWSGI worker 1 (pid: 1810, cores: 24) 
>
>
> On Sat, Jul 21, 2012 at 7:56 PM, : 
> > What is the main issue in your opinion? Did you try running a simple 
> wsgi 
> > program without web2py? 
> > 
> > 
> > On Saturday, 21 July 2012 04:43:35 UTC-5, Alec Taylor wrote: 
> >> 
> >> I actually never got it to work on WebFaction... 
> >> 
> >> I might try every week or so and spend 30 minutes on it, but frankly I 
> >> don't have the time. 
> >> 
> >> Also, heroku and openshift are giving me issues with web2py, but it's 
> >> something before I throw web2py on it, which is why I haven't posted 
> >> on this mailing-list about it >.< 
> >> 
> >> Lets just say I'm thoroughly annoyed I haven't been able to get web2py 
> >> hosted and working live 
> >> 
> >> On Sat, Jul 21, 2012 at 7:15 PM,: 
> >> > Figured it out: I removed the "--limit-as 64" argument and now it 
> seems 
> >> > to 
> >> > work. I'm using uwsgi version 1.2.4. Could this cause any problems? 
> >> > 
> >> > Now, if I can get my static content served directly, I'm ready to 
> roll 
> >> > with 
> >> > Webfaction. Previously, when using nginx+uwsgi, it was using 1-10MB 
> of 
> >> > memory with every page view! I still don't really understand why this 
> >> > was 
> >> > not being released with that configuration. With the 
> "--reload-on-rss" 
> >> > flag 
> >> > set, the uwsgi processes were being restarted every few minutes, and 
> >> > that 
> >> > was just with one person viewing the site (me)! 
> >> > 
> >> > 
> >> > On Saturday, July 21, 2012 9:33:56 AM UTC+1, Neil wrote: 
> >> >> 
> >> >> I'm following these instructions, and get stuck at the same point: 
> >> >> 
> >> >> initializing 24 uGreen threads with stack size of 262144 (256 KB) 
> >> >> mprotect(): Invalid argument [plugins/ugreen/ugreen.c line 109] 
> >> >> 
> >> >> How did you fix this? 
> >> >> 
> >> >> On Thursday, July 5, 2012 4:17:48 PM UTC+1, Alec Taylor wrote: 
> >> >>> 
> >> >>> Alright, fixed that last error, 
> >> >> 
> >> >> 
> >> >> 
> >> > 
> >> > -- 
> >> > 
> >> > 
> >> > 
> > 
> > -- 
> > 
> > 
> > 
>

-- 





Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
Figured it out: I removed the "--limit-as 64" argument and now it seems to 
work. I'm using uwsgi version 1.2.4. Could this cause any problems?

Now, if I can get my static content served directly, I'm ready to roll with 
Webfaction. Previously, when using nginx+uwsgi, it was using 1-10MB of 
memory with every page view! I still don't really understand why this was 
not being released with that configuration. With the "--reload-on-rss" flag 
set, the uwsgi processes were being restarted every few minutes, and that 
was just with one person viewing the site (me)! 

On Saturday, July 21, 2012 9:33:56 AM UTC+1, Neil wrote:
>
> I'm following these instructions, and get stuck at the same point:
>
> initializing 24 uGreen threads with stack size of 262144 (256 KB) 
> mprotect(): Invalid argument [plugins/ugreen/ugreen.c line 109]  
>
> How did you fix this?
>
> On Thursday, July 5, 2012 4:17:48 PM UTC+1, Alec Taylor wrote:
>>
>> Alright, fixed that last error, 
>>
>
>  
>

-- 





Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
I'm following these instructions, and get stuck at the same point:

initializing 24 uGreen threads with stack size of 262144 (256 KB) 
mprotect(): Invalid argument [plugins/ugreen/ugreen.c line 109]  

How did you fix this?

On Thursday, July 5, 2012 4:17:48 PM UTC+1, Alec Taylor wrote:
>
> Alright, fixed that last error, 
>

 

-- 





[web2py] Re: Web2py expert needed for start-up

2012-07-18 Thread Neil
How does the experts4solutions website work? For example, if I wanted to 
see if anyone (anywhere) was interested in a paid hourly contract, would I 
have to send an individual email to each expert listed? Who does the 
"contact us" form get sent to? It would be really useful to be able to post 
project details just once, and see how is interested.

On Tuesday, July 17, 2012 8:56:02 PM UTC+1, howesc wrote:
>
> to help with your search consider posting here 
> http://experts4solutions.com/ if you haven't already.
>
> On Monday, July 16, 2012 4:23:41 PM UTC-7, Pepe C wrote:
>>
>> Hi, 
>>
>> We have a set of applications on web2py and we are looking for an expert 
>> that can help us to operate and develop them.  This is a long-term role 
>> taking ~10 hours a week, although we do have a bunch of additional work to 
>> get done in the next few weeks. 
>>
>> Responsibilities include:
>>
>>- Development of new web services 
>>- Web2py administration and deployment 
>>- Polishing and addressing bugs in the existing code
>>
>> Experience with Jquery mobile plugin or mobile layouts would be a big 
>> plus.
>>
>> In your replies please tell us about your portfolio, your availability 
>> for the next two months and your hourly rate.
>>
>> Thanks!
>>
>

-- 





[web2py] Re: Form submission and "view page source"

2012-06-29 Thread Neil


>
> It shouldn't happen "randomly". It should only happen when you open the 
> same page (or any page with a form that has the same formname) in the same 
> browser, and then go back to the original page and try to submit the 
> original form. We've talked about allowing multiple versions of the 
> _formkey for the same form to avoid this problem, but that hasn't been 
> implemented yet.
>

Thanks - this has been very useful. It is definitely happening for me 
without opening a new page/tab in the browser, but is very inconsistent. A 
bit more information: my site guides the user from one page to the next, 
but occasionally loops back on itself to an earlier page, depending on user 
input. This problem seems to occur (inconsistently) when revisiting pages 
they've already been to. I suppose there is some sort of conflict with the 
_formname. Assigning a unique formname should do the trick.

Thanks again,
Neil


[web2py] Re: Form submission and "view page source"

2012-06-28 Thread Neil
Update: I have found a post of someone who is having the same problem:

http://stackoverflow.com/questions/7411269/web2py-form-works-as-expected-most-of-the-time-but-occasionally-it-simply-clears
 

With the "view page source", I guess Chrome is reloading the page, so the 
session key no longer matches. 

What is the recommended solution when this seems to happen randomly to some 
pages? Sounds like removing the session from the form opens up 
vulnerabilities.

Neil

On Thursday, June 28, 2012 8:01:42 PM UTC+1, Neil wrote:
>
> I have a page with a simple form on it, and sometimes when I click the 
> submit button, the page just reloads instead of performing correct action. 
> The only way I've found to consistently reproduce the problem is to click 
> "View page source" first (I'm using Chrome). I then noticed this happens in 
> other web2py applications as well. For example, if I fill out the form here:
>
> http://www.web2py.com/examples/form_examples/form 
>
> and click "view the page source" before submitting, the data isn't 
> submitted. Does anyone know why this is? It's not a problem in my case (I 
> don't expect my users to be viewing the page source), but my hope is that 
> if I understand what causes it, I may be able to figure out why it happens 
> randomly for me *without *viewing the source.
>
> Thanks,
> Neil
>


[web2py] Form submission and "view page source"

2012-06-28 Thread Neil
I have a page with a simple form on it, and sometimes when I click the 
submit button, the page just reloads instead of performing correct action. 
The only way I've found to consistently reproduce the problem is to click 
"View page source" first (I'm using Chrome). I then noticed this happens in 
other web2py applications as well. For example, if I fill out the form here:

http://www.web2py.com/examples/form_examples/form 

and click "view the page source" before submitting, the data isn't 
submitted. Does anyone know why this is? It's not a problem in my case (I 
don't expect my users to be viewing the page source), but my hope is that 
if I understand what causes it, I may be able to figure out why it happens 
randomly for me *without *viewing the source.

Thanks,
Neil


[web2py] Re: Admin - edit static files is broken

2012-06-19 Thread Neil
I think I've made some progress. The problem seems to be that since the URL 
has "static" in it, nginx is trying to serve it directly (instead of 
calling "admin/default/edit"). I think the offending lines in nginx.conf 
are the following:

location ~* /(\w+)/static/ {
root /home/aicbt/webapps/nginx_uwsgi_web2py/web2py/applications
/;
}

I don't want to match URLs like this:

http://www.domain.com/admin/default/edit/treatment/static/skeleton/javascripts/tabs.js

but continue to match ones like this:

http://www.domain.com/treatment/static/images/run.jpg

Can anyone recommend a safe update to the regular expression? 

Thanks,
Neil

On Monday, June 18, 2012 9:27:43 PM UTC+1, Neil wrote:
>
> Arnaud - did you find a solution to this?
>
> I am having the same problem: I deployed to nginx, and I can edit the 
> models/views/controllers/etc. without any problems. However, I get a 404 
> when I try to edit static files (like a css). All files appear to have the 
> same permissions. Anyone have ideas of other things I can check?
>
> Thanks,
> Neil
>
> On Sunday, October 3, 2010 10:09:48 AM UTC+1, Arnaud Masselin wrote:
>>
>> Hi MAssimo, 
>>
>> on localhost, I use web2py server. I look in httpd config. 
>>
>> Thanks. 
>>
>>
>> On 2 oct, 22:04, mdipierro  wrote: 
>> > Could be a permission issue. When you open it from localhost do you 
>> > still use lighttpd or do you start web2py user your user account? 
>> > 
>> > On Oct 2, 10:58 am, Arnaud Masselin  wrote: 
>> > 
>> > 
>> > 
>> > > Hi all, 
>> > 
>> > > i have deployed Web2py 1.83.2 on lighttpd production server. And i 
>> > > have a problem for edit css files in the admin interface. I raise a 
>> > > 404 error when I try  to edit files. 
>> > 
>> > > Files seems to be accessible because, for example, /static/ 
>> > > landing_a_default_new.css display content of my css file. 
>> > 
>> > > All others files (language, contoller, html files in views) are 
>> > > editable without problems. 
>> > 
>> > > When i run the same app on localhost, I can edit my css. 
>> > 
>> > > Where comes this problem ? 
>> > 
>> > > Thanks.
>
>

[web2py] Re: Admin - edit static files is broken

2012-06-18 Thread Neil
Arnaud - did you find a solution to this?

I am having the same problem: I deployed to nginx, and I can edit the 
models/views/controllers/etc. without any problems. However, I get a 404 
when I try to edit static files (like a css). All files appear to have the 
same permissions. Anyone have ideas of other things I can check?

Thanks,
Neil

On Sunday, October 3, 2010 10:09:48 AM UTC+1, Arnaud Masselin wrote:
>
> Hi MAssimo, 
>
> on localhost, I use web2py server. I look in httpd config. 
>
> Thanks. 
>
>
> On 2 oct, 22:04, mdipierro  wrote: 
> > Could be a permission issue. When you open it from localhost do you 
> > still use lighttpd or do you start web2py user your user account? 
> > 
> > On Oct 2, 10:58 am, Arnaud Masselin  wrote: 
> > 
> > 
> > 
> > > Hi all, 
> > 
> > > i have deployed Web2py 1.83.2 on lighttpd production server. And i 
> > > have a problem for edit css files in the admin interface. I raise a 
> > > 404 error when I try  to edit files. 
> > 
> > > Files seems to be accessible because, for example, /static/ 
> > > landing_a_default_new.css display content of my css file. 
> > 
> > > All others files (language, contoller, html files in views) are 
> > > editable without problems. 
> > 
> > > When i run the same app on localhost, I can edit my css. 
> > 
> > > Where comes this problem ? 
> > 
> > > Thanks.



[web2py] Re: Remembering selections for form submission

2012-05-12 Thread Neil
Actually, I fixed it another way. My problem was that I was using the same 
options as input for multiple SELECT()s. If I create new instances of 
OPTIONS() for each drop-down box, the state is correctly remembered.

Thanks,
Neil

On Saturday, May 12, 2012 12:22:13 AM UTC+1, Massimo Di Pierro wrote:
>
>
> You need 
>
> name = 'q%d' % (q_num)
> SELECT(,value=request.vars.name or '0',...)
>
> Only SQLFORM remembers the state. primitive tags like SELECT, INPUT, 
> TEXTAREA that do not know state. you must pass state.
>
>
> On Friday, 11 May 2012 15:52:21 UTC-5, Neil wrote:
>>
>> I'm creating a form with drop down boxes like this:
>>
>> SELECT(*options, _name='q%d' % (q_num), requires=IS_IN_SET(['1', '2', 
>> '3', '4', '5'], error_message="Oops, looks like you missed this one.")
>>
>> When  options looks like this:
>>
>> options = ['0', '1', '2', '3', '4', '5']
>>
>> everything is fine. In particular, if there is a form validation error, 
>> the form remembers which options was selected for each item. 
>>
>> However, if  options looks like this:
>>
>> options = [OPTION('', _value='0'),
>>OPTION('Never have the thought', _value='1'),
>>OPTION('Rarely have the thought ', _value='2'),
>>OPTION('Sometimes have the thought', _value='3'),
>>OPTION('Often have the thought', _value='4'),
>>OPTION('Always have the thought', _value='5')]
>>
>> The form initially displays correctly, but when there is a validation 
>> error, it forgets which option was previously selected. In particular, it 
>> always says selected="0".
>>
>> Is this a bug, or am I doing something wrong? Is there a workaround?
>>
>> Neil
>>
>>

[web2py] Remembering selections for form submission

2012-05-11 Thread Neil
I'm creating a form with drop down boxes like this:

SELECT(*options, _name='q%d' % (q_num), requires=IS_IN_SET(['1', '2', '3', 
'4', '5'], error_message="Oops, looks like you missed this one.")

When  options looks like this:

options = ['0', '1', '2', '3', '4', '5']

everything is fine. In particular, if there is a form validation error, the 
form remembers which options was selected for each item. 

However, if  options looks like this:

options = [OPTION('', _value='0'),
   OPTION('Never have the thought', _value='1'),
   OPTION('Rarely have the thought ', _value='2'),
   OPTION('Sometimes have the thought', _value='3'),
   OPTION('Often have the thought', _value='4'),
   OPTION('Always have the thought', _value='5')]

The form initially displays correctly, but when there is a validation 
error, it forgets which option was previously selected. In particular, it 
always says selected="0".

Is this a bug, or am I doing something wrong? Is there a workaround?

Neil