[web2py] Re: output the name of file stored in table in upload filed?

2013-12-21 Thread deepak sandhu
diva href={{=URL('default', 'download', args=row.files.documentx)}}
{{=row.files.documentx.name}}/a/div

i tried this but still dont work :(

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


[web2py] Re: how do I create, multiple forms and precess them, using 'for' statement?

2013-12-21 Thread Ivo
I got it resolved... ashamed to say it but I missed the = in 
the {{form.custom.end}} tag :(

On Friday, December 20, 2013 3:16:34 PM UTC+1, Ivo wrote:

 I have chosen to go the custom form way.
 The only issue I have is that upon hitting submit, the button submits all 
 the forms on the page instead of just the one owning the button. I think 
 this also screws up my validation and it prevents records from being 
 inserted to the db.  

 controller:
 def show_form():
 
 users_1 = 
 db(db.people.id.belongs(session.people.keys())).select(db.people.user_id)
 users_2=[]
 for user in users_1:
 if user not in users_2:
 users_2.append(user)
 else:
 pass

 forms=[]  
 for user in users_2:
 usr= db(db.auth_user.id
 ==user.user_id).select(db.auth_user.username,db.auth_user.id)[0]
 usr1=usr.username
 usr2=usr.id
 key=str(usr2)
 fields = [
   Field('key',default=key,writable=False),
   Field('username',default=usr1,writable=False),
   Field('address',default='Fill in your 
 address',type='text')
   ]

 form=SQLFORM.factory(*fields, 
 table_name=key,hidden=dict(ss_id=key),
  buttons=[
   BUTTON(Save Changes, 
 _class=btn btn-primary)])
 if form.process(formname=key, hideerror=True).accepted:
 db.parking.insert(name=usr1, address=form.vars.address)
 forms.append(form)
 
 return dict(forms=forms)



 view:
 {{for form in forms:}}
 {{=form.custom.begin}}
 User: {{=form.custom.widget.username}} br
 Address: {{=form.custom.widget.address}} br
 {{form.custom.end}}brbr
 {{pass}}


 On Wednesday, December 18, 2013 9:45:14 PM UTC+1, Niphlod wrote:

 form.process adds little bits to the form to be able to actually process 
 the posted data.

 in pseudo-code you need to

 list_of_forms = []
 for something in list_of_values:
  key = something_unique
  form = SQLFORM()
  if form.process(formname=something_unique).accepted:
.code dealing with the posted values, such as form.vars, 
 etc
  elif form.errors:
.code dealing with form errors

  list_of_forms.append(form)
 ..
 return dict(list_of_forms=list_of_forms, )

 In the view, you can then:

 {{for single_form in list_of_forms:}}
 div class=row
 {{=single_form}} #or {{single_form.custom.etc etc etc}}
 /div
 hr /
 {{pass}}



-- 
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: Wordpress model file

2013-12-21 Thread Alan Etkin


 I have several projects in my work, that require handling wordpress. As I 
 hate doing stuff in PHP, and DAL is my prefered tool for a lot of my work, 
 I've created a model file of wordpress. I hope you'll find it useful, and 
 I'd love to hear your feedback


It must be because I've never used wordpress, but, what is the purpose of 
the model file. How do you use such model?

-- 
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] setting up web2py for godaddy.com

2013-12-21 Thread António Ramos
not related.
You have to setup godaddy for web2p , not the other way.

Its like any other dns.




2013/12/20 AY ahmet.bugra.ya...@gmail.com

 Hi,

 I am trying to setup web2py for godaddy.com

 Anyone with experience with Godaddy.com?

 Or any suggestions?

 Regards,


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/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: output the name of file stored in table in upload filed?

2013-12-21 Thread Leonel Câmara
This is simple enough, upload fields have a retrieve_file_properties method 
which returns the path and filename of the stored file.

-- 
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 not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2013-12-21 Thread sherdim

On Sunday, December 15, 2013 4:36:47 PM UTC+4, Niphlod wrote:

 open a dos prompt, cd into the folder and try to start it from there to 
 see if it prints something...

 BTW: is web2py.exe working ? 


Yes, but web2py_no_console.exe  quits silently

 

-- 
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 not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2013-12-21 Thread Niphlod
that's even stranger :D
let's go with care how about you open a dos prompt, cd into the folder 
where web2py.exe and web2py_noconsole.exe are and launch 
web2py_noconsole.exe from there ?
Does it print something ?


On Saturday, December 21, 2013 1:23:50 PM UTC+1, sherdim wrote:


 On Sunday, December 15, 2013 4:36:47 PM UTC+4, Niphlod wrote:

 open a dos prompt, cd into the folder and try to start it from there to 
 see if it prints something...

 BTW: is web2py.exe working ? 


 Yes, but web2py_no_console.exe  quits silently

  


-- 
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: Wordpress model file

2013-12-21 Thread Niphlod
I guess it's to read/write/update existing wordpress tables ^_^  I'd 
put it on web2pyslices to have a reference for the users in the need of it.

On Saturday, December 21, 2013 11:31:12 AM UTC+1, Alan Etkin wrote:

 I have several projects in my work, that require handling wordpress. As I 
 hate doing stuff in PHP, and DAL is my prefered tool for a lot of my work, 
 I've created a model file of wordpress. I hope you'll find it useful, and 
 I'd love to hear your feedback


 It must be because I've never used wordpress, but, what is the purpose of 
 the model file. How do you use such model?


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


[web2py] Re: how do I create, multiple forms and precess them, using 'for' statement?

2013-12-21 Thread Niphlod
don't worry, it's a mistake you'll probably never do again :P

On Saturday, December 21, 2013 11:27:13 AM UTC+1, Ivo wrote:

 I got it resolved... ashamed to say it but I missed the = in 
 the {{form.custom.end}} tag :(

 On Friday, December 20, 2013 3:16:34 PM UTC+1, Ivo wrote:

 I have chosen to go the custom form way.
 The only issue I have is that upon hitting submit, the button submits all 
 the forms on the page instead of just the one owning the button. I think 
 this also screws up my validation and it prevents records from being 
 inserted to the db.  

 controller:
 def show_form():
 
 users_1 = 
 db(db.people.id.belongs(session.people.keys())).select(db.people.user_id)
 users_2=[]
 for user in users_1:
 if user not in users_2:
 users_2.append(user)
 else:
 pass

 forms=[]  
 for user in users_2:
 usr= db(db.auth_user.id
 ==user.user_id).select(db.auth_user.username,db.auth_user.id)[0]
 usr1=usr.username
 usr2=usr.id
 key=str(usr2)
 fields = [
   Field('key',default=key,writable=False),
   Field('username',default=usr1,writable=False),
   Field('address',default='Fill in your 
 address',type='text')
   ]

 form=SQLFORM.factory(*fields, 
 table_name=key,hidden=dict(ss_id=key),
  buttons=[
   BUTTON(Save Changes, 
 _class=btn btn-primary)])
 if form.process(formname=key, hideerror=True).accepted:
 db.parking.insert(name=usr1, address=form.vars.address)
 forms.append(form)
 
 return dict(forms=forms)



 view:
 {{for form in forms:}}
 {{=form.custom.begin}}
 User: {{=form.custom.widget.username}} br
 Address: {{=form.custom.widget.address}} br
 {{form.custom.end}}brbr
 {{pass}}


 On Wednesday, December 18, 2013 9:45:14 PM UTC+1, Niphlod wrote:

 form.process adds little bits to the form to be able to actually process 
 the posted data.

 in pseudo-code you need to

 list_of_forms = []
 for something in list_of_values:
  key = something_unique
  form = SQLFORM()
  if form.process(formname=something_unique).accepted:
.code dealing with the posted values, such as form.vars, 
 etc
  elif form.errors:
.code dealing with form errors

  list_of_forms.append(form)
 ..
 return dict(list_of_forms=list_of_forms, )

 In the view, you can then:

 {{for single_form in list_of_forms:}}
 div class=row
 {{=single_form}} #or {{single_form.custom.etc etc etc}}
 /div
 hr /
 {{pass}}



-- 
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: javascript in controller

2013-12-21 Thread Niphlod
it's exactly how it's supposed to be. inlined attributes must be escaped, 
and - correctly - they are.

On Friday, December 20, 2013 11:56:34 PM UTC+1, sonu kumar wrote:

 Hi,

 When I use below code in controller to show form. It works fine but when I 
 see html source of html page...it shows some charachters...which is shown 
 in red below. how to remove them?

 form=FORM(TABLE(TR('Select 
 protease:',SELECT(values,requires=IS_NOT_EMPTY(choose one 
 value),_name='protease',_onchange=jQuery.post('%s',{'protease':jQuery(this).val()})
  
 % URL('mmp'))),
 TR('Enter sequence:',TEXTAREA(_name='fasta',_style = 
 'font-family:Courier; width:550px;height:250px;')),
 
 TR(,INPUT(_type=submit,_value=SUBMIT,_onclick='javascript:$.blockUI({message:
  
 $(#domMessage) });'

 form action=# enctype=multipart/form-data method=posttabletr
 tdSelect protease:/tdtdselect name=protease onchange=
 jQuery.post(#x27;/CleavPredict/default/mmp#x27;,{#x27;protease#x27;
 :jQuery(this).val()})option value=/optionoption value=MMP2MMP2
 /optionoption value=MMP3MMP3/optionoption value=MMP8MMP8
 /optionoption value=MMP9MMP9/option/select/td/tr
 trtdEnter fasta sequence:/tdtdtextarea cols=40 name=fasta 
 rows=10 style=font-family:Courier; width:550px;height:250px;
 /textarea/td/tr
 trtd/tdtdinput onclick=javascript:$.blockUI({message: $(quot;
 #domMessagequot;) }); type=submit value=SUBMIT /input class=btn 
 type=reset value=Reset //td/tr/table
 /form


-- 
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: Wordpress model file

2013-12-21 Thread Leonel Câmara
This is great, thanks for sharing!

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


Re: [web2py] auth.is_logged_in and @auth.requires_signature() under investigation

2013-12-21 Thread Marin Pranjić
Hello,

I tried to trace down the problem.

If you sign an url on different scheme (http - https) everything works
when opened manually in browser.
But when opening it async, for example using $.ajax, current.session is
empty.
This causes URL.Verify to return False because there is no session.auth
record stored.

CORS requests assign new session ID every time. Why? Because cookies are
not sent.
The jQuery 'fix' is described here:
http://stackoverflow.com/questions/8863571/cors-request-why-are-the-cookies-not-sent

Solution includes adding xhrFields: {withCredentials: true}.

Should this be treated as a bug in JS-part of components load?


Marin


On Sat, Dec 21, 2013 at 3:44 PM, weheh richard_gor...@verizon.net wrote:

 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.


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

2013-12-21 Thread Marin Pranjić
@weheh, the quick fix would be using custom ajax function instead of using
web2py_component.
It's meant to be used with server-side LOAD helper. Since you can't create
CORS component using LOAD, I'm not sure if web2py_component should work
with CORS either.

So, instead of calling web2py_component, you should write your own
javascript function that, using $.ajax, sends CORS requests and handles it.

Marin


On Sat, Dec 21, 2013 at 4:19 PM, Marin Pranjić marin.pran...@gmail.comwrote:

 Hello,

 I tried to trace down the problem.

 If you sign an url on different scheme (http - https) everything works
 when opened manually in browser.
 But when opening it async, for example using $.ajax, current.session is
 empty.
 This causes URL.Verify to return False because there is no session.auth
 record stored.

 CORS requests assign new session ID every time. Why? Because cookies are
 not sent.
 The jQuery 'fix' is described here:
 http://stackoverflow.com/questions/8863571/cors-request-why-are-the-cookies-not-sent

 Solution includes adding xhrFields: {withCredentials: true}.

 Should this be treated as a bug in JS-part of components load?


 Marin


 On Sat, Dec 21, 2013 at 3:44 PM, weheh richard_gor...@verizon.net wrote:

 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.




-- 
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 LightDot
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
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: setting up web2py for godaddy.com

2013-12-21 Thread Massimo Di Pierro
First of all, don't. Use PythonAnywhere.com instead. It is cheaper, and 
more Python friendly.

If you really have to, you have two options, FastCGI and Proxy. The latter 
is the simplest way. You run web2py from shell as you normally do, from 
localhost, and you configure .htaccess to redirect all traffic to 
127.0.0.1:8000. 

ProxyPass http://localhost:8000/
ProxyPassReverse http://localhost:8000/


On Friday, 20 December 2013 17:41:36 UTC-6, AY wrote:

 Hi,

 I am trying to setup web2py for godaddy.com

 Anyone with experience with Godaddy.com?

 Or any suggestions?

 Regards,




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


Re: [web2py] Re: Proposal - use the value of an environment variable as a path_prefix

2013-12-21 Thread Rob Mayhue
I just want to update this thread.

I liked Jonathan's idea about making path_prefix accept a regex but in 
trying to implement that idea 
I decided on a slightly different solution. The new solution adds 
`prefix_match` as a new router param. 

routers = dict(
...
BASE=dict(
...
prefix_match=r'^/_([^/]+)/([^/]+)'  # '^/' is not required
...
),
)

Then request.prefix_match is set to a List() which will contain the full 
match as the first item and if 
there are any groups they are set as additional elements.

Using the regex above:

# http://127.0.0.1:8000/_my_path_group_1/my_path_group_2/a/c/f

request.prefix_match(0) == '/_my_path_group_1/my_path_group_2'
request.prefix_match(1) == 'my_path_group_1'
request.prefix_match(2) == 'my_path_group_2'
request.prefix_match(3) == None


# http://127.0.0.1:8000/a/c/f

request.prefix_match(0) == None

This makes it work like request.args. If the URL doesn't have a match, then 
the path_prefix is not 
set and will generate errors as normal e.g. invalid function etc.

This just seemed to make better sense to me as it leaves `path_prefix` as 
is with the only caveat being 
if `prefix_match` is set, then it overrides any `path_prefix` that happens 
to be set.

Thoughts?

@Massimo
I haven't created a ticket yet as I was reworking the original idea.


On Saturday, December 14, 2013 6:02:22 PM UTC-5, Rob Mayhue wrote:

 I like this idea better.

 It took me a little while to figure out exactly what was going on in 
 rewrite.py to even arrive at my
 current solution, but I can see that what you suggest would be a better 
 solution as well as easier 
 to use.

 I chose the env var because I knew could easily get to the value in the 
 app using request.env.my_env_variable

 @Massimo

 I'll open a ticket with the general idea and mention this thread.


 On Saturday, December 14, 2013 5:37:19 PM UTC-5, Jonathan Lundell wrote:

 On 14 Dec 2013, at 2:23 PM, Massimo Di Pierro massimo@gmail.com 
 wrote:

 Please open a ticket about this proposal.


 I wonder if a more general solution might not be to have the router 
 accept a regex for path_prefix, strip it from the incoming URL, and save it 
 (say) as request.path_prefix. The outgoing URL rewriter would use 
 request.path_prefix in preference to the value in the router.

 The point of doing it that way would be to avoid a dependency on the host 
 webserver.

 The original use case, iirc, was to support installations in which the 
 domain was shared between web2py and something else, so you could for 
 example have URLs of the form http://domain.com/web2py/app/


 On Saturday, 14 December 2013 15:07:02 UTC-6, Rob Mayhue wrote:

 Proposal - use the value of an environment variable as a path_prefix

 When using the parametric router there is an option called `path_prefix` 
 that's 
 described as a path fragment that is prefixed to all outgoing URLs and 
 stripped 
 from all incoming URLs. I'm not sure what the original use case was for 
 this option 
 but the path fragment is a static value, a string that's added to BASE 
 in routes.py 
 like so:

 routers = dict(
 ...
 BASE=dict(
 ...
 path_prefix='PATH_FRAGMENT',  # or even 'PATH/FRAGMENT'
 ...
 ),
 )


 This allows things like 'http://domain-name.tld/PATH_FRAGMENT/a/c/f'

 In my use case I wanted the simplicity of the parametric router but I 
 needed to be 
 able to pass in the path fragment on the incoming URL so that it could 
 change and 
 still be prefixed to all outgoing URLs and stripped from all incoming 
 URLs, or 
 possibly not even exist at all.

 I made some changes to gluon/rewrite.py to allow the value of an 
 environment variable 
 to be used as the path fragment if it exists. To use it I prefix the 
 string assigned 
 to `path_prefix` with a '$' like this:

 routers = dict(
 ...
 BASE=dict(
 ...
 path_prefix='$MY_ENV_VARIABLE',
 ...
 ),
 )


 Leaving off the '$' causes `path_prefix` to work normally.

 Then in the server config I use a rewrite rule and get the path fragment 
 via a 
 regex and create the environment variable. The following is an apache 
 rewrite rule, 
 but this could be nginx etc as well. This rule gets anything starting 
 with an 
 underscore (e.g. http://domain-name.tld/_MY_VALUE).

 RewriteRule ^/(_[^/]+) - [E=MY_ENV_VARIABLE:$1]


 After that we have an environment variable with 'MY_ENV_VARIABLE' as its 
 key and 
 '_MY_VALUE' as its value.

 Basically the changes I made to gluon/rewrite.py allow the value of that 
 environment 
 variable to be used as the path fragment allowing you to change it by 
 passing in a new 
 path fragment on the URL and it acts just like the original 
 `path_prefix` option.

 In my use case I'm planning to use the path fragment for 
 multi-tenancy. Maybe there 
 is a better way to do this using the pattern based router and I just 
 didn't see it. 

 I wanted to toss this onto the list and get some 

[web2py] OAuth2 + Twitter 'module' object has no attribute 'Consumer' error

2013-12-21 Thread Luciano Laporta Podazza
Hello,

I've been trying to integrate Facebook/Twitter login with 
Web2py 2.8.2-stable and OAuth2(the built-in oauth20_account.py) using this 
example:

https://groups.google.com/forum/#!topic/web2py/S9ukjWz6qMA

Facebook login works but when I try the Twitter example I get this 
traceback:

Traceback (most recent call last):
  File /Users/keniobats/Downloads/web2py/gluon/restricted.py, line 217, in 
restricted
exec ccode in environment
  File /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py 
http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 167, in 
module
twitter_login = TwitterAccount(globals())
  File /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py 
http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 155, in 
__init__
self.ACCESS_TOKEN_URL)
  File 
/Users/keniobats/Downloads/web2py/gluon/contrib/login_methods/oauth10a_account.py,
 line 125, in __init__
self.consumer = oauth.Consumer(self.client_id, self.client_secret)
AttributeError: 'module' object has no attribute 'Consumer'

I've tried including the oauth2 module in web2py/sites-package and 
myapp/modules and still get the same error.
Also, I don't know why in the twitter example oauth2 is imported if Twitter 
is supposed to use oauth 1.0:
import oauth2 as oauth

I love web2py but i'm still a newbie. Any help will be appreciated. 

Thanks in advance.


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


Re: [web2py] OAuth2 + Twitter 'module' object has no attribute 'Consumer' error

2013-12-21 Thread Michele Comitini
oauth2 is an unfortunate name chosen for a module that actually implements
oauth1.0a: see https://pypi.python.org/pypi/oauth2

About the error check that you have installed the above package on your
system.  You can do so in a python shell:

$ python
 import oauth2
 consumer = oauth2.Consumer
 print consumer




2013/12/21 Luciano Laporta Podazza lucianopoda...@gmail.com

 Hello,

 I've been trying to integrate Facebook/Twitter login with
 Web2py 2.8.2-stable and OAuth2(the built-in oauth20_account.py) using this
 example:

 https://groups.google.com/forum/#!topic/web2py/S9ukjWz6qMA

 Facebook login works but when I try the Twitter example I get this
 traceback:

 Traceback (most recent call last):
   File /Users/keniobats/Downloads/web2py/gluon/restricted.py, line 217, in 
 restricted
 exec ccode in environment
   File 
 /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py 
 http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 167, 
 in module
 twitter_login = TwitterAccount(globals())
   File 
 /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py 
 http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 155, 
 in __init__
 self.ACCESS_TOKEN_URL)
   File 
 /Users/keniobats/Downloads/web2py/gluon/contrib/login_methods/oauth10a_account.py,
  line 125, in __init__
 self.consumer = oauth.Consumer(self.client_id, self.client_secret)
 AttributeError: 'module' object has no attribute 'Consumer'

 I've tried including the oauth2 module in web2py/sites-package and
 myapp/modules and still get the same error.
 Also, I don't know why in the twitter example oauth2 is imported if
 Twitter is supposed to use oauth 1.0:
 import oauth2 as oauth

 I love web2py but i'm still a newbie. Any help will be appreciated.

 Thanks in advance.


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


Re: [web2py] Re: setting up web2py for godaddy.com

2013-12-21 Thread Michele Comitini
+1 for PythonAnywhere they really help you and are competent.


2013/12/21 Massimo Di Pierro massimo.dipie...@gmail.com

 First of all, don't. Use PythonAnywhere.com instead. It is cheaper, and
 more Python friendly.

 If you really have to, you have two options, FastCGI and Proxy. The latter
 is the simplest way. You run web2py from shell as you normally do, from
 localhost, and you configure .htaccess to redirect all traffic to
 127.0.0.1:8000.

 ProxyPass http://localhost:8000/
 ProxyPassReverse http://localhost:8000/


 On Friday, 20 December 2013 17:41:36 UTC-6, AY wrote:

 Hi,

 I am trying to setup web2py for godaddy.com

 Anyone with experience with Godaddy.com?

 Or any suggestions?

 Regards,


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


Re: [web2py] OAuth2 + Twitter 'module' object has no attribute 'Consumer' error

2013-12-21 Thread Luciano Laporta Podazza
Hello Michele!,

Well, it seems that I casually rebooted my Mac(OS X 10.9.1) and now 
magically works :P

 print consumer 
class 'oauth2.Consumer'

Now i'm facing some issues with forms at Twitter/Facebook login so perhaps 
you'll see another new post from me.
Just in case, do you have some good(newer) examples of integrating multiple 
login methods?

Lot of thanks!.

On Saturday, December 21, 2013 8:39:43 PM UTC-3, Michele Comitini wrote:

 oauth2 is an unfortunate name chosen for a module that actually implements 
 oauth1.0a: see https://pypi.python.org/pypi/oauth2

 About the error check that you have installed the above package on your 
 system.  You can do so in a python shell:

 $ python
  import oauth2
  consumer = oauth2.Consumer
  print consumer




 2013/12/21 Luciano Laporta Podazza luciano...@gmail.com javascript:

 Hello,

 I've been trying to integrate Facebook/Twitter login with 
 Web2py 2.8.2-stable and OAuth2(the built-in oauth20_account.py) using this 
 example:

 https://groups.google.com/forum/#!topic/web2py/S9ukjWz6qMA

 Facebook login works but when I try the Twitter example I get this 
 traceback:

 Traceback (most recent call last):
   File /Users/keniobats/Downloads/web2py/gluon/restricted.py, line 217, in 
 restricted

 exec ccode in environment
   File 
 /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py 
 http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 167, 
 in module

 twitter_login = TwitterAccount(globals())
   File 
 /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py 
 http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 155, 
 in __init__

 self.ACCESS_TOKEN_URL)
   File 
 /Users/keniobats/Downloads/web2py/gluon/contrib/login_methods/oauth10a_account.py,
  line 125, in __init__

 self.consumer = oauth.Consumer(self.client_id, self.client_secret)
 AttributeError: 'module' object has no attribute 'Consumer'

 I've tried including the oauth2 module in web2py/sites-package and 
 myapp/modules and still get the same error.
 Also, I don't know why in the twitter example oauth2 is imported if 
 Twitter is supposed to use oauth 1.0:
 import oauth2 as oauth

 I love web2py but i'm still a newbie. Any help will be appreciated. 

 Thanks in advance.


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


Re: [web2py] server slow down when face multiple requests

2013-12-21 Thread Vinicius Assef
If you're using sqlite or migrations are enabled, this can be a bottleneck.

On Fri, Dec 20, 2013 at 7:28 PM, sonu kumar
sonu.bioinformat...@gmail.com wrote:
 Hi All,
 I have built one application using web2py and running on Apache server on
 unix environment. During testing of this application what I found is slowing
 down of my application when two users from different computer request my
 application or submit any job.
 I have no idea why it is happening. Are there any changes need at Apache
 server side for handling multiple request or at web2py side.

 Please let me know.
 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.

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


[web2py] Re: Wordpress model file

2013-12-21 Thread guruyaya
I'm ashamed to say I've failed to submit the slice. And that the committed 
version had a syntax error. Boy, I had a bad day yesterday :(

On Saturday, December 21, 2013 9:19:51 AM UTC+2, guruyaya wrote:

 I have several projects in my work, that require handling wordpress. As I 
 hate doing stuff in PHP, and DAL is my prefered tool for a lot of my work, 
 I've created a model file of wordpress. I hope you'll find it useful, and 
 I'd love to hear your feedback

 Have fun:
 https://github.com/guruyaya/web2py_wp_modelhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fguruyaya%2Fweb2py_wp_modelsa=Dsntz=1usg=AFQjCNGay77G15i-ImyzwKsyQwPC40rz1A
 Yair


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