Re: [web2py] Re: 2.9.5-stable Version throws ticket when /admin accessed [CLOSED]

2014-03-22 Thread weheh
OK, the emergency is over! Thanks all for your suggestions.

The solution was for me to go further back in time and copy an older backup 
of admin into place, so admin is working again. Next exercise is to try to 
climb up to 2.7.X, but as I said, I'm held back by this old module I didn't 
write.

Bottom line, Niphlod may be right. We may have silently, and possibly 
unwittingly, deep-sixed python 2.5 by upgrading admin to the with as 
syntax.

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


Re: [web2py] Re: 2.9.5-stable Version throws ticket when /admin accessed [CLOSED]

2014-03-22 Thread weheh
@Niphlod: LOL. That's the same conclusion I came to in about 5 minutes. I 
rejiggered things and am sticking with subprocess module. Unfortunately, 
the damage was already done to my web2py setup. The silver lining to all 
this is I think I figured out how to get to python 2.7.x, so not all was a 
waste.

-- 
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: 2.9.5-stable Version throws ticket when /admin accessed - dead in water

2014-03-21 Thread weheh
Does anyone think that this problem could be a result of installing the 
python multiprocessing module ... the back-port to python 2.5.X?

-- 
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] Version ugrade throws ticket when /admin accessed - dead in water

2014-03-20 Thread weheh
Just upgraded to 2.9.5-stable and ran into an issue. Whenever I try to 
access admin I get an internal error and a ticket. The console complains:


I:\web2py\applications\admin\controllers/default.py:807: Warning: 'with' 
will become a reserved keyword in Python 2.6

I'm running python 2.5.X.

The offending code looks OK. Any ideas?

-- 
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: Version ugrade throws ticket when /admin accessed - dead in water

2014-03-20 Thread weheh
Installation was from source.

-- 
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: 2.9.5-stable Version throws ticket when /admin accessed - dead in water

2014-03-20 Thread weheh
Gaah! I just restored the older version of web2py from which I upgraded 
(ashamed to say it's 2.3.2) and now I'm getting the same error. So 
apparently, something got corrupted along the way. Note to self: don't 
attempt upgrades just before a major release.

-- 
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: Latest thinking -- Bootstrap vs. Foundation?

2014-02-13 Thread weheh
Thanks for the replies, everyone. I think I'm going with Bootstrap.

-- 
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] Latest thinking -- Bootstrap vs. Foundation?

2014-02-10 Thread weheh
I'd just made up my mind to migrate to Bootstrap when a colleague said, 
Foundation. Checking the latest web2py doc, it points to Bootstrap. Would 
a few experienced users mind chiming in about which they prefer with 
web2py, Bootstrap or Foundation? Any gotchas wither way? Both look like 
they'll do the job for me. I just want to keep my sites current with the 
latest trends and also to clean up my css mess. Also, want to stay as 
compatible with web2py as possible. Thanks.

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


[web2py] Re: Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-17 Thread weheh
@Simon  Anthony:

Thanks so much for the pointer. I had forgotten about widgets ... I've 
never had to design one, yet. Can that approach also be adapted to work 
with TinyMCE, instead?

On the surface, TinyMCE looks easier to mod than ckeditor. Also, so far, I 
prefer the TinyMCE doc. The CKEditor website starts out looking promising 
with slick marketing. But their doc isn't as well organized or thoroughly 
presented as TinyMCE.


-- 
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: Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-17 Thread weheh
Update: having now hacked on CKEditor and TinyMCE, I think I'm shifted over 
to TinyMCE. Seems a lot simpler to deal with and more organized. I can't 
vouch for the total functionality of the package, but it seems to do most 
of what I need. The doc and examples are clear, well organized, and 
effective. No marketing fluff.

On Saturday, January 18, 2014 1:12:17 AM UTC+8, weheh wrote:

 @Simon  Anthony:

 Thanks so much for the pointer. I had forgotten about widgets ... I've 
 never had to design one, yet. Can that approach also be adapted to work 
 with TinyMCE, instead?

 On the surface, TinyMCE looks easier to mod than ckeditor. Also, so far, I 
 prefer the TinyMCE doc. The CKEditor website starts out looking promising 
 with slick marketing. But their doc isn't as well organized or thoroughly 
 presented as TinyMCE.




-- 
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] Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-15 Thread weheh
I want to embedded a javascript-based xhtml editor in my app (much like the 
editor in Google groups that I'm using to type this note). The editor 
should work seamlessly with web2py. It must be extensible as I need to add 
modifications. I want it to be able to handle basic html tags (h1, h2 
... p, etc.) and image embed and upload would be nice to have but not 
essential.

I've looked at NicEdit, WYSIHTML5, TinyEditor, and others. From a 
high-level, each seems like it will be a compromise in one form or another. 
Some of these are multiple years old and may be unsupported or out of date.

I'm looking for feedback from users who have studied or actually used an 
embedded jQuery editor and has an opinion about which one is the best and 
easiest to use with web2py and extend with js.

Thanks!

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


[web2py] Re: Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-15 Thread weheh
Good to hear that, since I just downloaded it. THANKS

On Thursday, January 16, 2014 2:18:35 PM UTC+8, Simon Ashley wrote:

 +1 CKeditor seems to work fine, generically linked to text based widgets 
 in models. No heavy demands/ extensions through.


-- 
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: Writing Web2Py specification and finding free lance Web2Py coders

2014-01-11 Thread weheh
http://experts4solutions.com/ 

I've worked with a couple of the people on experts4solutions (I'm one 
myself) and it worked out well.

On Saturday, January 11, 2014 3:31:20 PM UTC+8, Timothy Swieter wrote:

 Ruud - 

 I'll take a look at the organization you linked too.  On the face of it, 
 this may be who I am looking for.  Have you any experience with them?  How 
 are they?  What is their process of definition and development?  

 Any other freelancers or commercial business that develop on Web2Py 
 full-time?  

 Thank you again.  


-- 
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: Translatable string inside jquery selector

2014-01-09 Thread weheh
I believe you will have to execute the jquery selector at least once before 
your string will appear in the language file.

On Friday, January 10, 2014 7:31:40 AM UTC+8, Ruud Schroen wrote:

 I have a translatable string inside a jquery selector. I properly escaped 
 the single quotes cause i don't get an error from jquery. 

 $(#resultemail).removeClass().addClass('error').text('{{=T(Sorry, we 
 don\\'t know you...)}}').fadeTo(900,1);


 But the string is not showing up in my language file, why?

 Note: not sure if it matters, but the string is inside a ajax function 
 (the error part) 
  



-- 
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: Learning Management System survey

2014-01-09 Thread weheh
I missed this thread when it first came out. It would be interesting to 
have this as a plugin of sorts for web2py, maybe like grid.

-- 
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: Happy New Year everybody!

2014-01-02 Thread weheh
Thank you, Massimo and web2py group. Happy New Year everybody! 

On Thursday, January 2, 2014 6:06:30 AM UTC+8, Massimo Di Pierro wrote:

 Happy new year everybody,

 some good news:
 1) python is growing popularity

 https://sites.google.com/site/pydatalog/pypl/python-blog/pythonisthelanguageoftheyear
 2) there will be a web2py tutorial at PyCon. I will tell you more asap!
 3) the web2py community is still growing and in 2013 I saw more and more 
 high quality programs built with web2py.

 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] Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread weheh
Was doing a db migration and ran into this nasty:

Traceback (most recent call last):

  File C:\web2py\gluon\main.py, line 576, in wsgibase
session._try_store_in_cookie_or_file(request, response)
  File C:\web2py\gluon\globals.py, line 749, in _try_store_in_cookie_or_file
self._try_store_in_file(request, response)
  File C:\web2py\gluon\globals.py, line 755, in _try_store_in_file
if not response.session_id or self._forget or self._unchanged():
  File C:\web2py\gluon\globals.py, line 711, in _unchanged
session_pickled = cPickle.dumps(dict(self))
  File c:\Program Files (x86)\Python25\lib\copy_reg.py, line 69, in _reduce_ex
raise TypeError, can't pickle %s objects % base.__name__
TypeError: can't pickle instancemethod objects

-- 
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: Help! Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread weheh
Yes, I already did that. 

On Monday, December 23, 2013 6:38:57 PM UTC+8, Leonel Câmara wrote:

 Delete all session files.  
   
 I have also found that in windows boxes running apache + mod_wsgi, you 
 will constantly run into session errors if you're running more than one 
 web2py instalation as WSGIDaemonProcess doesn't work on windows so you 
 can't have a dedicated wsgi process for each of them.


-- 
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: Help! Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread weheh
I have more details. As stated before, I erased all sessions. That didn't 
fix the problem.

I then did a session.forget() from within my main routine. That got past 
the pickle problem temporarily, but created a lot of other problems. After 
that, I removed the session.forget() operation from the main routine and 
things got back to normal. BUT only for my session.

If I open another session in a different browser. I'm back to square one 
with that browser session. Same TypeError: can't pickle instancemethod 
objects. If I go through the session.forget() and then remove 
session.forget() procedure again, it starts to work in the new browser 
session.

But it seems to be a one shot deal with each new session. I don't see that 
it's tenable to go through this every time someone first surfs to the site.

On Monday, December 23, 2013 7:33:56 PM UTC+8, weheh wrote:

 Yes, I already did that. It didn't fix it.

 On Monday, December 23, 2013 6:38:57 PM UTC+8, Leonel Câmara wrote:

 Delete all session files.  
   
 I have also found that in windows boxes running apache + mod_wsgi, you 
 will constantly run into session errors if you're running more than one 
 web2py instalation as WSGIDaemonProcess doesn't work on windows so you 
 can't have a dedicated wsgi process for each of them.



-- 
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] Can't pickle instancemethod objects -- web2py [Closed]

2013-12-23 Thread weheh
Phew, finally figured it out. session.myvar was getting assigned a default 
value from a db field, so couldn't be pickled.

On Monday, December 23, 2013 8:54:32 PM UTC+8, weheh wrote:

 I have more details. As stated before, I erased all sessions. That didn't 
 fix the problem.

 I then did a session.forget() from within my main routine. That got past 
 the pickle problem temporarily, but created a lot of other problems. After 
 that, I removed the session.forget() operation from the main routine and 
 things got back to normal. BUT only for my session.

 If I open another session in a different browser. I'm back to square one 
 with that browser session. Same TypeError: can't pickle instancemethod 
 objects. If I go through the session.forget() and then remove 
 session.forget() procedure again, it starts to work in the new browser 
 session.

 But it seems to be a one shot deal with each new session. I don't see that 
 it's tenable to go through this every time someone first surfs to the site.

 On Monday, December 23, 2013 7:33:56 PM UTC+8, weheh wrote:

 Yes, I already did that. It didn't fix it.

 On Monday, December 23, 2013 6:38:57 PM UTC+8, Leonel Câmara wrote:

 Delete all session files.  
   
 I have also found that in windows boxes running apache + mod_wsgi, you 
 will constantly run into session errors if you're running more than one 
 web2py instalation as WSGIDaemonProcess doesn't work on windows so you 
 can't have a dedicated wsgi process for each of them.



