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

2013-12-22 Thread Paolo Valleri
what web2py version are you using?
have you already had a look 
here: 
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-and-scalability
 
?

Paolo
On Sunday, December 22, 2013 1:48:56 AM UTC+1, viniciusban wrote:

 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.bioi...@gmail.com javascript: 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+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 


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


[web2py] Re: auth.is_logged_in(), @auth.requires_signature() behaving ornery in CORS situation

2013-12-22 Thread Niphlod
the subtle intricacies of a CORS request are hard to grasp. The fact that 
jQuery prevents them by default is a sane standard: you're basically 
sending out what identifies you (cookies) to another server entirely, and 
that poses a security threat.
Moreover, you need to tune manually your server to accept a CORS request 
(the preflight headers and so on)

Until now, components (LOAD and web2py_component) were meant to load 
fragments of your app within the same app or to share different fragments 
among web2py apps, that usually are mounted at the same domain.

I don't think that by default web2py_component should work with CORS, given 
the security issues involved, but feel free to suggest a secure by 
default behaviour/patch that will allow CORS to work within 
web2py_component, making sure that newbies won't code an insecure app.

-- 
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: error using auth.wiki('slug') on service pages

2013-12-22 Thread Janko Strusa
Thank you for your help. I've tried it, and it works for me.

Dana četvrtak, 19. prosinca 2013. 20:35:37 UTC+1, korisnik Alan Etkin 
napisao je:

 El jueves, 19 de diciembre de 2013 07:54:34 UTC-3, Janko Strusa escribió:

 Ok, I have reported the issue.


 force_render is being ignored in actions that involve service pages. If 
 you want to combine them with document content, a workaround is having the 
 wiki create the tables in the model or controller with

 auth.wiki(resolve=False)



 And then, to show a doc, you can do (in a view)

 {{=MARKMIN(db(db.wiki_page.slug==sidebar).select().first().body)}}





-- 
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] ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection

2013-12-22 Thread Robert Held
Hello,

I have a function in controllers/default.py 
def test_stream():
'''Test the stream output
'''
import cStringIO
stringio = cStringIO.StringIO()
stringio.write('This is the first line.\n')
stringio.write('This is the second line.')

stringio.seek(0)
return response.stream(stringio, attachment=True, request=request,
   filename='test_%s.txt' % 'stream')

When I call it directly over URL 
http://localhost:8000/myapp/default/test_stream all is ok.
But when I call it over a menu which I have in models/menu.py with 
... ('Teststream', False, URL('default', 'test_stream'))...

I get the following error at the console:

ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection:
Traceback (most recent call last):

  File /home/robert/Projekte/web2py/gluon/rocket.py, line 1337, in run
self.run_app(conn)

  File /home/robert/Projekte/web2py/gluon/rocket.py, line 1855, in run_app
self.conn.sendall(b('0\r\n\r\n'))

  File /usr/lib/python2.7/socket.py, line 224, in meth
return getattr(self._sock,name)(*args)

error: [Errno 32] Datenübergabe unterbrochen (broken pipe)

Any idea?


-- 
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] 401 error using auth.wiki

2013-12-22 Thread jimbo
I was using the built in auth.wiki without problems a few months ago. 

I could register a user,  and get the wiki menu when I logged in.

Have upgraded to 2.8.2 and this no longer seems to work. Tried solutions on 
other threads but still get 401 error when I try to log in, 
/wiki/default/index/_create/index

Thanks Jim

-- 
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] ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection

2013-12-22 Thread Robert Held

I have a function controllers/default.py test_stream.

def test_stream():
'''Test the stream output
'''
import cStringIO
stringio = cStringIO.StringIO()
stringio.write('This is the first line.\n')
stringio.write('This is the second line.')

stringio.seek(0)
return response.stream(stringio, attachment=True, request=request,
   filename='test_%s.txt' % 'stream')

   
When I call it over URL http://localhost:8000/myapp/default/test_stream all 
is ok.

But when I call it over menu with 

... ('Teststream', False, URL('genre', 'test_stream')) ...



