[web2py] Preventing hackers from exploiting web2py with wsgi

2016-02-24 Thread Robin Manoli
Hello!

I was recommended by #ubuntu-server on Freenode not to use wsgi. I wonder 
if you recommend this as well (which means not using web2py with apache)?

I'm wondering if there is certain type of web2py code I can look for to 
prevent unauthorized access. In particular, how to prevent apache to send 
GET requests to other domains than the actual web2py web site being 
requested in the first place.

I'd really appreciate your help on this :)

- Robin

-- 
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] conflict with JQuery using multiple upload

2016-02-24 Thread Ron Chatterjee
On the high side, could have been worst. lol. Anyway, well. thanks Richard 
for taking your time on this. 



On Wednesday, February 24, 2016 at 11:55:05 PM UTC-5, Ron Chatterjee wrote:
>
> Seems to be little overkill with all that code in the view! lol. Anyway, 
> here is the app that demonstrate the conflict.
>
> Model:
> db.define_table('mytable',
> Field('name', type='list:string', requires=IS_IN_SET 
> (('True','False', 'Neither'), multiple=True)))
>
>
> *View (default/main_page.html):*
> {{extend 'layout.html'}}
>
> 
> {{=BUTTON( 'Apply',_type="button",_class = "btn btn-default",_onclick=""" 
> $('#cont_id').modal('show')   """)}}
> Apply to see the modal
> 
> {{=main_pg}}
>
>
> 
> jQuery(document).ready(function() {
>   var uploader = new qq.FileUploader({
> // pass the dom node (ex. jQuery(selector)[0] for jQuery users)
> element: document.getElementById('project-file-uploader'),
> // path to server-side upload script
> action: '{{=URL("upload_callback")}}/{{=request.args(0)}}',
> sizeLimit: 15000,
> minSizeLimit: 0,
> allowedExtensions: ['xls','jpg', 'jpeg', 'pdf', 
> 'txt','doc','htm','html','xml','xmls', 'txt','ppt','png', 'gif'],
> // set to true to output server response to console
> debug: true,
>
> // events
> // you can return false to abort submit
> onSubmit: function(id, fileName){},
> onProgress: function(id, fileName, loaded, total){},
> onComplete: function(id, fileName, responseJSON){},
> onCancel: function(id, fileName){},
>
> messages: {
> // error messages, see qq.FileUploaderBasic for content
> typeError: "{file} {{=T('has invalid extension.')}} 
> {{=T('Only')}} {extensions} {{=T('are allowed.')}}",
> sizeError: "{file} {{=T('is too large, maximum file size 
> is')}} {sizeLimit}.",
> minSizeError: "{file} {{=T('is too small, minimum file size 
> is')}} {minSizeLimit}.",
> emptyError: "{file} {{=T('is empty, please select files again 
> without it.')}}",
> onLeave: "{{=T('The files are being uploaded, if you leave now 
> the upload will be cancelled.')}}"
> },
> showMessage: function(message){ alert(message); }
> });
> });
> 
>
> *Controller*:
>
> def modal_content():
> form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
> return dict(form=form)
>
> def main_page():
> main_pg=DIV('')
> #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
> btn-default",_onclick=""" $('#cont_id').modal('show')   """)
> form = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
> dialog = modal_wrapper(form, _id='cont_id', header='Header', 
> footer='footer')
> #don't forget to add dialog and show_modal_btn to main page
> #main_pg.append(show_modal_btn)   # or main_pg.append( 
> DIV(show_modal_btn)  ) or something else
> main_pg.append(dialog)
> #main_pg.append(show_modal_btn) 
> return dict(main_pg = main_pg)
>
>
> def modal_wrapper(content, _id, header='', footer=''):
>
> main_wrap = DIV('',  _class="modal fade",  _role="dialog", _id=_id, 
> _tabindex="-1" )
> title_id = _id + '_title'
> main_wrap['_aria-labelledby']=title_id
>
> dialog_div=DIV('', _class="modal-dialog" , _role="document")
> content_div=DIV('', _class="modal-content")
> header_div = DIV( _class="modal-header")
>
> close_cross = BUTTON(
> SPAN(XML(''), **{'_aria-hidden':"true"}),
> _type="button",  _class="close",
>  data={'dismiss':"modal"},
>  **{'_aria-label':"Close"}
>  )
> title_h4 = H4( header,  _class="modal-title",  _id = title_id)
> body_div = DIV( content, _class="modal-body")
>
>
> close_btn = BUTTON('Close',  _type="button", _class="btn btn-default", 
> data={'dismiss':"modal"})
> footer_div =  DIV( footer, close_btn, _class="modal-footer")
>
> # gluon all
> main_wrap[0] = dialog_div
> dialog_div[0] = content_div
>
> header_div.append(close_cross)
> header_div.append(title_h4)
>
> [content_div.append(c) for c in (header_div, body_div, footer_div)]
> return main_wrap
>
>
>
>
> On Wednesday, February 24, 2016 at 10:07:45 PM UTC-5, Richard wrote:
>>
>> As the slice says : Quick and Dirty...
>>
>> I would stay away of that...
>>
>> You may also consider js lib for that...
>>
>> Why not : http://fineuploader.com/purchase_form.html
>>
>> If your app is open source and doesn't make money.
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 10:02 PM, Richard Vézina  
>> wrote:
>>
>>> Here a repo of a presumably functional implementation of the recipe link 
>>> above : https://bitbucket.org/xavrenard/multiupload_module/src
>>>
>>> It was mention at the end of the post completly.
>>>
>>> Good luck
>>>
>>> 

Re: [web2py] conflict with JQuery using multiple upload

2016-02-24 Thread Ron Chatterjee
Seems to be little overkill with all that code in the view! lol. Anyway, 
here is the app that demonstrate the conflict.

Model:
db.define_table('mytable',
Field('name', type='list:string', requires=IS_IN_SET 
(('True','False', 'Neither'), multiple=True)))


*View (default/main_page.html):*
{{extend 'layout.html'}}


{{=BUTTON( 'Apply',_type="button",_class = "btn btn-default",_onclick=""" 
$('#cont_id').modal('show')   """)}}
Apply to see the modal

{{=main_pg}}



jQuery(document).ready(function() {
  var uploader = new qq.FileUploader({
// pass the dom node (ex. jQuery(selector)[0] for jQuery users)
element: document.getElementById('project-file-uploader'),
// path to server-side upload script
action: '{{=URL("upload_callback")}}/{{=request.args(0)}}',
sizeLimit: 15000,
minSizeLimit: 0,
allowedExtensions: ['xls','jpg', 'jpeg', 'pdf', 
'txt','doc','htm','html','xml','xmls', 'txt','ppt','png', 'gif'],
// set to true to output server response to console
debug: true,

// events
// you can return false to abort submit
onSubmit: function(id, fileName){},
onProgress: function(id, fileName, loaded, total){},
onComplete: function(id, fileName, responseJSON){},
onCancel: function(id, fileName){},

messages: {
// error messages, see qq.FileUploaderBasic for content
typeError: "{file} {{=T('has invalid extension.')}} 
{{=T('Only')}} {extensions} {{=T('are allowed.')}}",
sizeError: "{file} {{=T('is too large, maximum file size is')}} 
{sizeLimit}.",
minSizeError: "{file} {{=T('is too small, minimum file size 
is')}} {minSizeLimit}.",
emptyError: "{file} {{=T('is empty, please select files again 
without it.')}}",
onLeave: "{{=T('The files are being uploaded, if you leave now 
the upload will be cancelled.')}}"
},
showMessage: function(message){ alert(message); }
});
});


*Controller*:

def modal_content():
form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
return dict(form=form)

def main_page():
main_pg=DIV('')
#show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
btn-default",_onclick=""" $('#cont_id').modal('show')   """)
form = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
dialog = modal_wrapper(form, _id='cont_id', header='Header', 
footer='footer')
#don't forget to add dialog and show_modal_btn to main page
#main_pg.append(show_modal_btn)   # or main_pg.append( 
DIV(show_modal_btn)  ) or something else
main_pg.append(dialog)
#main_pg.append(show_modal_btn) 
return dict(main_pg = main_pg)


def modal_wrapper(content, _id, header='', footer=''):

main_wrap = DIV('',  _class="modal fade",  _role="dialog", _id=_id, 
_tabindex="-1" )
title_id = _id + '_title'
main_wrap['_aria-labelledby']=title_id

dialog_div=DIV('', _class="modal-dialog" , _role="document")
content_div=DIV('', _class="modal-content")
header_div = DIV( _class="modal-header")

close_cross = BUTTON(
SPAN(XML(''), **{'_aria-hidden':"true"}),
_type="button",  _class="close",
 data={'dismiss':"modal"},
 **{'_aria-label':"Close"}
 )
title_h4 = H4( header,  _class="modal-title",  _id = title_id)
body_div = DIV( content, _class="modal-body")


close_btn = BUTTON('Close',  _type="button", _class="btn btn-default", 
data={'dismiss':"modal"})
footer_div =  DIV( footer, close_btn, _class="modal-footer")

# gluon all
main_wrap[0] = dialog_div
dialog_div[0] = content_div

header_div.append(close_cross)
header_div.append(title_h4)

[content_div.append(c) for c in (header_div, body_div, footer_div)]
return main_wrap




On Wednesday, February 24, 2016 at 10:07:45 PM UTC-5, Richard wrote:
>
> As the slice says : Quick and Dirty...
>
> I would stay away of that...
>
> You may also consider js lib for that...
>
> Why not : http://fineuploader.com/purchase_form.html
>
> If your app is open source and doesn't make money.
>
> Richard
>
> On Wed, Feb 24, 2016 at 10:02 PM, Richard Vézina  > wrote:
>
>> Here a repo of a presumably functional implementation of the recipe link 
>> above : https://bitbucket.org/xavrenard/multiupload_module/src
>>
>> It was mention at the end of the post completly.
>>
>> Good luck
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 7:47 PM, Ron Chatterjee > > wrote:
>>
>>> In other words, this code that I leveraged from:
>>>
>>> http://www.web2pyslices.com/slice/show/
>>> 1428/quick-and-dirty-multi-file-ajax-file-upload
>>>
>>> Should be updated using the links you send me because  if seems there 
>>> are others who also experienced the same issues. Let me post the code. And 
>>> I 

Re: [web2py] conflict with JQuery using multiple upload

2016-02-24 Thread Richard Vézina
As the slice says : Quick and Dirty...

I would stay away of that...

You may also consider js lib for that...

Why not : http://fineuploader.com/purchase_form.html

If your app is open source and doesn't make money.

Richard

On Wed, Feb 24, 2016 at 10:02 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Here a repo of a presumably functional implementation of the recipe link
> above : https://bitbucket.org/xavrenard/multiupload_module/src
>
> It was mention at the end of the post completly.
>
> Good luck
>
> Richard
>
> On Wed, Feb 24, 2016 at 7:47 PM, Ron Chatterjee 
> wrote:
>
>> In other words, this code that I leveraged from:
>>
>> http://www.web2pyslices.com/slice/show/
>> 1428/quick-and-dirty-multi-file-ajax-file-upload
>>
>> Should be updated using the links you send me because  if seems there are
>> others who also experienced the same issues. Let me post the code. And I
>> agree, it will probably be better not to upload .w2p as most people will
>> cut and paste.
>>
>>
>> On Wednesday, February 24, 2016 at 5:01:02 PM UTC-5, Richard wrote:
>>>
>>> This thread seems to talk about how to do it :
>>> https://groups.google.com/forum/#!msg/web2py/OysSkb6c-zI/Lz26h9uZog0J
>>>
>>> Here there is a recipe :
>>> http://in10min.blogspot.ca/2013/04/web2py-implement-multiple-files-upload.html
>>>
>>> Richard
>>>
>>> On Wed, Feb 24, 2016 at 4:58 PM, Richard Vézina 
>>> wrote:
>>>
 Ok, I was just talking about the name of your app...

 I think you will have more help if you append some relevant code to the
 issue to this thread...

 Installing an app from someone else is generally the lasting I do when
 I can't help the person by simple code review...

 Is  this something you write from your own? From a web2py slice?

 You want multiple upload feature, rigth?

 Regards

 Richard

 On Wed, Feb 24, 2016 at 4:18 PM, Ron Chatterjee 
 wrote:

> Seems strange. The issue is. If I delete that JQuery (everything
> inside the script), the modal works fine (just click main_page in the
> controller and then the button subsequently). The moment I insert the 
> multi
> file upload (from the link in the slide) and for which I need the jQuery,
> the model doesn't work. It gets hang. It seems conflict with CSS may be I
> am not sure what the issue is.
>
> On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:
>>
>> What the issue exactly? Your app name seems to refer to multiple
>> LOAD() issue, but you are talking about jQuery issue...
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee <
>> achatte...@gmail.com> wrote:
>>
>>> Hi Guys, I have an app where I use the model and it works fine. The
>>> moment I have the Jquery upload script in the view it seems to break and
>>> cause a conflict. Any help or suggestion that experts can provide? 
>>> Attached
>>> is the app. Controller is main_page
>>>
>>> --
>>> 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/d/optout.
>>>
>>
>> --
> 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/d/optout.
>


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

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

Re: [web2py] conflict with JQuery using multiple upload

2016-02-24 Thread Richard Vézina
Here a repo of a presumably functional implementation of the recipe link
above : https://bitbucket.org/xavrenard/multiupload_module/src

It was mention at the end of the post completly.

Good luck

Richard

On Wed, Feb 24, 2016 at 7:47 PM, Ron Chatterjee 
wrote:

> In other words, this code that I leveraged from:
>
> http://www.web2pyslices.com/slice/show/
> 1428/quick-and-dirty-multi-file-ajax-file-upload
>
> Should be updated using the links you send me because  if seems there are
> others who also experienced the same issues. Let me post the code. And I
> agree, it will probably be better not to upload .w2p as most people will
> cut and paste.
>
>
> On Wednesday, February 24, 2016 at 5:01:02 PM UTC-5, Richard wrote:
>>
>> This thread seems to talk about how to do it :
>> https://groups.google.com/forum/#!msg/web2py/OysSkb6c-zI/Lz26h9uZog0J
>>
>> Here there is a recipe :
>> http://in10min.blogspot.ca/2013/04/web2py-implement-multiple-files-upload.html
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 4:58 PM, Richard Vézina 
>> wrote:
>>
>>> Ok, I was just talking about the name of your app...
>>>
>>> I think you will have more help if you append some relevant code to the
>>> issue to this thread...
>>>
>>> Installing an app from someone else is generally the lasting I do when I
>>> can't help the person by simple code review...
>>>
>>> Is  this something you write from your own? From a web2py slice?
>>>
>>> You want multiple upload feature, rigth?
>>>
>>> Regards
>>>
>>> Richard
>>>
>>> On Wed, Feb 24, 2016 at 4:18 PM, Ron Chatterjee 
>>> wrote:
>>>
 Seems strange. The issue is. If I delete that JQuery (everything inside
 the script), the modal works fine (just click main_page in the controller
 and then the button subsequently). The moment I insert the multi file
 upload (from the link in the slide) and for which I need the jQuery, the
 model doesn't work. It gets hang. It seems conflict with CSS may be I am
 not sure what the issue is.

 On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:
>
> What the issue exactly? Your app name seems to refer to multiple
> LOAD() issue, but you are talking about jQuery issue...
>
> Richard
>
> On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee  > wrote:
>
>> Hi Guys, I have an app where I use the model and it works fine. The
>> moment I have the Jquery upload script in the view it seems to break and
>> cause a conflict. Any help or suggestion that experts can provide? 
>> Attached
>> is the app. Controller is main_page
>>
>> --
>> 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/d/optout.
>>
>
> --
 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/d/optout.

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

-- 
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: Has anyone done a detailed security analysis or attempted a methodical attack on web2py?

2016-02-24 Thread Jason Solack
Any updates on this?  I am in the process of finding a supplier to pen 
test, wondering if i should be prepared for anything.

On Friday, October 9, 2015 at 11:26:55 AM UTC-4, Michael M wrote:
>
> My company has to have an outside firm Pen test all Web-Service 
> applications.  So I am spinning up two internal services and both are going 
> to be tested around November before they go into Prod from Non-Prod.  I'm 
> starting talks with the InfoSec team to see if I can share the findings of 
> the test.
>
> On Thursday, October 8, 2015 at 12:13:33 PM UTC-7, Richard wrote:
>>
>> :)
>>
>> Nice to heard that!
>>
>> Richard
>>
>> On Thu, Oct 8, 2015 at 2:59 PM, Niphlod  wrote:
>>
>>> not really. 
>>> I built some apps on web2py that are live and in production, and since 
>>> EVERY app in my environment NEEDS to pass a Qualys scan to be live and 
>>> production ready, I know that MY apps survive a Qualys scan with flying 
>>> colors.
>>> Point being "ATM web2py does not expose any obvious/hidden threat that 
>>> Qualys identifies".
>>> I'll reinstate the obvious though: this "just" means that if you code 
>>> responsibly, your app is safe. It's not too little of a "just". But it's a 
>>> "just" nonetheless. 
>>> Noone is saying that EVERY app you code will pass a white-hat attempt if 
>>> it's hosted on web2py, and I don't think that any framework in any language 
>>> will ever have the guts to assure it. 
>>>
>>>
>>> On Thursday, October 8, 2015 at 8:38:05 PM UTC+2, Richard wrote:

 @Antonio

 I think Simone just point to the tool that can be use for such 
 purpose... You can use it over your App. From my understanding the App 
 tested is the Ian App...

 Richard

 On Thu, Oct 8, 2015 at 1:19 PM, António Ramos  
 wrote:

> Niphold,
> i dont see where you are pointing on  https://www.qualys.com/
> where is the web2py app that survived the security scan ?
>
> thank you
>
> 2015-10-05 11:25 GMT+01:00 Niphlod :
>
>> here in ***undisclosed company web2py survives a 
>> https://www.qualys.com/ security scan with no reports whatsoever.
>>
>>
>> On Sunday, October 4, 2015 at 2:47:44 PM UTC+2, Ian Ryder wrote:
>>>
>>> Hi, just looking back over anything about penetration testing and 
>>> web2py - does anyone know of any recent (or any at all) testing of 
>>> web2py? 
>>> We're getting close to our first customers on an app we've been 
>>> developing 
>>> the last year so really need to try and pick it to pieces now while we 
>>> have 
>>> a few months to work on anything we need to.
>>>
>>> Thanks
>>> Ian
>>>
>>> On Tuesday, 10 July 2012 19:42:46 UTC+2, Massimo Di Pierro wrote:

 Thank you Dave for the feedback. It would be nice to have the 
 results of those  tests (Cenznic, Hailstorm, Quails) published 
 somewhere. 
 Once in a while people ask about this.

 Massimo

 On Tuesday, 10 July 2012 11:28:39 UTC-5, Dave wrote:
>
> Well
>
> I can't say that I have tested the current trunk version, but last 
> December I ran a pretty exhaustive penetration test against a site 
> developed web2py.  The results were very good.  No findings above 
> low.  The 
> low findings were insignificant.  I ran Cenzic Hailstorm, Qualys and 
> one 
> other automated vulnerability test suite (I cant remember which at 
> the 
> moment) against it without issue.  
>
> Here are some things that can cause issue though...
>
> * anywhere you use the XML() method in a view you should make sure 
> you have validation turned on.  Even though the framework is 
> resilient and 
> does a good job of sanitizing data in & out, you can still end up in 
> XSS or 
> XSRF trouble with XML().
>
> * redirects can trip up or slow down a lot of vuln scanners.  
> Watch out if you perform your own testing that you're not getting 
> false 
> negatives.
>
> I know some people that would take on a more "formal" assessment 
> if there is consensus
>
> Dave
>
> On Monday, July 9, 2012 11:48:39 AM UTC-4, scausten wrote:
>>
>> One of the awesome things about web2py is of course the built-in 
>> and well-documented resilience against a range of attack methods, 
>> but I was 
>> wondering if anyone has attempted a methodical (white-hat) attack to 
>> probe 
>> any potential weaknesses?
>>
>> Just out of interest :)
>>
> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - 

[web2py] Re: Setting up the scheduler, and letting it run from a certain point of time

2016-02-24 Thread Dave S


On Wednesday, February 24, 2016 at 4:57:43 PM UTC-8, Lucas Schreiber wrote:
>
> I have read the book. But it doesn't state where to actually write the 
> code snipes given. Both, the book and google is very fancy about explaining 
> how to start a scheduler by the console. But i literally do not see how i 
> can start the scheduler. 
>



the -K option starts a process which runs the scheduler.
You can use the -X option with it to only have 1 instance of Web2Py 
running, with the Rocket server providing the internet access.
If you are using Apache or Nginx, I suppose you don't use -X, but I'm not 
quite graduated to that class yet.


(in the command-line options section,

the -K is illustrated as "-K SCHEDULER",
which might be confusing if you don't see that "SCHEDULER" is either the 
name of your app, a list of apps, or a list of app groups.)

 

> If i write this into the controller, 
>
> scheduler.queue_task(
> task_1,
> pargs=[],
> pvars={},
> start_time=now,   #datetime
> stop_time = None, #datetime
> timeout = 60,   #seconds
> prevent_drift=False,
> period=60,  #seconds
> immediate=False,
> repeats = 1
> )
>
> it atleast creates  the tables and populates one of the tables with an set 
> of records(scheduler_task) and does so whenever i call the function. But it 
> only works as long as the function is in the same controller. if the 
> function is in the modules, an error is returned. When i put this into the 
> model, it creates the tabels but does not populate any of them. 
>
> some possible reasons why it does not run i have made up are:
> -i'm queueing tasks but not creating a worker to work on them (but the 
> book doesnt state anywhere to create a worker. I think therefore this cant 
> be the solution)
>

This is the explanation.  The -K option described at the above links is the 
key.
 

> -the function isn't defined proper and the worker does not know what to do.
>
>
This would probably result in an error being logged in the scheduler_run 
table which you can look at to debug.  (I am, of course, familiar with 
that!)


Good luck!

/dps


 

>
>
> Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>>
>> Hi there,
>> while trying to understand how to use the scheduler, i found this post:
>> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>>
>> In the Post, this code is writen:
>> db.scheduler_task.insert(function_name='task1',
>>  task_name='task1',
>>  stop_time = now + timedelta(days=9),
>>  repeats=0,
>>  period=10)
>> g
>> Where do i put this code? in the model? I think this was partly answered 
>> in the post, but i dont understand it. can someone explain this to me?
>>
>> Also, is there a way to let a scheduler run at a time writen in a db once 
>> and then rest until the next time occurs? or is a permanent run every few 
>> seconds checking for certain criteria the better solution?
>>
>> And just to see if I understood this so far correctly:
>> the scheduler function is basically a function I write into the model, 
>> offering everything a "normal" function offers, exectued at times i 
>> determine?
>>
>> Kind regards 
>> And
>>
>

-- 
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: Setting up the scheduler, and letting it run from a certain point of time

2016-02-24 Thread Lucas Schreiber
I have read the book. But it doesn't state where to actually write the code 
snipes given. Both, the book and google is very fancy about explaining how 
to start a scheduler by the console. But i literally do not see how i can 
start the scheduler. 
If i write this into the controller, 

scheduler.queue_task(
task_1,
pargs=[],
pvars={},
start_time=now, #datetime
stop_time = None,   #datetime
timeout = 60,   #seconds
prevent_drift=False,
period=60,  #seconds
immediate=False,
repeats = 1
)

it atleast creates  the tables and populates one of the tables with an set 
of records(scheduler_task) and does so whenever i call the function. But it 
only works as long as the function is in the same controller. if the 
function is in the modules, an error is returned. When i put this into the 
model, it creates the tabels but does not populate any of them. 

some possible reasons why it does not run i have made up are:
-i'm queueing tasks but not creating a worker to work on them (but the book 
doesnt state anywhere to create a worker. I think therefore this cant be 
the solution)
-the function isn't defined proper and the worker does not know what to do.



Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>
> Hi there,
> while trying to understand how to use the scheduler, i found this post:
> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>
> In the Post, this code is writen:
> db.scheduler_task.insert(function_name='task1',
>  task_name='task1',
>  stop_time = now + timedelta(days=9),
>  repeats=0,
>  period=10)
> g
> Where do i put this code? in the model? I think this was partly answered 
> in the post, but i dont understand it. can someone explain this to me?
>
> Also, is there a way to let a scheduler run at a time writen in a db once 
> and then rest until the next time occurs? or is a permanent run every few 
> seconds checking for certain criteria the better solution?
>
> And just to see if I understood this so far correctly:
> the scheduler function is basically a function I write into the model, 
> offering everything a "normal" function offers, exectued at times i 
> determine?
>
> Kind regards 
> And
>

-- 
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] conflict with JQuery using multiple upload

2016-02-24 Thread Ron Chatterjee
In other words, this code that I leveraged from:

http://www.web2pyslices.com/slice/show/1428/quick-and-dirty-multi-file-ajax-file-upload

Should be updated using the links you send me because  if seems there are 
others who also experienced the same issues. Let me post the code. And I 
agree, it will probably be better not to upload .w2p as most people will 
cut and paste.
 

On Wednesday, February 24, 2016 at 5:01:02 PM UTC-5, Richard wrote:
>
> This thread seems to talk about how to do it : 
> https://groups.google.com/forum/#!msg/web2py/OysSkb6c-zI/Lz26h9uZog0J
>
> Here there is a recipe : 
> http://in10min.blogspot.ca/2013/04/web2py-implement-multiple-files-upload.html
>
> Richard
>
> On Wed, Feb 24, 2016 at 4:58 PM, Richard Vézina  > wrote:
>
>> Ok, I was just talking about the name of your app...
>>
>> I think you will have more help if you append some relevant code to the 
>> issue to this thread...
>>
>> Installing an app from someone else is generally the lasting I do when I 
>> can't help the person by simple code review...
>>
>> Is  this something you write from your own? From a web2py slice?
>>
>> You want multiple upload feature, rigth?
>>
>> Regards
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 4:18 PM, Ron Chatterjee > > wrote:
>>
>>> Seems strange. The issue is. If I delete that JQuery (everything inside 
>>> the script), the modal works fine (just click main_page in the controller 
>>> and then the button subsequently). The moment I insert the multi file 
>>> upload (from the link in the slide) and for which I need the jQuery, the 
>>> model doesn't work. It gets hang. It seems conflict with CSS may be I am 
>>> not sure what the issue is.  
>>>
>>> On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:

 What the issue exactly? Your app name seems to refer to multiple LOAD() 
 issue, but you are talking about jQuery issue...

 Richard

 On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee  
 wrote:

> Hi Guys, I have an app where I use the model and it works fine. The 
> moment I have the Jquery upload script in the view it seems to break and 
> cause a conflict. Any help or suggestion that experts can provide? 
> Attached 
> is the app. Controller is main_page
>
> -- 
> 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/d/optout.
>

 -- 
>>> 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/d/optout.
>>>
>>
>>
>

-- 
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: WinINet and basic auth

2016-02-24 Thread Dave S


On Tuesday, February 23, 2016 at 12:39:27 PM UTC-8, Dave S wrote:
>
> I'm trying to use Basic Auth with my restful service; see
>  )
> for my starting point, although I'm doing a post.
>


Also, does Web2Py support Digest auth?


/dps
 

>
> curl --request POST -TransferEncoding C:\dir1\test1.txt --user 
> us...@servery.com:pwd1 http://ww.zz.uu.39/uploader/default/shove/upstuff/ 
> 
> test1.txt
>
> This works fine from the command line (centos or Win7, as long as curl is 
> installed).
>
> And I successfully used this with libcurl in my Windows test client ("
> u...@servery.com" --> "user%40servery.com").  Tcpdump on the server shows 
> the u/p fields moved to an "Authorization:" header (Basic).
>
> When I try this from WinINet functions, the u/p stuff in the URL is 
> stripped but no "Authorization:" header is added.  Setting the u/p in 
> *InternetConnect()* seems to be ignored.  As a result, I get back a 303 
> redirecting to the login page.  (I'm using shake-the-box Rocket server for 
> prototyping, though I plan to move to nginx later.)
> This MS page suggests that WinINet is expecting a 401, although it isn't 
> clear that applies to Basic Auth or just challenge-response authentication.
>  https://msdn.microsoft.com/en-us/library/windows/desktop/aa384220%28v=vs.85%29.aspx
> >
>
> Some StackOverflow hits suggest that I need to prepare the Basic Auth 
> header myself and use the* lpszHeaders* parameter of* HttpSendRequest()*. 
>  Is that my only choice, or am I missing something?
>
> Thanks.
>
> Dave
> /dps
>
>
>
>
>  
>

-- 
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: How to install web2py on CentOS 6.5 with Apache?

2016-02-24 Thread Esau Hernandez Valles
I prefer web2py nginx on Centos.  I think this combination is better. 

check this link 
 http://mwiki.yyovkov.net/index.php/Install_Web2py_on_CentOS_6

On DigitalOcean there are a lot of tutorial. Only You have to sign-in. 

I think You have to checkscripts/setup-web2py-centos7.sh 

good lock


El viernes, 19 de febrero de 2016, 9:48:59 (UTC-5), Fabiano Almeida 
escribió:
>
> Hi all,
>
> How to install web2py on CentOS 6.5 with Apache?
>
> Tks!
>
> Fabiano.
>

-- 
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] conflict with JQuery using multiple upload

2016-02-24 Thread Richard Vézina
This thread seems to talk about how to do it :
https://groups.google.com/forum/#!msg/web2py/OysSkb6c-zI/Lz26h9uZog0J

Here there is a recipe :
http://in10min.blogspot.ca/2013/04/web2py-implement-multiple-files-upload.html

Richard

On Wed, Feb 24, 2016 at 4:58 PM, Richard Vézina  wrote:

> Ok, I was just talking about the name of your app...
>
> I think you will have more help if you append some relevant code to the
> issue to this thread...
>
> Installing an app from someone else is generally the lasting I do when I
> can't help the person by simple code review...
>
> Is  this something you write from your own? From a web2py slice?
>
> You want multiple upload feature, rigth?
>
> Regards
>
> Richard
>
> On Wed, Feb 24, 2016 at 4:18 PM, Ron Chatterjee 
> wrote:
>
>> Seems strange. The issue is. If I delete that JQuery (everything inside
>> the script), the modal works fine (just click main_page in the controller
>> and then the button subsequently). The moment I insert the multi file
>> upload (from the link in the slide) and for which I need the jQuery, the
>> model doesn't work. It gets hang. It seems conflict with CSS may be I am
>> not sure what the issue is.
>>
>> On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:
>>>
>>> What the issue exactly? Your app name seems to refer to multiple LOAD()
>>> issue, but you are talking about jQuery issue...
>>>
>>> Richard
>>>
>>> On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee 
>>> wrote:
>>>
 Hi Guys, I have an app where I use the model and it works fine. The
 moment I have the Jquery upload script in the view it seems to break and
 cause a conflict. Any help or suggestion that experts can provide? Attached
 is the app. Controller is main_page

 --
 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/d/optout.

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

-- 
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] conflict with JQuery using multiple upload

2016-02-24 Thread Richard Vézina
Ok, I was just talking about the name of your app...

I think you will have more help if you append some relevant code to the
issue to this thread...

Installing an app from someone else is generally the lasting I do when I
can't help the person by simple code review...

Is  this something you write from your own? From a web2py slice?

You want multiple upload feature, rigth?

Regards

Richard

On Wed, Feb 24, 2016 at 4:18 PM, Ron Chatterjee 
wrote:

> Seems strange. The issue is. If I delete that JQuery (everything inside
> the script), the modal works fine (just click main_page in the controller
> and then the button subsequently). The moment I insert the multi file
> upload (from the link in the slide) and for which I need the jQuery, the
> model doesn't work. It gets hang. It seems conflict with CSS may be I am
> not sure what the issue is.
>
> On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:
>>
>> What the issue exactly? Your app name seems to refer to multiple LOAD()
>> issue, but you are talking about jQuery issue...
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee 
>> wrote:
>>
>>> Hi Guys, I have an app where I use the model and it works fine. The
>>> moment I have the Jquery upload script in the view it seems to break and
>>> cause a conflict. Any help or suggestion that experts can provide? Attached
>>> is the app. Controller is main_page
>>>
>>> --
>>> 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/d/optout.
>>>
>>
>> --
> 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.
>

-- 
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] conflict with JQuery using multiple upload

2016-02-24 Thread Ron Chatterjee
Seems strange. The issue is. If I delete that JQuery (everything inside the 
script), the modal works fine (just click main_page in the controller and 
then the button subsequently). The moment I insert the multi file upload 
(from the link in the slide) and for which I need the jQuery, the model 
doesn't work. It gets hang. It seems conflict with CSS may be I am not sure 
what the issue is.  

On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:
>
> What the issue exactly? Your app name seems to refer to multiple LOAD() 
> issue, but you are talking about jQuery issue...
>
> Richard
>
> On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee  > wrote:
>
>> Hi Guys, I have an app where I use the model and it works fine. The 
>> moment I have the Jquery upload script in the view it seems to break and 
>> cause a conflict. Any help or suggestion that experts can provide? Attached 
>> is the app. Controller is main_page
>>
>> -- 
>> 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/d/optout.
>>
>
>

-- 
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] plural forms dict for French

2016-02-24 Thread Pierre
Hi everyone,

I created a  plural-fr.py but it only relates to singular english forms. 
How do I make a singular-french_forms TO plural-french_forms translator ?

-- 
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] conflict with JQuery using multiple upload

2016-02-24 Thread Richard Vézina
What the issue exactly? Your app name seems to refer to multiple LOAD()
issue, but you are talking about jQuery issue...

Richard

On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee 
wrote:

> Hi Guys, I have an app where I use the model and it works fine. The moment
> I have the Jquery upload script in the view it seems to break and cause a
> conflict. Any help or suggestion that experts can provide? Attached is the
> app. Controller is main_page
>
> --
> 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.
>

-- 
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] plural forms dict for French - how to create one ?

2016-02-24 Thread Pierre
Hi everyone,

How do I create one ?

I have this row in web2py admin language section :

fr.py 

 ( 
Plural-Forms: *are not used yet* ) 

-- 
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: Setting up the scheduler, and letting it run from a certain point of time

2016-02-24 Thread Dave S


On Wednesday, February 24, 2016 at 10:10:54 AM UTC-8, Lucas Schreiber wrote:
>
> Alright, so far i am able to create the tables, but nothing runs.
>
> So far i have this:
>
> Model:
> database:
> dba = DAL(connection)
> dba.define_table('test_table',
> Field('test_table_id', 'integer'),
> Field('test_table_value'))
>
> scheduler:
>
> from gluon.scheduler import Scheduler
> scheduler = Scheduler(dba)
>
>
>
> controller:
> index:
>
> def start():
> import datetime
> daytime_start = datetime.datetime(2017, 1, 1, 0, 0)
> a = 'a'
> dba.scheduler_task.insert(function_name='task_1',
>  task_name='task_1',
>  stop_time = daytime_start,
>  repeats=0,
>  period=10)
> 
>


DO NOT DO THIS!   *


Use the  *queue_task()* call.  There is more than one table involved, and 
rather than figuring out how they all fit together, use the code that 
already knows.


 

> return dict(a=a)
> def index():
> text1 = 'test'
> return dict (text1=text1)
>
>
> module:
>
> test.py:
> def task_1():
> c= 0
> dba.test_table.insert(test_table_id = 1, test_table_value = 'a')
> db.commit()
> return dict(c=c)
>
> How do i get it startet, e.g. filling the test_table with those values 
> every n seconds?
>
> Thank you very much for your help so far
>

If you haven't read the section in the book, I don't think I can be much 
help.

/dps

 

>  
>
Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>>
>> Hi there,
>> while trying to understand how to use the scheduler, i found this post:
>> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>>
>> In the Post, this code is writen:
>> db.scheduler_task.insert(function_name='task1',
>>  task_name='task1',
>>  stop_time = now + timedelta(days=9),
>>  repeats=0,
>>  period=10)
>> g
>> Where do i put this code? in the model? I think this was partly answered 
>> in the post, but i dont understand it. can someone explain this to me?
>>
>> Also, is there a way to let a scheduler run at a time writen in a db once 
>> and then rest until the next time occurs? or is a permanent run every few 
>> seconds checking for certain criteria the better solution?
>>
>> And just to see if I understood this so far correctly:
>> the scheduler function is basically a function I write into the model, 
>> offering everything a "normal" function offers, exectued at times i 
>> determine?
>>
>> Kind regards 
>> And
>>
>

-- 
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] Restored DB, _enable_record_versioning() and fake migrations?

2016-02-24 Thread Alex Glaros
am a beginner and not sure if this suggestion makes sense

my restore/migrate/fake_migrate didn't work but everything else worked 
normally

I downloaded a new copy of web2py and everything now works flawlessly.  I 
already had the latest version and it was the same version as I already had 
but something was different about it.

Alex Glaros

-- 
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: Setting up the scheduler, and letting it run from a certain point of time

2016-02-24 Thread Lucas Schreiber
Alright, so far i am able to create the tables, but nothing runs.

So far i have this:

Model:
database:
dba = DAL(connection)
dba.define_table('test_table',
Field('test_table_id', 'integer'),
Field('test_table_value'))

scheduler:

from gluon.scheduler import Scheduler
scheduler = Scheduler(dba)



controller:
index:

def start():
import datetime
daytime_start = datetime.datetime(2017, 1, 1, 0, 0)
a = 'a'
dba.scheduler_task.insert(function_name='task_1',
 task_name='task_1',
 stop_time = daytime_start,
 repeats=0,
 period=10)

return dict(a=a)
def index():
text1 = 'test'
return dict (text1=text1)


module:

test.py:
def task_1():
c= 0
dba.test_table.insert(test_table_id = 1, test_table_value = 'a')
db.commit()
return dict(c=c)

How do i get it startet, e.g. filling the test_table with those values 
every n seconds?

Thank you very much for your help so far



Am Mittwoch, 24. Februar 2016 00:11:47 UTC+1 schrieb Lucas Schreiber:
>
> Hi there,
> while trying to understand how to use the scheduler, i found this post:
> https://groups.google.com/forum/#!topic/web2py/VCPZmSc0vLc
>
> In the Post, this code is writen:
> db.scheduler_task.insert(function_name='task1',
>  task_name='task1',
>  stop_time = now + timedelta(days=9),
>  repeats=0,
>  period=10)
> g
> Where do i put this code? in the model? I think this was partly answered 
> in the post, but i dont understand it. can someone explain this to me?
>
> Also, is there a way to let a scheduler run at a time writen in a db once 
> and then rest until the next time occurs? or is a permanent run every few 
> seconds checking for certain criteria the better solution?
>
> And just to see if I understood this so far correctly:
> the scheduler function is basically a function I write into the model, 
> offering everything a "normal" function offers, exectued at times i 
> determine?
>
> Kind regards 
> And
>

-- 
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] Restored DB, _enable_record_versioning() and fake migrations?

2016-02-24 Thread Richard Vézina
Hmm... About app/databases/ I don't know exactly all how it works, but I
think your issue come form there... uuid if there is one, would not have
anything to do with your computer, I am pretty sure of that, and you can
leave these files there for sure without any problem...

Though there surely some kind of issue with migrate=False,
fake_migrate=True if it failed to manage archive tables correctly and sync
web2py with the backend schema... This is a corner case, that may not have
been identify yet... You may consider creating a dummy app and try to
reproduce the issue with this app and test it with last version of web2py
to see if issue still there (if any).

test case :

- at least 2 tables with web2py versionning
- versionning should occur in a unique table
- delete app/databases/*
- try fake_migrate see if it fails


If you can reproduce this issue, in you actual web2py version and in a new
version, then open a ticket on github... So we all get aware of this
issue...

Thanks

Richard


On Tue, Feb 23, 2016 at 6:26 PM, Brian M  wrote:

> The web2py version is the same on both machines; I just copied my whole
> web2py folder over. Now admittedly my web2py version is slightly out of
> date so it might be something that's been improved recently. I've got a
> patch for another issue that I need to pull and test tonight so I'll try to
> make a test for this too.
>
> The archive table was originally created by web2py.  Yes, I did delete
> .table files from /app/databases but they were the ones from the other
> computer (different uuid hash in file name) and weren't being used anyway
> so that shouldn't make a difference.
>
> On Tuesday, February 23, 2016 at 11:22:06 AM UTC-6, Richard wrote:
>>
>> Pretty weird, but you have made some progress... So, to resume, it like
>> if archive table were never really get created by web2py so it keeps trying
>> to create it and failed since it already exist in the backend...
>>
>> So, there were an issue at the moment you start using the feature, or
>> there is an error in the actual web2py version (did you upgrade web2py as
>> long as migrating you system??, if so consider use the old web2py to see if
>> the issue occuring... This would help determine if the issue is coming form
>> new web2py version or not).
>>
>> Or could it be possible that you create the archive table manually back
>> in time? Or that some file in app/databases/ folder get deleted??
>>
>> Richard
>>
>>
>>
>> On Tue, Feb 23, 2016 at 11:12 AM, Brian M  wrote:
>>
>>> Richard,
>>>
>>> Nope, I didn't change the name of the app itself. The only thing that
>>> changed is the name of the computer the DB is on and thus the DAL
>>> connection string.
>>>
>>> The traceback error is :
>>>  ('42S01', "[42S01] [Microsoft][SQL
>>> Server Native Client 11.0][SQL Server]There is already an object named
>>> 'shipment_at_risk_archive' in the database. (2714) (SQLExecDirectW)")
>>>
>>> Interestingly the error doesn't occur on every request even though the
>>> db.shipment_at_risk._enable_record_versioning() is in a plain model file
>>> and would presumably get executed for every page. It only pops up if I'm
>>> trying to get into the database admin screen of App Admin or if I'm on a
>>> page that actually utilizes the archive table.
>>>
>>> Attempting to include an archive_name matching the existing table within
>>> _enable_record_versioning() results in the same error. If I use a new name
>>> for the archive table then it just creates that table and works fine but
>>> this isn't desirable since I want to keep using the data in the
>>> pre-existing archive table. Having _enable_record_versioning() enabled for
>>> only a single table at a time also does no good.
>>>
>>> What I've ended up doing to get past this is using a different
>>> archive_name value and letting the DAL go ahead and create new tables. Then
>>> i just changed the database/ .table file's name to match the original
>>> archive table's name and also edited the contents so that it used the
>>> original table name in things like constraints.  That seems to work and is
>>> essentially doing a manual fake migration.  But I'd still like to hear from
>>> Massimo or another dev whether or not this is intended to behave this way
>>> or if there really should be a fake_migrate argument for
>>> _enable_record_versioning() like there is for regular table definitions.
>>>
>>> Brian
>>>
>>> On Monday, February 22, 2016 at 10:18:31 PM UTC-6, Richard wrote:

 Other possible explanation... Did you change app name? Sometimes this
 kind of web2py feature use some part of web2py and app three in the name of
 table created "automagically"...

 For instance... I was having issue with session in database feature
 because web2py use application name in the table name of the session in
 database feature, so if I was not specify the name of the table in which I
 want the session file to be store and I 

Re: [web2py] Re: Rich Text

2016-02-24 Thread Fabiano Almeida
Thanks Leonel!

2016-02-24 7:33 GMT-03:00 Leonel Câmara :

> Use Tim's plugin it works great
>
> https://github.com/timrichardson/web2py_ckeditor4
>
> --
> 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.
>

-- 
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: All HTTP requests redirected to HTTPS

2016-02-24 Thread Niphlod
why a should it be a problem only lord knows . but if you have 
request.requires_https() anywhere it tells to redirect the request over to 
https ... 
sure you "didn't uncomment it"  ?

On Wednesday, February 24, 2016 at 3:08:08 PM UTC+1, Joe wrote:
>
> I just reloaded my app on Pythonanywhere and after reloading, my site is 
> forced to https for some reason.
> All HTTP requests are redirected to HTTPS. I didn't uncomment the 
> #request.requires_https()
> Anyone had a similar issue? What is the best way to resolve this?
>
> I asked Python anywhere, they said it "sounds like a web2py config thing". 
> The only time I need the https is when I login to the admin as 
> Pythonanywhere requires https there.
> When the rest of my URLs are forced to https, it's kind of a problem. 
>

-- 
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] All HTTP requests redirected to HTTPS

2016-02-24 Thread Joe
I just reloaded my app on Pythonanywhere and after reloading, my site is 
forced to https for some reason.
All HTTP requests are redirected to HTTPS. I didn't uncomment the 
#request.requires_https()
Anyone had a similar issue? What is the best way to resolve this?

I asked Python anywhere, they said it "sounds like a web2py config thing". 
The only time I need the https is when I login to the admin as 
Pythonanywhere requires https there.
When the rest of my URLs are forced to https, it's kind of a problem. 

-- 
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: Rich Text

2016-02-24 Thread Leonel Câmara
Use Tim's plugin it works great

https://github.com/timrichardson/web2py_ckeditor4

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