-- 
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: Online classes

2013-12-23 Thread weheh
Wonderful, wonderful.

On Tuesday, December 3, 2013 2:34:18 PM UTC+8, Massimo Di Pierro wrote:

 Hello everybody,

 As you know I teach a certification program about web development with 
 Python and I use web2py. 
 I posted my most recent classes online:

 https://vimeo.com/75499986
 https://vimeo.com/76047107
 https://vimeo.com/76608898
 https://vimeo.com/77179700
 https://vimeo.com/77654974

 It is about of 13 hours of web2py lessons and coding.
 Please join me in thanking the students who enrolled in the program and 
 supported these classes.

 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] How to get captcha to display during https session

2013-12-22 Thread weheh
My registration page has changed to https session from http. But now, on IE 
(haven't tested other browsers yet), the Captcha doesn't display and IE 
gives the message Only secure content is displayed. Unless the user 
clicks the Show all content button, they won't be able to register. 
Anybody know what to do?

-- 
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] auth.is_logged_in and @auth.requires_signature() under investigation

2013-12-21 Thread weheh
I am dead in the water trying to make an https ajax call from an http 
session. CORS is enabled on server but the web2py_component https URL with 
user_signature=True now triggers an erroneous non-logged-in response to 
auth.is_logged_in() when, in fact, the user is logged in.

First, thanks to Marin Pranjić's help, I am able to articulate the above 
statement. A little while ago I couldn't have done so.

The trouble with auth.is_logged_in() is mirrored by an error raised by 
@auth.requires_signature(). In response to an experiment designed by Marin, 
I documented the following:

 If I put the @auth.requires_signature() decorator back into the controller 
 and reexecute, I get the Firebug error message:
 XMLHttpRequest cannot load https://www.blah 
 blahhttps://www.yakitome.com/store/checkout.load?pid=1_signature=e5308784ae38c2f5f1a67552b4143bf7b9adeca1.
  
 The request was redirected to 
 'https://www.mydomain.com/user/login.load?_next=/blah 
 blahhttps://www.yakitome.com/user/login.load?_next=/store/checkout.load%3Fpid%3D1',
  
 which is disallowed for cross-origin requests that require preflight. 


Marin replied,

 As I expected, auth.requires_signature looks broken. Give me some time, I 
 am very busy, but I'll try to give you solution.
 Maybe URL.verify instead of decorator.


Now, I have that auth.is_logged_in() in a critical spot and 
@auth.requires_signature() decorators on many functions that are now 
negatively impacted by this issue. So my sense of urgency is higher than my 
normal constant sense of urgency. I've been stuck on this for many days so 
I think I'm ready to ask for as much help as possible. Please.

Thank you Marin and the web2py community for all the excellent support. Any 
suggestions about how to proceed, including from Marin, are appreciated.

-- 
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: auth.is_logged_in(), @auth.requires_signature() behaving ornery in CORS situation

2013-12-21 Thread weheh
Yah, that's the conclusion I've come to and already begun implementing. 
But, something nags at me a little about all SSL all the time. Seems like 
it's overkill under certain circumstances. But maybe that's a good thing in 
this day and age.

On Saturday, December 21, 2013 11:33:37 PM UTC+8, LightDot wrote:

 You could also programmatically enforce the usage of ssl across the entire 
 site. Your ajax call would always be https - https, making CORS 
 redundant...

 Regards

 On Saturday, December 21, 2013 3:44:51 PM UTC+1, weheh wrote:

 I am dead in the water trying to make an https ajax call from an http 
 session. CORS is enabled on server. The web2py_component https URL with 
 user_signature=True triggers a False auth.is_logged_in() when, in fact, the 
 user is logged in. Oops, a total show stopper.
 ...



-- 
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: auth.is_logged_in(), @auth.requires_signature() behaving ornery in CORS situation

2013-12-21 Thread weheh
At the least, the doc should be updated to reflect that web2py_component 
and LOAD won't work under CORS conditions.

On Sunday, December 22, 2013 12:21:22 AM UTC+8, weheh wrote:

 @LightDot: Yah, that's the conclusion I've come to and already begun 
 implementing. But, something nags at me a little about all SSL all the 
 time. Seems like it's overkill under certain circumstances. But maybe 
 that's a good thing in this day and age.

 On Saturday, December 21, 2013 11:33:37 PM UTC+8, LightDot wrote:

 You could also programmatically enforce the usage of ssl across the 
 entire site. Your ajax call would always be https - https, making CORS 
 redundant...

 Regards

 On Saturday, December 21, 2013 3:44:51 PM UTC+1, weheh wrote:

 I am dead in the water trying to make an https ajax call from an http 
 session. CORS is enabled on server. The web2py_component https URL with 
 user_signature=True triggers a False auth.is_logged_in() when, in fact, the 
 user is logged in. Oops, a total show stopper.
 ...



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


Re: [web2py] Re: XMLHttpRequest cannot load https://www..... disallowed for cross-origin request ...

2013-12-18 Thread weheh
Looks like I got it working. The Apache config file wasn't complete, so 
once I found that issue, the CORS started to function properly. Thanks 
again for your responses.


On Monday, December 16, 2013 11:16:05 PM UTC+8, Marin Pranjić wrote:

 Well, as I said, try your own jquery.ajax call.

 If it works, then CORS is enabled but component load is failing.
 If it doesn't work, then you didn't enable CORS correctly.

 You should also try $.ajax({crossDomain: true, ...});
 JQuery should add it automatically but maybe it's not detecting it 
 properly.


 On Mon, Dec 16, 2013 at 4:12 PM, weheh richard...@verizon.netjavascript:
  wrote:

 @Marin: Thanks for your suggestion. I believe that that is precisely what 
 is causing this issue. The original call is an HTTP call. It's followed by 
 an HTTPS that results in the error message. But still no idea how to get 
 the https call to go through.


 On Monday, December 16, 2013 10:45:45 PM UTC+8, Marin Pranjić wrote:

 @weheh can you try a custom jQuery.ajax cross domain call for 
 testing/debugging? (just load something from HTTP to HTTPS)

 On Mon, Dec 16, 2013 at 2:38 PM, weheh richard...@verizon.net wrote:

 Hi Anthony, I added CORS stuff to my Apache httpd.conf as per this 
 http://enable-cors.org/server_apache.html but I'm still getting the 
 same error message. Any ideas about how to push through this?


 On Sunday, December 15, 2013 1:13:55 AM UTC+8, Anthony wrote:

 Is it in fact a cross-origin request, and have you set up CORS on the 
 server?

 On Saturday, December 14, 2013 10:39:25 AM UTC-5, weheh wrote:

 I've got a dialog that I pop open and on it is a button that makes a 
 web2py_component call. The button code looks like this, after it's gone 
 through the XML() helper and jquery UI.

 button class=... onclick=if (confirm('Read?')) { 
 web2py_component(quot;https://www.mysite.com/mycontroller/m
 yfunc.load?pc=YGYzlEh6amp;_signature=607e035a239d88bd3ab8652814ceff
 2a9cab92b5quothttps://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quot;,
  
 quot;target-divquot;); } role=button aria-disabled=false ... 
 /button

 The button works fine when I launch it from my development machine: 
 http://127.0.0.1:8000/myapp/...  But, when I migrate the code to the 
 server and execute there, I get an error.

 Firebug reports the following:

 XMLHttpRequest cannot load https://www.mysite.com/mycontr
 oller/myfunc.load?pc=YGYzlEh6_signature=https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e
 607e035a239d88bd3ab8652814ceff2a9cab92b5. The request was redirected 
 to 'https://www.mysite.com/user/login.load?_next=/mycontroller/
 myfunc.load%https://www.yakitome.com/user/login.load?_next=/store/execute.load%3Fpc%3DHcfnI_pV%26pid%3D7%26qty%3D1
 pc=YGYzlEh6https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e',
  
 which is disallowed for cross-origin requests that require preflight. 


 Anybody have any idea how to deal with this?


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

 For more options, visit https://groups.google.com/groups/opt_out.


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




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


[web2py] Re: XMLHttpRequest cannot load https://www..... disallowed for cross-origin request ...

2013-12-16 Thread weheh
Hi Anthony, I added CORS stuff to my Apache httpd.conf as per this 
http://enable-cors.org/server_apache.html but I'm still getting the same 
error message. Any ideas about how to push through this?


On Sunday, December 15, 2013 1:13:55 AM UTC+8, Anthony wrote:

 Is it in fact a cross-origin request, and have you set up CORS on the 
 server?

 On Saturday, December 14, 2013 10:39:25 AM UTC-5, weheh wrote:

 I've got a dialog that I pop open and on it is a button that makes a 
 web2py_component call. The button code looks like this, after it's gone 
 through the XML() helper and jquery UI.

 button class=... onclick=if (confirm('Read?')) { 
 web2py_component(quot;
 https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6amp;_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quothttps://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quot;,
  
 quot;target-divquot;); } role=button aria-disabled=false ... 
 /button

 The button works fine when I launch it from my development machine: 
 http://127.0.0.1:8000/myapp/...  But, when I migrate the code to the 
 server and execute there, I get an error.

 Firebug reports the following:

 XMLHttpRequest cannot load 
 https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e
 607e035a239d88bd3ab8652814ceff2a9cab92b5. The request was redirected to '
 https://www.mysite.com/user/login.load?_next=/mycontroller/myfunc.load%https://www.yakitome.com/user/login.load?_next=/store/execute.load%3Fpc%3DHcfnI_pV%26pid%3D7%26qty%3D1
 pc=YGYzlEh6https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e',
  
 which is disallowed for cross-origin requests that require preflight. 


 Anybody have any idea how to deal with this?




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


[web2py] Re: XMLHttpRequest cannot load https://www..... disallowed for cross-origin request ...

2013-12-16 Thread weheh
Yah, I see it on other browsers: Redirects are not allowed for CORS 
preflight requests. and then XMLHttpRequest: Network Error 0x8007005, 
Access is denied.


On Monday, December 16, 2013 10:16:40 PM UTC+8, Anthony wrote:

 I don't know. Does it happen in all browsers?

 On Monday, December 16, 2013 8:38:17 AM UTC-5, weheh wrote:

 Hi Anthony, I added CORS stuff to my Apache httpd.conf as per this 
 http://enable-cors.org/server_apache.html but I'm still getting the same 
 error message. Any ideas about how to push through this?


 On Sunday, December 15, 2013 1:13:55 AM UTC+8, Anthony wrote:

 Is it in fact a cross-origin request, and have you set up CORS on the 
 server?

 On Saturday, December 14, 2013 10:39:25 AM UTC-5, weheh wrote:

 I've got a dialog that I pop open and on it is a button that makes a 
 web2py_component call. The button code looks like this, after it's gone 
 through the XML() helper and jquery UI.

 button class=... onclick=if (confirm('Read?')) { 
 web2py_component(quot;
 https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6amp;_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quothttps://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quot;,
  
 quot;target-divquot;); } role=button aria-disabled=false ... 
 /button

 The button works fine when I launch it from my development machine: 
 http://127.0.0.1:8000/myapp/...  But, when I migrate the code to the 
 server and execute there, I get an error.

 Firebug reports the following:

 XMLHttpRequest cannot load 
 https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e
 607e035a239d88bd3ab8652814ceff2a9cab92b5. The request was redirected 
 to '
 https://www.mysite.com/user/login.load?_next=/mycontroller/myfunc.load%https://www.yakitome.com/user/login.load?_next=/store/execute.load%3Fpc%3DHcfnI_pV%26pid%3D7%26qty%3D1
 pc=YGYzlEh6https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e',
  
 which is disallowed for cross-origin requests that require preflight. 


 Anybody have any idea how to deal with this?




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