I get the following error at the console:

ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection:
Traceback (most recent call last):

  File /home/robert/Projekte/web2py/gluon/rocket.py, line 1337, in run
self.run_app(conn)

  File /home/robert/Projekte/web2py/gluon/rocket.py, line 1855, in run_app
self.conn.sendall(b('0\r\n\r\n'))

  File /usr/lib/python2.7/socket.py, line 224, in meth
return getattr(self._sock,name)(*args)

error: [Errno 32] Datenübergabe unterbrochen (broken pipe)

Any idea?

-- 
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: Rendering 'raw' HTML for AngularJS with Web2py

2013-12-22 Thread Ramos
Changing delimiters in angular, keeping web2py Style

From a book i read 

Delimiters {{ ... }}
When you serve your Angular application from a framework like Symfony, the 
double curly braces {{ }} will conflict with the Twig templating engine, 
because it also uses the same characters as delimiters. To stay compatible with 
any plugins that rely on these delimiters on the server side, you should not 
change them. Angular offers a way to change the delimiters into something else:
  var myAppModule = angular.module('myApp',[],
function ($interpolateProvider) {
  $interpolateProvider.startSymbol('[');
  $interpolateProvider.endSymbol(']');
});
This will change the stock {{ }} to [ ] for the current Angular app.

-- 
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] Wiki.auth 401 error

2013-12-22 Thread jimbo
This used to work, activate the built in wiki, then register, log in and I 
got the wiki available. Now when I try to make a new wiki I get 401 even 
though it lets me log on.

Tried today and I get a 401 error when app accesses 
/default/index/_create/index


Thanks, Jimmy

-- 
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] Problem w/ cpdb.py script

2013-12-22 Thread Scott Hunter
I'm trying to use the cpdb.py script to copy one sqlite db to another.  It 
makes the tables  exports the old data to its own satisfaction, but when 
it tries to import the data, I get:

EXCEPTION: could not make a copy of the database
foreign key constraint failed

I had run into a similar problem when I upgraded to the latest version of 
web2py; the default settings for sqlite had changed, and I had to add a 
IS_EMPTY_OR(IS_IN_DB(...)) requirement for my reference fields where I had 
just been using the default requirement 
(https://groups.google.com/forum/#!topic/web2py/klspqXpha4E), which makes 
me wonder if this is related.

Whatever the cause, this sounds like a problem w/ the script or something 
it relies on.

- Scott

-- 
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] Social Login - Twitter logs out plus some other issues- web2py 2.8.2 / Mac OS X 10.9.1

2013-12-22 Thread Luciano Laporta Podazza
Hello,

I'm trying to implement Social Login following this example exactly as it 
shows here:

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

Facebook works well, but I'm having some issues:

1. Twitter login works fine, but when it returns from twitter's login page 
to my web2py app(through the callback url), it happens two things:
  1.1 My web2py app automatically redirects to 'logout' method, leaving me 
in the default/index page and logging me out, even if twitter auth 
succeed.
  1.2 Twitter user's data(like name, id, etc) is not stored in DB(Facebook 
login did store it)

Notes: To login with Twitter I use the regular login 
url(default/user/login) which redirects me to twitter auth so I set the 
Callback URL to be the same url. 

2. I want to use Facebook/Twitter/Web2py auth simultaneously (and if 
possible merge all accounts through email address or username) but I can't 
figure it out how to set auth.settings.login_form dynamically. Currently 
i'm setting it in db.py and can't be overdiden it in the controller. In 
other words, I'm facing the same issue JungHyun Kim is experiencing.

3. I don't want to use Janrain.

Thanks a lot for your help, I've already tried with a lot of outdated 
examples and it's driving me nuts :P

Cheers.


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


[web2py] Re: Wiki.auth 401 error

2013-12-22 Thread Alan Etkin


 This used to work, activate the built in wiki, then register, log in and I 
 got the wiki available. Now when I try to make a new wiki I get 401 even 
 though it lets me log on.


With what version?