Re: [web2py] Re: XMLHttpRequest cannot load https://www..... disallowed for cross-origin request ...

2013-12-16 Thread weheh
@Marin: Thanks for your suggestion. I believe that that is precisely what 
is causing this issue. The original call is an HTTP call. It's followed by 
an HTTPS that results in the error message. But still no idea how to get 
the https call to go through.


On Monday, December 16, 2013 10:45:45 PM UTC+8, Marin Pranjić wrote:

 @weheh can you try a custom jQuery.ajax cross domain call for 
 testing/debugging? (just load something from HTTP to HTTPS)

 On Mon, Dec 16, 2013 at 2:38 PM, weheh richard...@verizon.netjavascript:
  wrote:

 Hi Anthony, I added CORS stuff to my Apache httpd.conf as per this 
 http://enable-cors.org/server_apache.html but I'm still getting the same 
 error message. Any ideas about how to push through this?


 On Sunday, December 15, 2013 1:13:55 AM UTC+8, Anthony wrote:

 Is it in fact a cross-origin request, and have you set up CORS on the 
 server?

 On Saturday, December 14, 2013 10:39:25 AM UTC-5, weheh wrote:

 I've got a dialog that I pop open and on it is a button that makes a 
 web2py_component call. The button code looks like this, after it's gone 
 through the XML() helper and jquery UI.

 button class=... onclick=if (confirm('Read?')) { 
 web2py_component(quot;https://www.mysite.com/mycontroller/
 myfunc.load?pc=YGYzlEh6amp;_signature=607e035a239d88bd3ab8652814ceff
 2a9cab92b5quothttps://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quot;,
  
 quot;target-divquot;); } role=button aria-disabled=false ... 
 /button

 The button works fine when I launch it from my development machine: 
 http://127.0.0.1:8000/myapp/...  But, when I migrate the code to the 
 server and execute there, I get an error.

 Firebug reports the following:

 XMLHttpRequest cannot load https://www.mysite.com/
 mycontroller/myfunc.load?pc=YGYzlEh6_signature=https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e
 607e035a239d88bd3ab8652814ceff2a9cab92b5. The request was redirected 
 to 'https://www.mysite.com/user/login.load?_next=/
 mycontroller/myfunc.load%https://www.yakitome.com/user/login.load?_next=/store/execute.load%3Fpc%3DHcfnI_pV%26pid%3D7%26qty%3D1
 pc=YGYzlEh6https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e',
  
 which is disallowed for cross-origin requests that require preflight. 


 Anybody have any idea how to deal with this?


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




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


[web2py] XMLHttpRequest cannot load https://www..... disallowed for cross-origin request ...

2013-12-14 Thread weheh
I've got a dialog that I pop open and on it is a button that makes a 
web2py_component call. The button code looks like this, after it's gone 
through the XML() helper and jquery UI.

button class=... onclick=if (confirm('Read?')) { 
web2py_component(quot;https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6amp;_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quot;,
 
quot;target-divquot;); } role=button aria-disabled=false ... 
/button

The button works fine when I launch it from my development machine: 
http://127.0.0.1:8000/myapp/...  But, when I migrate the code to the server 
and execute there, I get an error.

Firebug reports the following:

XMLHttpRequest cannot load 
https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e
607e035a239d88bd3ab8652814ceff2a9cab92b5. The request was redirected to '
https://www.mysite.com/user/login.load?_next=/mycontroller/myfunc.load%https://www.yakitome.com/user/login.load?_next=/store/execute.load%3Fpc%3DHcfnI_pV%26pid%3D7%26qty%3D1
pc=YGYzlEh6https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e',
 
which is disallowed for cross-origin requests that require preflight. 


Anybody have any idea how to deal with this?


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


[web2py] Re: XMLHttpRequest cannot load https://www..... disallowed for cross-origin request ...

2013-12-14 Thread weheh
Thanks, Anthony. Wasn't sure I had to go down that path. Yet another 
acronym to hide under the rug.

On Saturday, December 14, 2013 11:39:25 PM UTC+8, weheh wrote:

 I've got a dialog that I pop open and on it is a button that makes a 
 web2py_component call. The button code looks like this, after it's gone 
 through the XML() helper and jquery UI.

 button class=... onclick=if (confirm('Read?')) { 
 web2py_component(quot;
 https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6amp;_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quothttps://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=607e035a239d88bd3ab8652814ceff2a9cab92b5quot;,
  
 quot;target-divquot;); } role=button aria-disabled=false ... 
 /button

 The button works fine when I launch it from my development machine: 
 http://127.0.0.1:8000/myapp/...  But, when I migrate the code to the 
 server and execute there, I get an error.

 Firebug reports the following:

 XMLHttpRequest cannot load 
 https://www.mysite.com/mycontroller/myfunc.load?pc=YGYzlEh6_signature=https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e
 607e035a239d88bd3ab8652814ceff2a9cab92b5. The request was redirected to '
 https://www.mysite.com/user/login.load?_next=/mycontroller/myfunc.load%https://www.yakitome.com/user/login.load?_next=/store/execute.load%3Fpc%3DHcfnI_pV%26pid%3D7%26qty%3D1
 pc=YGYzlEh6https://www.yakitome.com/store/execute.load?pc=HcfnI_pVpid=7qty=1_signature=6c18eb4d880e19d463d85df3f9b02c97b5c8430e',
  
 which is disallowed for cross-origin requests that require preflight. 


 Anybody have any idea how to deal with this?




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


[web2py] Re: Form self-submit broken after redirection

2013-11-27 Thread weheh
@Niphlod -- thanks for your insights. Sorry, I have not enough juice to dig 
deep enough into the web2py_component to see how it's done and then port 
signature into it. But if I did I would definitely submit it as 
web2py_component is about the single most cool thing in all of web2py.

That said, the core question of why self-submit fails after the 
web2py_component() call remains an open mystery to me.

On Thursday, November 28, 2013 3:35:45 AM UTC+8, Niphlod wrote:

 if you want to port the code that does the signature in python to 
 javascript, feel free to submit it :D
 However, you should pass along the hmac_key, and doing so, you're exposing 
 what you're trying hard to mask.

 However, it's kinda of a non-question as per the markup you posted. if 
 your javascript is embedded in the view, you don't need the javascript to 
 generate the signed url... any code in {{}} gets rendered by python.

 Anyhow, if your javascript is not embedded in the view, if needed you can 
 still define a function in your assets that takes the url and then use 

 var url = {{=URL(., user_signature=True)}}
 myfunction(url)

 bonus points for NOT embedding in static assets absolute urls (that you 
 may need later to be translated by a rewrite rule)


-- 
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: Form self-submit broken after redirection

2013-11-26 Thread weheh
Sorry for the slow response. From within my main view, at the end, I do 
this:
script
$(document).ready(function() {
{{if auth.is_logged_in() and session.state:}}
$(#mydialog).dialog(open);
web2py_component({{= URL('mycontroller', 'index')}},
 mydialog);
{{pass}}
});
/script

As I write this, I'm remembering how I once wondered why web2py_component 
doesn't have a user_signature parameter? But that maybe is unrelated to 
this discussion ('tho if you have an answer to that question, too, it would 
be nice to know).

So basically, if a dialog is open to a particular form and the user hits 
reload, the main page sees that there's a state variable so it opens a 
dialog and squirts the appropriate form back into the dialog. But then, the 
form won't self-submit.


On Friday, November 22, 2013 10:05:19 PM UTC+8, Anthony wrote:

 I tried your code and it works fine for me. Maybe we need to see more of 
 the code and understand the workflow better.

 On Friday, November 22, 2013 7:55:50 AM UTC-5, weheh wrote:

 It works like this:

 # index controller
 def index():
 # some preamble
 if session.state == 'a':
 redirect(URL('thiscontoller', 'myfunc1.load', user_signature=True
 ))
 # some more states and redirects

 #later on
 @auth.requires_signature()
 def myfunc1():
 form = SQLFORM.factory(Field(...the usual stuff, nothing fancy...),
 Field(...), Field(...))
 if form.process().accepted:
 # process form
 elif form.errors:
 response.flash = 'error'
 return dict(html=form)


 If myfunc1 is called directly it self-submits fine. But if is reached via 
 the index function, which is triggered by a page reload, the form won't 
 self submit. Hope that clarifies. Must be something really dumb-a** simple 
 but I'm not seeing it.



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


[web2py] Re: Form self-submit broken after redirection

2013-11-22 Thread weheh
It works like this:

# index controller
def index():
# some preamble
if session.state == 'a':
redirect(URL('thiscontoller', 'myfunc1.load', user_signature=True))
# some more states and redirects

#later on
def myfunc1():
form = SQLFORM.factory(Field(...the usual stuff, nothing fancy...),Field
(...), Field(...))
if form.process().accepted:
# process form
elif form.errors:
response.flash = 'error'
return dict(html=form)


If myfunc1 is called directly it self-submits fine. But if is reached via 
the index function, it doesn't self submit. Hope that clarifies. Must be 
something really dumb-a** simple but I'm not seeing it.

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


[web2py] Form self-submit broken after redirection

2013-11-21 Thread weheh
I couldn't find this in my search of threads, so apologies if already 
answered. 

I'm opening a dialog and putting an ordinary form in the dialog. If the 
user presses the form's submit button, the form's controller gets called 
and the form.process().accepted step gets executed. Good so far.

However, if the user refreshes the browser, I cleverly have the main page 
load and then detect that the former state of the system and automatically 
open the dialog and redirect its contents to the form's controller. So the 
user returns to the same place as they were prior to refresh. Now, when the 
user presses the submit button, the form's controller does not get 
executed. Instead, the controller that redirected to the form gets 
executed. The result is the form gets redrawn and not submitted. So from 
the user's perspective, nothing happens when the Submit button is pressed 
after reloading the page.

How to disable this behavior and have the desired controller get executed? 
Do I need to submit the form via ajax or muck with the requesting URL?

-- 
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] jQuery ReferenceError from within component with file upload

2013-11-14 Thread weheh
Ah, don't you love components with file upload? I'm back!

So I am using the hack that makes components work with file upload. My view 
looks like this:

{{= form}}

script
$(#file-form input.upload).button();  // this uses jquery UI's button 
routine

{{# hack because jquery.form.js does not properly pass headers}}
{{if response.flash:}}
$(.flash).hide().html('{{= XML(response.flash)}}').slideDown();
{{pass}}
{{if response.js:}}
eval('{{= XML(response.js)}}');
{{pass}}
{{# NOTE SINGLE QUOTES AROUND response.flash AND response.js ABOVE}}
/script


response.flash and response.js are one-liners.

At initial load there are no problems. However, after form submission, I do 
a return dict(form=form) and the above myfunction.load gets reloaded. At 
this point, there's an error message in the FireBug console saying:


Uncaught ReferenceError: $ is not defined


and it points to the line $(#file-form input.upload).button();


There's another button that's passed in through the form and a script that 
defines its button behavior, and that also gives the same error message.


Now, according to my research, this error message means that jQuery hasn't 
been loaded. Of course, I did load jQuery way back at the beginning in my 
layout.html file that's essentially being extended here, but under the 
auspices of a load.


Nevertheless, the response.js is getting executed correctly and, on top of 
that, the form does display correctly. So this isn't a killer, but it does 
keep me awake at nights. Can any of you deep thinkers out there tell me 
what's actually going on under the hood that's causing this issue, and how 
to make it go away?

-- 
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] Where to find name of uploaded file during the onvalidation step?

2013-11-06 Thread weheh
I'm doing a file upload using SQLFORM and a field of type upload. I want to 
intercept the file during onvalidation and do some file manipulation before 
saving. While in the onvalidation routine I can see the original filename 
and form.vars.filename.file, which I can read. 

I'm wondering whether web2py has already created a file on the server by 
this point (in the onvalidation validation routine and before the 
form.process(onvalidation=myvalidation).accepted step)? If so, I'd like to 
get that file name at that time (during the validation step). Anybody know 
where I can find it?

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


[web2py] Re: can grid export represented values rather than raw db values?

2013-11-02 Thread weheh
All good suggestions. Thanks!

On Saturday, November 2, 2013 2:11:29 AM UTC+8, Anthony wrote:

 On Friday, November 1, 2013 12:05:56 PM UTC-4, weheh wrote:

 Anthony, TSV works pretty well. Now I have to figure out how to get rid 
 of the html formatting I've put in, but I think TSV basically does the 
 trick.

 It would work better if grid gave td columns a class or id 
 corresponding to the name of the field being displayed. Then I wouldn't 
 have to wrap my values with div to get column entries to be left, right, 
 or center-justified.


 If you want to target particular columns for special formatting, you can 
 use the CSS nth-child selector -- so no need to wrap the cell contents in a 
 div.

 I have previously made a suggestion to include col elements in the grid 
 table to make it easier to apply column based styling without having to 
 know or hard-code the column number in your CSS/JS.

 Anthony


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


[web2py] Re: can grid export represented values rather than raw db values?

2013-11-01 Thread weheh
Anthony, TSV works pretty well. Now I have to figure out how to get rid of 
the html formatting I've put in, but I think it does the trick.

On Friday, November 1, 2013 2:14:30 AM UTC+8, Anthony wrote:

 If you can live with tab-delimited instead of comma delimited, the TSV 
 format does exactly what you want (it actually downloads with a .csv 
 extension, so it will open up in Excel as is). If you need CSV, perhaps you 
 could copy the gluon.sqlhtml.ExportTSV class and just change the delimiter 
 to a comma. Note, the HTML download also uses represent.

 Also, outside of the grid, if you want to use represent in CSV exports, 
 you can do rows.export_to_csv(..., represent=True).

 Anthony

 On Thursday, October 31, 2013 1:50:08 AM UTC-4, weheh wrote:

 My grid has a bunch of its data created with .represent. I want to export 
 this in CSV format. The export class dumps raw underlying data without the 
 represent values shown by the grid. Is there a way to get export to put out 
 the represented format used by grid? Or do I have to write a custom 
 exporter that loops through all the rows and does lambda substitutions 
 again?



-- 
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: browser won't go to http://127.0.0.1:8000/admin/default/ ... whatever ...

2013-10-30 Thread weheh
This is still an issue issue. Clicking the Edit button for myapp at the 
web2py admin interface (http://127.0.0.1:8000/admin/default/myapp) brings 
up the interface after a very long wait. This is reproducible. Smaller 
apps, like the web2py welcome and examples app, load quickly when I click 
the Edit button ... in around a second or so. But my main app, which is 
quite complex, takes forever to load when I click the Edit button. This is 
really slowing down debug when I want to go into the db and make a change, 
especially since I get logged out of the admin interface after a short 
while. Any thoughts?

-- 
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: browser won't go to http://127.0.0.1:8000/admin/default/ ... whatever ...

2013-10-30 Thread weheh
I think I located the source of the problem, but not its solution. The 
web2py http://127.0.0.1:8000/admin/default/myapp page scans the static 
folder. I keep a huge directory of uploads there, potentially terabytes of 
data stored using the scheme uploadfolder=os.path.join(request.folder, 
'static/data'), uploadseparate=True. 
When http://127.0.0.1:8000/admin/default/myapp eventually loads, it is 
getting hung up on the static/data folder.

Is it possible to tell web2py to not scan this folder?

-- 
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: browser won't go to http://127.0.0.1:8000/admin/default/ ... whatever ...

2013-10-30 Thread weheh
Yes, sir!

-- 
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] can grid export represented values rather than raw db values?

2013-10-30 Thread weheh
My grid has a bunch of its data created with .represent. I want to export 
this in CSV format. The export class dumps raw underlying data without the 
represent values shown by the grid. Is there a way to get export to put out 
the represented format used by grid? Or do I have to write a custom 
exporter that loops through all the rows and does lambda substitutions 
again?

-- 
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] browser won't go to http://127.0.0.1:8000/admin/default/ ... whatever ...

2013-10-28 Thread weheh
I'm using PostgreSQL and debugging in Eclipse, although I also see this 
issue when not using the Eclipse IDE bugger. The issue is that when I try 
to go to look at a ticket or the db contents via the web2py admin 
interface, the interface won't come up. In other words, I can click on a 
ticket and then wait and wait for the web2py admin to start and show the 
error. Sometimes, the browser never displays the page. Other times, it 
displays after a very long wait -- most likely triggered by a timeout. I 
suspect that somehow, the postgres db is getting locked. Anybody know how 
to deal with this issue?

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


[web2py] Re: Security question regarding session

2013-09-22 Thread weheh
Thanks, Massimo. Very thorough. Especially the part about multiple sessions 
going on for same user. Hadn't considered that. Cheers!

On Monday, September 16, 2013 2:20:57 PM UTC+8, weheh wrote:

 How secure is session? I'm considering 2 methods for downloading a file: 
 The first is via an A('Download', _href=URL('download', 'file', 
 args=[file_id])). The second would be to have session.file_id = file_id and 
 then have only A('Download', _href=URL('download', 'file')), which causes 
 the app to get the file_id from session.

 Assuming my app is bullet proof and only allows permitted users to access 
 their accessible file_ids, then wouldn't the use of session in the second 
 case be more secure because the file_id is never publicly exposed, and 
 thereby hackable?


-- 
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] Security question regarding session

2013-09-16 Thread weheh
How secure is session? I'm considering 2 methods for downloading a file: 
The first is via an A('Download', _href=URL('download', 'file', 
args=[file_id])). The second would be to have session.file_id = file_id and 
then have only A('Download', _href=URL('download', 'file')), which causes 
the app to get the file_id from session.

Assuming my app is bullet proof and only allows permitted users to access 
their accessible file_ids, then wouldn't the use of session in the second 
case be more secure because the file_id is never publicly exposed, and 
thereby hackable?

-- 
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] paragraphs in markmin

2013-05-24 Thread weheh
I love markmin, but ... within a blockquoted section, blank lines translate 
into br/...stuff...br/, not p...stuff.../p. This is awkward. 
Searching the forum, I've found I can do this:

...first paragraph ...

[[NEWLINE]]
...second paragraph

[[NEWLINE]]
etc.

Kind'a fugly, IMHO. Is there a better way?

-- 

--- 
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] question about digital signatures

2013-05-24 Thread weheh
I've become an ajax junkie. I'm going back and adding digital signatures to 
my ajax calls. But, it looks like my calls are failing if the user isn't 
logged in. I suspect I'm interpreting _signature=True and 
@auth.requires_signature() incorrectly. Why don't they work in the 
situation where a user isn't logged in?

-- 

--- 
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: web2py.com Internal error

2013-05-17 Thread weheh
Yah, I saw it, too, but then it went away. I recommend trying again.

On Saturday, May 18, 2013 9:49:04 AM UTC+8, samuel bonilla wrote:

 http://www.web2py.com/ in the website

 Internal errorTicket issued: 
 unknownhttp://www.web2py.com/admin/default/ticket/unknown

-- 

--- 
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: What would be the best way to optimize/resize images after upload

2013-05-08 Thread weheh
There are numerous ways to resize uploaded images. Some are done via the 
web server. Others are done within the app. For a couple of my apps I use 
the python PIL package to resize uploaded images to thumbnails and the 
like. Here's a code fragment that shows how to do it:

def resize_image(table, indx):
from PIL import Image


On Thursday, May 9, 2013 5:43:45 AM UTC+8, Dragan Matic wrote:

 Is there a way to automatically optimize and convert images after users 
 upload it on my web app? I am pretty sure lots of users will upload 
 uncompressed .bmp pictures or extra large pictures directly from camera. I 
 think it would be best if I could resize and compress them immediately 
 after upload. What would be the best way to do it? 


-- 

--- 
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 weheh
I've done this before -- multiple ajax forms on one page -- and not had any 
issues. EXCEPT, I'm guessing from the names of your functions that you have 
an upload type field in there somewhere, or possibly in both forms. That 
is going to be an issue, since upload fields have to be treated specially. 
There is a cookbook example that deals with this exact case. If that's your 
problem, I can help to dig up a solution for 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] auth.has_permission(...) slow -- any way to speed this up?

2013-03-21 Thread weheh
I have a table that represents a group, which has permissions on a 
row-by-row basis. User belongs to certain number of groups, and the rows 
into the table are kept for convenience sake. I would like to screen that 
list of rows for a specific permission and exclude those rows from the 
list. The code looks like this:

for row in rows:
if not auth.has_permission('update', db.my_table, row):
rows.remove(row)

Problem is, the auth.has_permission is slow ... on the order of 1.5 seconds 
when scanning a half-dozen row entries. my_table has around 150K rows. How 
do I speed this up?



-- 

--- 
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: auth.has_permission(...) slow -- any way to speed this up?

2013-03-21 Thread weheh
Not exactly. The fields in rows are indices into db.my_table. len(rows) is 
a small variable number, say around 8.

But there it is, anyway. Thank you Mr. Niphlod. Good work!