-- 
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: Wiki.auth 401 error

2013-12-22 Thread jimbo
Hi Alan, it's 2.8.2   Thanks

On Sunday, 22 December 2013 19:54:25 UTC, jimbo wrote:

 This used to work, activate the built in wiki, then register, log in and I 
 got the wiki available. Now when I try to make a new wiki I get 401 even 
 though it lets me log on.

 Tried today and I get a 401 error when app accesses 
 /default/index/_create/index


 Thanks, Jimmy



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


[web2py] Re: Online classes

2013-12-22 Thread Alex Glaros
These videos are great!

thanks,

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/groups/opt_out.


[web2py] How to get captcha to display during https session

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

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


Re: [web2py] Font size and FPDF Report

2013-12-22 Thread José Luis Redrejo
Hello Alfonso
you can not use css with fpdf. It doesn't understand most of it, you
have to use html.
To change font size, I use, as an example:
pdf.write_html('font size=10' + tabla.xml().decode('utf-8') + '/font')

where tabla is a html table I've previously built using web2py html
helpers  (TR, TH,TBODY,TD,TABLE,THEAD , etc.)

Hope this helps.
Regards.


2013/12/20 Alfonso Pastor Sierra alfonso.pas...@gmail.com:
 Hi, I have the code for a PDF Report:

 def export_pdf():

 title = Informe de impresiones

 head = THEAD(TR(TH(Fecha/Hora,_width=16%),
 TH(Impresora,_width=17%),
 TH(Host,_width=10%),
 TH(Usuario,_width=10%),
 TH(Trabajo,_width=33%),
 TH(Pag,_width=4%),
 TH(Cop,_width=4%),
 TH(Total,_width=6%),
 _bgcolor=#A0A0A0))


 rowsTable = []
 i=0;

 rows=consultaInforme()

 for r in rows:

 col = i % 2 and #F0F0F0 or #FF

 documento=r[6].encode(latin_1,replace)[:50]

 rowsTable.append(TR(TD(r[1], _align=left),
TD(r[2], _align=left),
TD(r[5], _align=left),
TD(r[4], _align=left),
TD(documento, _align=left),
TD(r[7], _align=center),
TD(r[8], _align=center),
TD(r[9], _align=center),
_bgcolor=col))

 i+=1

 body = TBODY(*rowsTable)
 table = TABLE(*[head, body], _border=1, _align=center,
 _width=100%)

 class MyFPDF(FPDF, HTMLMixin):

 def __init__(self):
 FPDF.__init__(self,'L')

 def header(self):
 self.set_font('Arial','B',15)
 self.cell(0,10, title ,1,0,'C')

 def footer(self):
 self.set_y(-15)
 self.set_font('Arial','I',8)
 self.cell(0,10,IES,0,0,'L')
 txt = 'Pag. %s de %s' % (self.page_no(), self.alias_nb_pages())
 self.cell(0,10,txt,0,0,'R')

 pdf=MyFPDF()
 pdf.add_page()

 pdf.write_html(str(XML(table, sanitize=False)))

 response.headers['Content-Type']='application/pdf; charset=utf-8'
 doc=pdf.output(dest='S')
 doc64=embed64(data=doc,extension='application/pdf')
 return 'window.open(%s);' % doc64

 def consultaInforme():

 blah..blah.blah
 .


 consulta=cdb.executesql(sql)

 return consulta


 And I want to change the font-size of the text inside the table, but I
 can't.
 I have tried without success:


   rowsTable.append(TR(TD(r[1], _align=left),
TD(r[2], _align=left),
TD(r[5], _align=left),
TD(r[4], _align=left),
TD(documento, _align=left),
TD(r[7], _align=center),
TD(r[8], _align=center),
TD(r[9], _align=center),
_bgcolor=col, _style=font-size: 8px;))



 and

 pdf=MyFPDF()
 pdf.add_page()
 pdf.set_font('Arial','',10)
 pdf.write_html(str(XML(table, sanitize=False)))



 But never changes the font size in pdf.

 Can you help me?





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