bad_rows = db((db.my_table.id.belongs(rows)) 
(auth.accessible_query('update', db.my_table, 
user_id))).select(db.my_table.id)

Speed comparison: 1.4 seconds before change, 0.7 seconds after change. 2X. 
Not bad, although I'd prefer 10X :-)

On Thursday, March 21, 2013 9:19:34 PM UTC+8, Niphlod wrote:

 So, basically you're doing 
 get me 150K rows, put them in a list
 for each of them, query the db for permission
 if query doesn't return True, scan the 150K list and remove this instance

 Cycling 150K and removing from a list while checking surely will get your 
 app killed. 
 Firing one query for each row is what seems the problem on the 
 half-dozen set.
 Try the 'accessible-query' way 
 rows = db(auth.accessible_query('read', db.my_table, 
 auth.user_id)).select(db.my_table.ALL)
 This will do all the required joins under the hood and resolve in 
 one-query only.

 On Thursday, March 21, 2013 12:59:57 PM UTC+1, weheh wrote:

 I have a table that represents a group, which has permissions on a 
 row-by-row basis. User belongs to certain number of groups, and the rows 
 into the table are kept for convenience sake. I would like to screen that 
 list of rows for a specific permission and exclude those rows from the 
 list. The code looks like this:

 for row in rows:
 if not auth.has_permission('update', db.my_table, row):
 rows.remove(row)

 Problem is, the auth.has_permission is slow ... on the order of 1.5 
 seconds when scanning a half-dozen row entries. my_table has around 150K 
 rows. How do I speed this up?





-- 

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




[web2py] how to update title from an ajax call

2013-03-12 Thread weheh
I'm using an ajax callback to dynamically update the main content in my 
page. I want to also change the page title and meta name='description' 
content='new description based on dynamically updated content' ... to 
mirror the new content. Since these are set in the layout.html file and I'm 
not refreshing the whole page, I'm not sure how to change these values. Is 
there a way to do what I want?

-- 

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




[web2py] Re: Can not check True/False on this field?

2013-03-08 Thread weheh
Cliff is absolutely right! If all you're storing is True or False, make the 
field a boolean. It's much more efficient in all respects. The list: string 
and list: reference are most useful if you're storing a reasonably small 
number of one to many relationships.

-- 

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




[web2py] can not get routes.py to work

2013-03-08 Thread weheh
I'm a routes.py newbie! Amazing it's taken me this long to really dive in. 
This should be trivial, but I'm struggling to get mydomain/robots.txt to 
map to mydomain/static/robots.txt. In fact, none of my routes_in are 
working. My non-working routes.py file:

#!/usr/bin/python
# -*- coding: utf-8 -*-

default_application = 'init'# ordinarily set in base routes.py
default_controller = 'default'  # ordinarily set in app-specific routes.py
default_function = 'index'  # ordinarily set in app-specific routes.py


routes_app = (
(r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'),
(r'(.*)', r'myapp'),
(r'/?(.*)', r'myapp'),
)


routes_in = (
('/favicon.ico', '/static/images/logo/favicon.ico'),
('/robots.txt', '/static/robots.txt'),
('/cgi-bin/foobar.py', '/newfoobar/index'),
)


routes_out = (
('/static/robots.txt', 'robots.txt'),
('/appadmin/(?Pany.*)', '/\gany'),
('/mydomain/(?Pany.*)', '/\gany'),
('/other/(?Pany.*)', '/\gany'),
)


logging = 'debug'


# Display 404 for all invalid server messages
routes_onerror = [
('*/*', '/mydomain/static/404.html'),
]


Also, I would like to know what the logging='debug' does? Where does the 
log file go?

-- 

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




[web2py] Re: can not get routes.py to work

2013-03-08 Thread weheh
Sorry, I don't follow. Alter what to DEBUG? Don't know what that means. Can 
you see anything wrong with my routes.py file that causes 
www.mydomain.com/robots.txt to generate a 404 error?


On Friday, March 8, 2013 10:18:25 PM UTC+8, Niphlod wrote:

 for the logging part
 alter those to DEBUG
 https://github.com/web2py/web2py/blob/master/logging.example.conf#L59
 https://github.com/web2py/web2py/blob/master/logging.example.conf#L99

 and you should read it in the console.


 On Friday, March 8, 2013 3:08:22 PM UTC+1, weheh wrote:

 I'm a routes.py newbie! Amazing it's taken me this long to really dive 
 in. This should be trivial, but I'm struggling to get mydomain/robots.txt 
 to map to mydomain/static/robots.txt. In fact, none of my routes_in are 
 working. My non-working routes.py file:

 #!/usr/bin/python
 # -*- coding: utf-8 -*-

 default_application = 'init'# ordinarily set in base routes.py
 default_controller = 'default'  # ordinarily set in app-specific 
 routes.py
 default_function = 'index'  # ordinarily set in app-specific 
 routes.py


 routes_app = (
 (r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'),
 (r'(.*)', r'myapp'),
 (r'/?(.*)', r'myapp'),
 )


 routes_in = (
 ('/favicon.ico', '/static/images/logo/favicon.ico'),
 ('/robots.txt', '/static/robots.txt'),
 ('/cgi-bin/foobar.py', '/newfoobar/index'),
 )


 routes_out = (
 ('/static/robots.txt', 'robots.txt'),
 ('/appadmin/(?Pany.*)', '/\gany'),
 ('/mydomain/(?Pany.*)', '/\gany'),
 ('/other/(?Pany.*)', '/\gany'),
 )


 logging = 'debug'


 # Display 404 for all invalid server messages
 routes_onerror = [
 ('*/*', '/mydomain/static/404.html'),
 ]


 Also, I would like to know what the logging='debug' does? Where does the 
 log file go?



-- 

--- 
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] Having trouble with user_signature

2013-03-07 Thread weheh
For extra security I'm adding user_signature=True to a critical ajax calls, 
but it isn't working for me. In my view, I have the following call after 
the page is created:

ajax({{= URL(c='my_controller', f='do_something', 
vars=dict(x=session.x, y=session.y), user_signature=True)}}, [], :eval);



Then in the controller:

def do_something():
if not URL.verify(request):
raise HTTP(403)
...

This always raises HTTP(403) regardless of whether or not I'm logged in. 

I've traced through gluon's html.py function. One thing that looks awfully 
suspicious is that the vars  variable is getting evaluated with an extra 
item that looks like this:

'amp': ['','','']

Somehow, it's looking at the amp; separator and parsing it into a variable 
instead of a variable separator in a url, such as:
http://my_domain.com/my_controller/do_something?x=1amp;y=2amp;_signature=1f1d8d6eb7e2e98712023d8e2f3a38ee3dbe6466

Am I doing something wrong here, or is this a bug?


-- 

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




[web2py] Re: Can not check True/False on this field?

2013-03-07 Thread weheh
What kind of error message are you getting?

I assume the request.vars['lesson'] and request.vars.answer are both 
indices into their respective tables. However, request.vars will be holding 
these values as strings. Without knowing more, I would suggest putting an 
int() around those two vars, as in:

answer = db.answer[int(request.vars.answer)]

and then do your test:

if 'y' in answer.is_correct:
# do something
else:
   # do something else

Hope this  helps.

On Friday, March 8, 2013 12:37:20 PM UTC+8, Mika Sjöman wrote:

 Hi trying to check true false in a string set, but does not work

 ## db.py

 db.define_table('answer',
 Field('description'),
 Field('is_correct', type='list:string'),
 Field('belongs_to_quiz',type='reference quiz',writable=False),
 )
 db.answer.is_correct.requires=IS_IN_SET(('y','n'))

 ## controller

 def check_if_correct_answer():
 this function tests if the user answers correctly to a question and 
 sends back a ajax response 
 lesson = db.lesson(request.vars['lesson'])
 answer = db.answer(request.vars.answer)
 if answer.is_correct == y:
 #db.user_answer.insert(belongs_to_user=auth.user.id, 
 belongs_to_lesson=lesson.id, correct='y')
 correct_or_not='y'
 else: 
 correct_or_not='n'
 return  jQuery('.flash').html('%s').slideDown(); % (correct_or_not)


 But this test with answer.is_correct does not work. Anybody has an idea on 
 how to check? 


-- 

--- 
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] ajax choking on text - need help

2013-02-23 Thread weheh
I'm doing an ajax callback that's supposed to update a div with new text:

# action
...
return 'jQuery(#my-target).html(%s);' % clean_str(make_contents(filename
))


def make_contents(filename):
return open(filename, 'rb').read().decode('utf-8')


def clean_str(text):
return str(text).replace('', '\\').replace(’, ')..and so on


Problem is I've run into a funny string 

begin offending text

 
end offending text



that chokes the jQuery somewhere inside of web2py.js and causes the text to 
not get displayed in the target div.

Firebug complains:


   1. Uncaught SyntaxError: Unexpected token ILLEGAL 
web2py.js:21http://127.0.0.1:8000/YAKiToMe/static/js/web2py.js
  1. 
jQuery.ajax.successweb2py.js:21http://127.0.0.1:8000/YAKiToMe/static/js/web2py.js
  2. 
ojquery-1.7.2.min.js:3http://127.0.0.1:8000/YAKiToMe/static/js/jquery/jquery-1.7.2.min.js
  3. 
p.fireWithjquery-1.7.2.min.js:3http://127.0.0.1:8000/YAKiToMe/static/js/jquery/jquery-1.7.2.min.js
  4. 
wjquery-1.7.2.min.js:5http://127.0.0.1:8000/YAKiToMe/static/js/jquery/jquery-1.7.2.min.js
  5. 
  2. d jquery-1.7.2.min.js:5
   
   I suspect this is an encoding problem. I suspect the text unfolds to a 
   quote that messes up the .html(%s) part of the jQuery. But this has me 
   stumped. Any help is appreciated. Thanks.
   

-- 

--- 
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: ajax choking on text - need help

2013-02-23 Thread weheh
web2py source starts with # -*- coding: utf-8 -*-

Text being read from file was written encode('utf-8') so 
read().decode('utf-8') produces the unicode. Forcing it unicode() again 
doesn't change anything.

But, thanks for the suggestions! Any other ideas?

On Saturday, February 23, 2013 10:20:38 PM UTC+8, Cliff Kachinske wrote:

 Is your Web2py source file encoded UTF8?

 Have you tried prefacing the string with a lowercase 'u' for unicode?


-- 

--- 
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: Burned by web2py.js ... again

2013-01-15 Thread weheh
On Tuesday, January 15, 2013 1:39:54 AM UTC+8, Massimo Di Pierro wrote:

 What did you upgrade from? What specifically changed that broke your code? 


Upgrade was from 2.1.x. I tried to trace down exactly what broke the code, 
but may have wiped out the tracks accidentally by changing some code in 
another place. Nonetheless, when I have some more time this week I'll go 
back and try to trace it through again.
 


 When you upgrade web2py we do not upgrade web2py.js in your applications.


Yes, I know. However, I try to keep web2py.js up to date as best as 
possible.
 


 The fact that form uploads is second citizen is not a web2py issue. It is 
 an Ajax issues. 


Yes, I am well aware of this.
 

 Ajax does not support multipart forms.
 I am not award of a satisfactory solution to this problem unless we 
 implement our own custom ajax data encoding. I do not think that would be a 
 good idea.


No, I am not suggesting this. I am suggesting, instead, that we package up 
a jquery single-file uploader and ship it with web2py so that it becomes a 
standard *tested* way of uploading files from a component. It seems like 
this has already been done with the menu system and possibly other stuff 
inside web2py. I don't think it would be inconsistent to make a component 
file uploader a standard part of the tool as well.

As for claiming this is the third time, I did hedge a little by saying it 
was possibly the 3rd time. I haven't kept good enough notes to be sure of 
this.

My action item is to trace things through and try to identify the web2py.js 
code that's causing the problems. 

-- 





[web2py] Burned by web2py.js ... again

2013-01-13 Thread weheh
I upgraded to web2py 2.3.2 last week and got burned by web2py.js breaking 
backwards compatibility with my component file upload. This is probably the 
3rd time this has happened to me, so shame on me for not taking 
precautions. Nevertheless, I think it highlights an underlying web2py 
problem.

Components are my mainstream methodology and I have no plans on returning 
to loading entire pages every time someone clicks a link. Problem is, file 
upload is a second-class citizen to web2py components because ajax doesn't 
support multi-part forms. And components without file upload are 
practically useless -- sorry if that sounds harsh, but it is. So users have 
to go the js upload route.

This gets really when web2py.js changes, because it tends to break my old 
js upload flow. Is there any way we could make js-based component file 
upload work out of the box with web2py so that changes in web2py.js won't 
affect it?

-- 





[web2py] Re: restful DELETE not getting vars

2013-01-11 Thread weheh
On further analysis, GET doesn't have vars passed to it either, which is 
problematic.

-- 





[web2py] restful DELETE not getting vars

2013-01-10 Thread weheh
Using latest release 1.3.x. 

@request.restful()
def rest():
response.view = 'generic.json'
def GET(*args, **vars):
...
def POST(*args, **vars):
...
def PUT(*args, **vars):
...
def DELETE(*args, **vars):
if 'delete' in args[0]:
return delete(api_key=vars['api_key'],
  item_id=vars['item_id']
  )
raise HTTP(400)
return locals()



def test_rest(request_type, api_func, vars):
import httplib
import urllib
headers = {Content-type: application/x-www-form-urlencoded,
Accept: text/plain}
conn = httplib.HTTPConnection(yak_globs.HOST)
conn.request(request_type,
'/api/rest/%s' % api_func,
urllib.urlencode(vars),
headers,
)
response = conn.getresponse()
return response.read()


def test_rest_delete():
vars = dict(
api_key='some string',
item_id=439,
)
return test_rest('DELETE', 'delete', vars)



Problem is, vars for DELETE gets passed as empty dict {}. If instead of 
'DELETE' I reference 'POST', the vars get passed correctly. Am I doing 
something wrong, or is it a bug?

-- 





[web2py] how to quote in markmin

2013-01-09 Thread weheh
How to quote  to get markmin to print  instead of amp;?

-- 





[web2py] registration issue with web2py 2.3.2

2013-01-07 Thread weheh
After upgrading to 2.3.2, my custom user registration breaks. I have 
auth_user password encoded as follows in my user's model:
...
Field('password', 'password',
readable=False,
label=T('Password'),
requires=[CRYPT(), IS_LENGTH(512, 6)],
),
...

During registration, I create the register_form like so in my controller:

register_form = SQLFORM.factory(
...
db.auth_user.password,
Field('password2', 'password',
label=T(Verify password'),
requires=db.auth_user.password.requires,
),
...
)


During form acceptance, the form is validated by this:

def validate_registration(form):
 ...
if form.vars.password != form.vars.password2:
form.errors.password = form.errors.password2 = T(
'Passwords do not match')
...
return form

The problem is the passwords aren't the same. I'm assuming the problem is 
the requires=CRYPT(), which actually encrypts the password twice, producing 
two different results for password and password2. How would I  get CRYPT() 
to product the same result for both passwords? Do I need to pass in the 
hmac_key or salt? Or not run CRYPT() at all?

-- 





[web2py] Re: registration issue with web2py 2.3.2 [CLOSED]

2013-01-07 Thread weheh
Alright, I think I got this figured out. Issue is 2-fold. First, IS_LENGTH 
validator is executed after CRYPT() runs, so it fails. Moving IS_LENGTH to 
the array position before CRYPT() and changing password2 validator to 
... requires=IS_EQUAL_TO(request.vars.password) ... causes things to work.


On Monday, January 7, 2013 10:47:47 PM UTC+8, weheh wrote:

 After upgrading to 2.3.2, my custom user registration breaks. I have 
 auth_user password encoded as follows in my user's model:
 ...
 Field('password', 'password',
 readable=False,
 label=T('Password'),
 requires=[CRYPT(), IS_LENGTH(512, 6)],
 ),
 ...

 During registration, I create the register_form like so in my controller:

 register_form = SQLFORM.factory(
 ...
 db.auth_user.password,
 Field('password2', 'password',
 label=T(Verify password'),
 requires=db.auth_user.password.requires,
 ),
 ...
 )


 During form acceptance, the form is validated by this:

 def validate_registration(form):
  ...
 if form.vars.password != form.vars.password2:
 form.errors.password = form.errors.password2 = T(
 'Passwords do not match')
 ...
 return form

 The problem is the passwords aren't the same. I'm assuming the problem is 
 the requires=CRYPT(), which actually encrypts the password twice, producing 
 two different results for password and password2. How would I  get CRYPT() 
 to product the same result for both passwords? Do I need to pass in the 
 hmac_key or salt? Or not run CRYPT() at all?


-- 





[web2py] just upgraded to 2.3.2 stable and getting ticket ...

2013-01-06 Thread weheh


Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 212, in restricted
exec ccode in environment
  File C:\web2py\applications\myapp\views\foo/xyzzy.html, line 516, in 
module
  File C:\web2py\gluon\compileapp.py, line 140, in LOAD
from html import TAG, DIV, URL, SCRIPT, XML
ImportError: cannot import name TAG

-- 





[web2py] Re: REF: Change order of fields in a form??!

2013-01-05 Thread weheh
Probably the easiest way to change order of fields in a form is change the 
order in which the fields are declared in the db.define_table(Field()...) 
model.

On Friday, January 4, 2013 3:22:51 PM UTC+8, software.ted wrote:

 How do you change the order of the form after it has been created using:

 form = SQLFORM(db.table)

 Also how do you change the font of the web2py editor???

 -- 

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is 
 all - Thomas Carlyle 1795-1881

 /~ 


-- 





[web2py] Multiple File Upload

2013-01-04 Thread weheh
Is multi-file upload still roll-your-own, a la:
https://groups.google.com/forum/?fromgroups=#!searchin/web2py/multiple$20file$20upload/web2py/XpnUb2_MaRc/DkUOi4iDrPYJ

or is there something native, as per proposals:
https://groups.google.com/forum/?fromgroups=#!searchin/web2py/multi$20upload/web2py/MenvVfNJCnU/ZQxfwPSX0SUJ

?

It seems there's no web2py_slice on the topic. I'm thinking it's useful 
enough to be a feature. I'm looking at something jQuery-ish. This is slick 
enough for me, especially if it can be made it a component:
https://github.com/blueimp/jQuery-File-Upload/wiki/Setup

-- 





[web2py] Re: fadeOut response.flash

2012-12-20 Thread weheh
Look at the js named web2py.js which comes with the scaffolding. The 
flash function does not fadeout after time. You can add a function to this 
file (or modify the flash function) to timeout and fadeOut your flash as 
you choose.

On Thursday, December 20, 2012 4:36:25 PM UTC+8, Johann Spies wrote:

 When I log in the flash telling me that I am logged in does not timeout 
 until I close it.

 I want it to fade out after a period - say two seconds.  I have no clarity 
 on how to change this behaviour in web2py.js.

 How do get the flash to fade out and set the timeout?

 Regards
 Johann

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


-- 





[web2py] impersonate broken

2012-12-09 Thread weheh
Since upgrading to web2py 2.x from 1.9x.x, (I'm running 2.2.1 stable from 
source) auth.impersonate isn't working for me any more. My controller 
user.py has an impersonate action that calls auth.impersonate (first bold 
line below):

@auth.requires_login()
def impersonate():
user_id = int(request.args(0))
*imp_form = auth.impersonate(user_id)*
*if not isinstance(imp_form, SQLFORM):*
if user_id == 0:
redirect(URL(c='action1', f='index', args=args, 
extension=False))
redirect(URL(c='action2', f='index', args=args, extension=False))
return dict(imp_form=imp_form)


The line
imp_form = auth.impersonate(user_id)
used to work fine but now throws the ticket:

Traceback (most recent call last):
  File N:\web2py\gluon\restricted.py, line 212, in restricted
exec ccode in environment
  File N:/web2py/applications/myapp/controllers/user.py 
http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/user.py, line 674, in 
module
  File N:\web2py\gluon\globals.py, line 188, in lambda
self._caller = lambda f: f()
  File N:\web2py\gluon\tools.py, line 2911, in f
return action(*a, **b)
  File N:/web2py/applications/myapp/controllers/user.py 
http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/user.py, line 555, in 
impersonate
imp_form = auth.impersonate(user_id)
  File N:\web2py\gluon\tools.py, line 2826, in impersonate
return SQLFORM(table_user, user.id, readonly=True)
UnboundLocalError: local variable 'user' referenced before assignment

I've traced it in eclipse and user_id is set properly.

I went into gluon/tools.py and hacked line 2826 to be

return SQLFORM(table_user, user_id, readonly=True)

and that resolves the ticket. However, the not isinstance(imp_form, SQLFORM) 
clause (see emboldened text above) isn't triggering any longer, so I'm not 
getting the expected redirection after impersonation.

Any help would be appreciated. Thanks.


-- 





[web2py] Re: impersonate broken

2012-12-09 Thread weheh
I tried running nightly build, but web2py wouldn't start:

Traceback (most recent call last):
  File 
N:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py, 
line 3, in module
import pydev_imports
  File 
N:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydev_imports.py,
 
line 14, in module
from _pydev_SimpleXMLRPCServer import SimpleXMLRPCServer
  File 
N:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\_pydev_SimpleXMLRPCServer.py,
 
line 115, in module
import SocketServer
  File c:\Program Files (x86)\Python25\lib\SocketServer.py, line 132, in 
module
import socket
  File c:\Program Files (x86)\Python25\lib\socket.py, line 45, in module
import _socket
ImportError: DLL load failed: The specified module could not be found.




On Sunday, December 9, 2012 11:45:54 PM UTC+8, Massimo Di Pierro wrote:

 I believe this is fixed in the nightly built.

 On Sunday, 9 December 2012 07:44:45 UTC-6, weheh wrote:

 Since upgrading to web2py 2.x from 1.9x.x, (I'm running 2.2.1 stable from 
 source) auth.impersonate isn't working for me any more. My controller 
 user.py has an impersonate action that calls auth.impersonate (first bold 
 line below):

 @auth.requires_login()
 def impersonate():
 user_id = int(request.args(0))
 *imp_form = auth.impersonate(user_id)*
 *if not isinstance(imp_form, SQLFORM):*
 if user_id == 0:
 redirect(URL(c='action1', f='index', args=args, 
 extension=False))
 redirect(URL(c='action2', f='index', args=args, extension=False))
 return dict(imp_form=imp_form)


 The line
 imp_form = auth.impersonate(user_id)
 used to work fine but now throws the ticket:

 Traceback (most recent call last):
   File N:\web2py\gluon\restricted.py, line 212, in restricted
 exec ccode in environment
   File N:/web2py/applications/myapp/controllers/user.py 
 http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/user.py, line 674, 
 in module
   File N:\web2py\gluon\globals.py, line 188, in lambda
 self._caller = lambda f: f()
   File N:\web2py\gluon\tools.py, line 2911, in f
 return action(*a, **b)
   File N:/web2py/applications/myapp/controllers/user.py 
 http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/user.py, line 555, 
 in impersonate
 imp_form = auth.impersonate(user_id)
   File N:\web2py\gluon\tools.py, line 2826, in impersonate
 return SQLFORM(table_user, user.id, readonly=True)
 UnboundLocalError: local variable 'user' referenced before assignment

 I've traced it in eclipse and user_id is set properly.

 I went into gluon/tools.py and hacked line 2826 to be

 return SQLFORM(table_user, user_id, readonly=True)

 and that resolves the ticket. However, the not isinstance(imp_form, 
 SQLFORM) clause (see emboldened text above) isn't triggering any longer, so 
 I'm not getting the expected redirection after impersonation.

 Any help would be appreciated. Thanks.




-- 





[web2py] is something broken with impersonate?

2012-11-28 Thread weheh
I'm running 2.1.1 stable and running http://.../impersonate/0 causes a 
failure in gluon/tools.py on line 2755 saying that user.id is not defined. 
However, no ticket is issued and instead, I get 

Internal errorTicket issued: 
unknownhttp://127.0.0.1:8000/admin/default/ticket/unknown


-- 





[web2py] error in jsonrpc doc

2012-11-26 Thread weheh
web2py doc, Ch. 10 section on JSONRPC service has unfinished line:

 from gluon.contrib.simplejsonrpc import

should read

 from gluon.contrib.simplejsonrpc import ServerProxy



-- 





[web2py] web2py 2.1.1 web2py-component-flash breaks backward compatibility

2012-10-21 Thread weheh
There appears to be some new code in gluon/main.py to handle component 
flash.

# @line 564 in gluon/main.py
if response.flash:
http_response.headers['web2py-component-flash'] = urllib2.quote(
xmlescape(response.flash).replace('\n',''))


Problem with this is that urllib2.quote() is putting %20s everywhere there 
are spaces in my flash message, which causes the whole flash message to get 
messed up. Take away the urllib2.quote() function and everything is OK.

Is urllib2.quote() really necessary here? I can't imagine why, 'cause I 
don't know how to keep it from messing up my flash message.

-- 





[web2py] response.stream

2012-10-18 Thread weheh
Is it possible to do a response.stream in the middle of an ajax callback?

I want to give users a button, which if pressed, will tar up all their 
files and initiate a download. Something like this:

TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % URL(c='mycontroller', 
f='mydownload'))

Then later, in mycontroller.py, 

def mydownload():
... create tarfile ...
return response.stream(tarfile, attachment=True)

I tried it, but (perhaps obviously to some) it doesn't work. So, how to get 
the mydownload() action to cause the browser to download the tarfile?

-- 





[web2py] Re: response.stream

2012-10-18 Thread weheh
Hi Niphlod - I modified my response.stream call to include the filename 
argument. When I call the controller, the file does get downloaded. 
However, when ajax calls the controller, the file isn't downloaded.

@Leonel, a simple link, like A('download tar file', _href='%?attachment' % 
path_to_download_file) won't work because the file to be downloaded doesn't 
exist at the time the link is created. It needs to be generated on the fly.


On Thursday, October 18, 2012 4:46:33 PM UTC+8, Niphlod wrote:

 the first thing is: when you navigate to mycontroller/mydownload (no ajax) 
 can you get the file downloaded ?
 second thing missing from your code: if you want the content downloaded as 
 an attachment, set the content-disposition header to attachment; 
 filename=afilename.tar (or if you're using recent web2py version 
 response.stream(file, attachment=True, filename=afilename.tar))

 On Thursday, October 18, 2012 8:09:09 AM UTC+2, weheh wrote:

 Is it possible to do a response.stream in the middle of an ajax callback?

 I want to give users a button, which if pressed, will tar up all their 
 files and initiate a download. Something like this:

 TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % 
 URL(c='mycontroller', f='mydownload'))

 Then later, in mycontroller.py, 

 def mydownload():
 ... create tarfile ...
 return response.stream(tarfile, attachment=True)

 I tried it, but (perhaps obviously to some) it doesn't work. So, how to 
 get the mydownload() action to cause the browser to download the tarfile?



-- 





[web2py] SQLFORM.grid 2.1.1 backward compatibility issue

2012-10-18 Thread weheh
I have a datetime field I want to represent differently using a lambda 
function. Instead of datetime, I want a timedelta. This was not a problem 
with version 1.99.x but is a problem with 2.1.1 because grid tries to do a 
row.year, which throws this ticket:

Traceback (most recent call last):
  File N:\web2py\gluon\restricted.py, line 209, in restricted
exec ccode in environment
  File N:/web2py/applications/mya/controllers/myc.py 
http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/yak.py, line 663, in 
module
  File N:\web2py\gluon\globals.py, line 187, in lambda
self._caller = lambda f: f()
  File N:\web2py\gluon\tools.py, line 2838, in f
return action(*a, **b)
  File N:/web2py/applications/mya/controllers/myc.py 
http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/yak.py, line 191, in 
list_stuff
ui='web2py',
  File N:\web2py\gluon\sqlhtml.py, line 2108, in grid
value = field.formatter(value)
  File N:\web2py\gluon\dal.py, line 8605, in formatter
value = item.formatter(value)
  File N:\web2py\gluon\validators.py, line 2529, in formatter
return self.other.formatter(value)
  File N:\web2py\gluon\validators.py, line 2220, in formatter
year = value.year
AttributeError: 'datetime.timedelta' object has no attribute 'year'


Are we no longer supposed to use lambda functions to reformat our tables 
when grid is involved?

-- 





[web2py] Re: response.stream

2012-10-18 Thread weheh
This thread seems to have the answer: 
https://groups.google.com/forum/?fromgroups=#!searchin/web2py/content$20disposition/web2py/61vbQQ6_-vk/zqfK4qCXxdEJ

The key is to use _onclick='window.open(%s);' % URL(...download script 
...)

This works OK, but, to be blunt, it's fugly the way it performs when it 
opens the window. I must find a better way.

-- 





[web2py] Has anyone seen any difference with response.flash since upgrading to 2.1.1?

2012-10-18 Thread weheh
Has anyone seen any difference with response.flash since upgrading to 2.1.1?

-- 





[web2py] Re: Reloading modules stops working after some time ...

2012-10-18 Thread weheh
I am now seeing this issue again on 2.1.1. I'm getting True from 
is_tracking_changes() but a change in one of my modules isn't showing in 
the browser.

On Tuesday, October 16, 2012 4:15:42 AM UTC+8, David Marko wrote:

 I have a module in my app that i was working on extensively today. I 
 realised that web2py doesnt reload it correctly when change tracking 
 enabled. I did some changes to module, after some 4 or 5 save/reload cycles 
 wbe2py stopped reloading the module so old code runned. I could see old 
 messages printed on console. After web2py restarted things went fine but 
 after some time the same behaviour reappeared ... Module reloading stopped 
 or i had to resave module 3-4 times to reflect in browser. Entire behaviour 
 is rather weird as one is not sure with version of my code is actualy 
 running ...

 David


-- 





[web2py] Is this possible: html link with ajax response?

2012-10-18 Thread weheh
I want to follow a link AND get a response from an ajax request. Something 
like this:

A('link text', _href=URL(...), _onclick='alert(test); 
jQuery(somediv).html(foobar).show();')

Is that possible?

-- 





[web2py] Re: web2py/gluon/compileapp.py throwing ticket

2012-10-17 Thread weheh
Uh, yes.

-- 





[web2py] response.flash during login - backward compatibility issue

2012-10-17 Thread weheh
I use a non-standard login where I user auth.settings.login_onaccept to 
complete the login process.

Prior to upgrading to web2py 2.1.1, my login response.flash would display

Welcome so and so.

now, it displays

Welcome%20so%20and%20so

I think something downstream in web2py changed because I didn't change my 
code. How to modify to get rid of the %20s?

My app's response.flash = DIV(T(...), _class='...'), so there's nothing 
special there. Looks like maybe there's a strict XML downstream ... just 
guessing.

-- 





[web2py] Re: response.flash during login - backward compatibility issue

2012-10-17 Thread weheh
I'm now seeing this in other cases, so it's not isolated to login.

-- 





Re: [web2py] Re: Reloading modules stops working after some time ...

2012-10-17 Thread weheh
I experienced this issue with the 1.99 series web2py. Not enough experience 
with 2.1.1 to say for sure if it's still there. However, with 2.1.1, when I 
insert print is_tracking_changes() I always see True. Will report any 
inconsistencies if I see them in the future.

On Thursday, October 18, 2012 6:02:23 AM UTC+8, Richard wrote:

 I do notice the same problem here and it drive me crazy... I suspect that, 
 but since it seems to be intermittent, I wasn't sure...

 I did what you ask and I get True all the time, but the change I had made 
 to module never been applied when page render.

 Richard


 On Mon, Oct 15, 2012 at 4:58 PM, Massimo Di Pierro 
 massimo@gmail.comjavascript:
  wrote:

 Can you do

 from gluon.custom_import import *
 track_changes(True)
 print is_tracking_changes()

 does it print True all time? It should.




 On Monday, 15 October 2012 15:43:49 UTC-5, David Marko wrote:

 Using the latest trunk ... Updated today

  -- 
  
  
  




-- 





[web2py] web2py/gluon/compileapp.py throwing ticket

2012-10-16 Thread weheh
I'm getting the following ticket after upgrading from web2py 1.99.x to 
2.1.1 source:

Traceback (most recent call last):
  File N:\web2py\gluon\restricted.py, line 209, in restricted
exec ccode in environment
  File N:\web2py\applications\myapp\views\mycontroller/index.html, line 444, 
in module
jQuery('#image-form').ajaxForm({
  File N:\web2py\gluon\compileapp.py, line 136, in LOAD
from html import TAG, DIV, URL, SCRIPT, XML
ImportError: cannot import name TAG


-- 





[web2py] Re: Basic question about CSS / Web2py !

2012-10-15 Thread weheh
Check the doc on Database Abstraction Level for the full signature of 
Field. The Field argument to db.define_table includes the label argument, 
and yes, you can do something like this:
db.define_table('mytable',
Field(myfield, label=T('mylabel'),
)




On Tuesday, October 16, 2012 8:41:07 AM UTC+8, Don_X wrote:

 Hello web2py users,

 This is a basic enquiry :

 but not insignificant !

 Is it possible to wrap a label name -

 one example among many similar situations that I am encountering :

 within a table define,  a label is set for a field as follows : .. 
 label =T('Re-enter email') .

 when the T function kicks in to translate the argument in another 
 language, the translation result happens to be too long  for the space 
 initially defined for that same label 

 so .. is it possible to nicely wrap that label argument  ... right there 
 in field declaration of the table define ... so it does not distort the 
 form or table it ( the label ) is destined to appear or be viewed ??? 

 thank you !

 Don


-- 





[web2py] Re: Basic question about CSS / Web2py !

2012-10-15 Thread weheh
msg = 'this is a very long string ...'
msg += 'this is some more '
msg += 'and more ...'
db.define_table(..., Field='xyz', label=DIV(msg, _style='width: 100px;'), 
...)

On Tuesday, October 16, 2012 10:10:20 AM UTC+8, Don_X wrote:

 weheh !

 Thank you for your response ... but this is not what I am looking for ! 

 I know about what you suggested below .. this is how it is declared .. 
 indeed !

 Now ... Can the label argument take an HTML helper of somekind, so if the 
 translation of 'mylabel'  happens  and it is too long of an expression,

 a way to make it wrap, like  in two lines or something !??? ...  

 For example : 

 db.define_table('mytable',
 Field(myfield, label=T('an expression in english'),
 )

 now .. the label says 'an expression in english'

 the same expression in another language happens to be almost twice the 
 length shown above ! .. do you understand ? .. 
 now .. how can that translated expression be wrapped a certain way ... 
 within the label ... in order to occupy almost the same space without 
 interrupting the table or the form it is shown on ??? ...




-- 





[web2py] Re: doc suggestion

2012-10-15 Thread weheh
Change bar shows a vertical bar on right side of page spanning lines of 
text that have changed from the previous version(s). Optional is 
self-explanatory.

On Sunday, October 14, 2012 5:10:37 PM UTC+8, Niphlod wrote:

 ehm what are optional change bars like ?

 On Sunday, October 14, 2012 1:25:37 AM UTC+2, weheh wrote:

 Optional change bars could be useful on the online documentation.



-- 





[web2py] impersonate anonymous

2012-10-13 Thread weheh
How does one go about impersonating an anonymous user, the effect being 
that session will take on the anonymous user's last session state? 
impersonate/0 would restore session to its state before beginning 
impersonation.

-- 





[web2py] doc suggestion

2012-10-13 Thread weheh
Optional change bars could be useful on the online documentation.

-- 





[web2py] Re: No module named webclient

2012-09-26 Thread weheh
I don't have login permissions on the doc any longer but I could clean up a 
few typos if you'll give access again.

On Wednesday, September 26, 2012 11:16:58 AM UTC+8, Massimo Di Pierro wrote:

 yes. requires 2.0.x

 On Tuesday, 25 September 2012 21:45:04 UTC-5, weheh wrote:

 Using web2py 1.99.4, as per doc on functional testing, I'm doing:

 from gluon.contrib.webclient import WebClient

 Is this only available in a later version of web2py? Because I'm getting a 
 ticket:

   File N:\web2py\gluon\custom_import.py, line 293, in __call__

 fromlist, level)
   File N:\web2py\gluon\custom_import.py, line 132, in __call__
 raise e  # Don't hide something that went wrong
 ImportError: No module named webclient



-- 





[web2py] How to get geo location?

2012-09-25 Thread weheh
I want to play around with geo location stuff. Is there a simple way to get 
the location of the user's browser when they access a controller/action 
within web2py? I'm not trying to convert an address to a geo location. I'm 
looking for lat/long info from the user's browser at the time they make a 
request.

-- 





[web2py] No module named webclient

2012-09-25 Thread weheh


Using web2py 1.99.4, as per doc on functional testing, I'm doing:

from gluon.contrib.webclient import WebClient


Traceback shows:

  File N:\web2py\gluon\custom_import.py, line 293, in __call__
fromlist, level)
  File N:\web2py\gluon\custom_import.py, line 132, in __call__
raise e  # Don't hide something that went wrong
ImportError: No module named webclient

-- 





[web2py] URGENT - web2py server crashes

2012-09-19 Thread weheh
I'm getting a web2py crash. Here's the trace at the web2py 1.99.7 
(2012-03-04 22:12:08) stable console:

DEBUG: connect attempt 1, connection error:
Traceback (most recent call last):
  File C:\web2py\gluon\dal.py, line 5955, in __init__
self.adapter = ADAPTERS[self._dbname](*args)
  File C:\web2py\gluon\dal.py, line 2010, in __init__
self.pool_connection(connect)
  File C:\web2py\gluon\dal.py, line 485, in pool_connection
self.connection = f()
  File C:\web2py\gluon\dal.py, line 2009, in connect
return self.driver.connect(msg,**driver_args)
OperationalError: could not connect to server: No buffer space available 
(0x2747/10055)
Is the server running on host localhost and accepting
TCP/IP connections on port 5432?
cold not connect to server: No buffer space available (0x2747/1055)
Is the server running on host localhost and accepting
TCP/IP connections on port 5432?

This is the third time in 72 hours it's done this. It's taking down my 
site. Anybody have any ideas?

-- 





Re: [web2py] URGENT - web2py server crashes

2012-09-19 Thread weheh
Definitely some kind of running out of memory issue. Now, I'm getting this:


web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.99.7 (2012-03-04 22:12:08) stable
Database drivers available: SQLite3, pymysql, psycopg2, pg8000, IMAP
Starting hardcron...
please visit:
http://127.0.0.1:8000
use kill -SIGTERM 45896 to shutdown the web2py server
ERROR:Rocket.Errors.Thread-6:Traceback (most recent call last):

  File C:\web2py\gluon\rocket.py, line 1302, in run
self.run_app(conn)

  File C:\web2py\gluon\rocket.py, line 2004, in run_app
for data in output:

  File C:\web2py\gluon\streamer.py, line 30, in streamer
data = stream.read(chunk_size)

MemoryError

ERROR:Rocket.Errors.Thread-8:Traceback (most recent call last):

  File C:\web2py\gluon\rocket.py, line 1302, in run
self.run_app(conn)

  File C:\web2py\gluon\rocket.py, line 1986, in run_app
self.environ = environ = self.build_environ(sock_file, conn)

  File C:\web2py\gluon\rocket.py, line 1807, in build_environ
request = self.read_request_line(sock_file)

  File C:\web2py\gluon\rocket.py, line 1363, in read_request_line
d = sock_file.readline()

  File C:\Program Files (x86)\Python25\lib\socket.py, line 381, in 
readline
data = self._sock.recv(self._rbufsize)

MemoryError

Exception in thread Thread-14:
Traceback (most recent call last):
  File C:\Program Files (x86)\Python25\lib\threading.py, line 486, in 
__bootst
rap_inner
self.run()
  File C:\web2py\gluon\newcron.py, line 234, in run
(stdoutdata,stderrdata) = proc.communicate()
  File C:\Program Files (x86)\Python25\lib\subprocess.py, line 670, in 
communi
cate
return self._communicate(input)
  File C:\Program Files (x86)\Python25\lib\subprocess.py, line 887, in 
_commun
icate
stderr_thread.start()
  File C:\Program Files (x86)\Python25\lib\threading.py, line 440, in 
start
_start_new_thread(self.__bootstrap, ())
error: can't start new thread

-- 





Re: [web2py] URGENT - web2py server crashes

2012-09-19 Thread weheh
How to disable cron? I've read other threads on this, but can't find the 
right incantation.


On Thursday, September 20, 2012 9:37:18 AM UTC+8, Jonathan Lundell wrote:

 On 19 Sep 2012, at 6:27 PM, weheh richard...@verizon.net javascript: 
 wrote: 
  Definitely some kind of running out of memory issue. Now, I'm getting 
 this: 

 Can you run the server without cron? It's probably not *that* significant 
 that newcron shows up in the traceback, but turning it off (if you can) 
 might be a good idea, just as an experiment. 

  
  
  web2py Web Framework 
  Created by Massimo Di Pierro, Copyright 2007-2011 
  Version 1.99.7 (2012-03-04 22:12:08) stable 
  Database drivers available: SQLite3, pymysql, psycopg2, pg8000, IMAP 
  Starting hardcron... 
  please visit: 
  http://127.0.0.1:8000 
  use kill -SIGTERM 45896 to shutdown the web2py server 
  ERROR:Rocket.Errors.Thread-6:Traceback (most recent call last): 
  
File C:\web2py\gluon\rocket.py, line 1302, in run 
  self.run_app(conn) 
  
File C:\web2py\gluon\rocket.py, line 2004, in run_app 
  for data in output: 
  
File C:\web2py\gluon\streamer.py, line 30, in streamer 
  data = stream.read(chunk_size) 
  
  MemoryError 
  
  ERROR:Rocket.Errors.Thread-8:Traceback (most recent call last): 
  
File C:\web2py\gluon\rocket.py, line 1302, in run 
  self.run_app(conn) 
  
File C:\web2py\gluon\rocket.py, line 1986, in run_app 
  self.environ = environ = self.build_environ(sock_file, conn) 
  
File C:\web2py\gluon\rocket.py, line 1807, in build_environ 
  request = self.read_request_line(sock_file) 
  
File C:\web2py\gluon\rocket.py, line 1363, in read_request_line 
  d = sock_file.readline() 
  
File C:\Program Files (x86)\Python25\lib\socket.py, line 381, in 
 readline 
  data = self._sock.recv(self._rbufsize) 
  
  MemoryError 
  
  Exception in thread Thread-14: 
  Traceback (most recent call last): 
File C:\Program Files (x86)\Python25\lib\threading.py, line 486, in 
 __bootst 
  rap_inner 
  self.run() 
File C:\web2py\gluon\newcron.py, line 234, in run 
  (stdoutdata,stderrdata) = proc.communicate() 
File C:\Program Files (x86)\Python25\lib\subprocess.py, line 670, in 
 communi 
  cate 
  return self._communicate(input) 
File C:\Program Files (x86)\Python25\lib\subprocess.py, line 887, in 
 _commun 
  icate 
  stderr_thread.start() 
File C:\Program Files (x86)\Python25\lib\threading.py, line 440, in 
 start 
  _start_new_thread(self.__bootstrap, ()) 
  error: can't start new thread 
  
  
  -- 







-- 





<    1   2   3   4   5   6   7   8   9   10   >