[web2py] Re: why does this not work f=locals()['IS_IN_SET'] ?

2013-02-18 Thread Anthony
locals() returns the variables in the current namespace -- in the shell, that is the global web2py environment, which includes the web2py API objects, but in a controller function, it is just the function's namespace. You could do f=locals()['IS_IN_SET'] outside a function (e.g., in a model or

Re: [web2py] Re: How do I define a table that references itself

2013-02-18 Thread Paul Whipp
Thanks, This did not only clear up this particular problem for me but seeing the format in the IS_IN_DB constructor showed me why I was losing the default table represents when adding constraints elsewhere so that is now sorted too. Thanks again. We expect to exceed ten thousand dockets. What wi

[web2py] why does this not work f=locals()['IS_IN_SET'] ?

2013-02-18 Thread Tim Richardson
When in interactive mode (python web2py.py -S welcome) I can do this: f = local()['IS_IN_SET'] and I get f as a function variable. But the same thing in a controller fails with a KeyError. [I'm trying to make an SQLFORM.factory form based on queries defined in a table, with SQL, parameters and

[web2py] unable to remove jqmobile

2013-02-18 Thread greaneym
Hello, I am trying out the jqmobile plugin and finding a strange result. It's stuck on the mobile view no matter what changes I make. I took these steps to get the mobile view to work. 1. copied the plugin_jqmobile from the admin app to my app. 2. copied the views/default/index to index.mobile.h

[web2py] Re: Setting up memcache on GAE - a basic question

2013-02-18 Thread howesc
cacheable=True is a newish option to selects right? i've not yet used itand had forgotten about it. cfh On Monday, February 18, 2013 7:17:02 AM UTC-8, Niphlod wrote: > > cacheable=True does not help ? > > On Monday, February 18, 2013 4:11:13 PM UTC+1, howesc wrote: >> >> ah yes >> >> th

Re: [web2py] separate database and web server web2py installation

2013-02-18 Thread Michele Comitini
Rule of thumb Local) simple queries, single web frontend Remote) very complex queries/very large dataset, >1 web frontend Separation is also very useful for maintenance, since upgrading paths for python and or web2py may diverge from those of the db. Upgrading the db can be very complex and usual

Re: [web2py] separate database and web server web2py installation

2013-02-18 Thread Derek
ssh does encryption, and encryption is a type of minor compression, so you may be transmitting less data on the line. On Monday, February 18, 2013 3:15:07 PM UTC-7, Richard wrote: > > Final result : > > no_ssh : 32.810 seconds (worst) > remote with ssh : 32.010 seconds > local : 31.494 seconds >

Re: [web2py] CPU 210%

2013-02-18 Thread Michele Comitini
Niphold explanation is better than anything I could come out with. One could ask why pool_size=1 and not pool_size=0 then? A pool of one seems logical nonsense, but it works. 1 means that we keep recycling that same connection that is bound to the non-threading process. Think "recycle_connection=T

Re: [web2py] separate database and web server web2py installation

2013-02-18 Thread Richard
Final result : no_ssh : 32.810 seconds (worst) remote with ssh : 32.010 seconds local : 31.494 seconds These are pretty basic tests, with profiler my dev machine may not be in exact same state (more memory or less for the differents test particularly the last test with no ssh). But it pretty s

[web2py] Re: Default SQLFORM.grid / auth restrictions?

2013-02-18 Thread Jim S
>From what I see you shouldn't have to have any groups setup. You will need a user which you can use the register function (from the generated login box on your main page) to create. Also, it appears as though you have your table setup incorrectly. If you want portfolio_id to be the keyfield

[web2py] Re: SmartGrid and New button 1 to many

2013-02-18 Thread Jim S
Dan the problem is that you are using SQLFORM.grid instead of SQLFORM.smartgrid. Try changing that and you should be good. Sorry for the delay, had a busy weekend -Jim On Saturday, February 16, 2013 12:20:22 PM UTC-6, Dan Kozlowski wrote: > > Jim, > > I still can't get it working. I hav

Re: [web2py] separate database and web server web2py installation

2013-02-18 Thread Niphlod
well, it depends. distinct boxes: more latency for every connection one-box: less latency but possibly ram,cpu,disk contention If your app uses a lot of CPU (that doesn't mean "your app do expensive db queries, that cpu is used by the db process") or a lot of memory or does a lot of writing/readi

[web2py] separate database and web server web2py installation

2013-02-18 Thread Richard
Hello, I would like to know if someone has any experience to report here about separating web and database server into distinct server (2 linux box for example). I making some test actually and found no great improvement to do so... I access the remote database server through ssh port fowardin

Re: [web2py] CPU 210%

2013-02-18 Thread Richard Vézina
Thanks Niphold for clarification, really appreciate. Richard On Mon, Feb 18, 2013 at 4:17 PM, Niphlod wrote: > it "easy". if you run web2py using threads, then pooling is ok, since it's > managed in a single process, recycling connections in a pool for each new > thread that processes a reques

Re: [web2py] CPU 210%

2013-02-18 Thread Niphlod
it "easy". if you run web2py using threads, then pooling is ok, since it's managed in a single process, recycling connections in a pool for each new thread that processes a request, and speeds up things a lot. A lot of webserver though use a single process to handle every request, using fork()

Re: [web2py] Removing HTML TAGS

2013-02-18 Thread Kenneth
Thank both Bruno and Michele. I just tried you second suggestion Michele but still got an ticket. But by changing places of str and TAG and adding flatten() I got what I wanted. XML(TAG(str(elements[9])).flatten()) Kenneth use beatifulsoup a one stop shop for html mangling > http://www.cr

Re: [web2py] Removing HTML TAGS

2013-02-18 Thread Michele Comitini
use beatifulsoup a one stop shop for html mangling http://www.crummy.com/software/BeautifulSoup/ or try this: XML(str(TAG(elements[9])) mic 2013/2/18 Bruno Rocha : > > > http://stackoverflow.com/questions/9662346/python-code-to-remove-html-tags-from-a-string > > -- > > --- > You received this m

Re: [web2py] CPU 210%

2013-02-18 Thread Richard Vézina
Hello, I am trying to optimize speed a bit these days, and read this thread and Michele "10 rules to speed" and I am mystify about rule 10 : 10. use the dal pooling machinery, i.e. db=DAL(..., pool_size=1) About the pool_size parameter is very important to reduce response time and use an adequate

[web2py] Re: 'appadmin' on trying ot load data admin

2013-02-18 Thread Niphlod
mysql or mssql ? Windows + MSSQL is one of mine "de facto" setups. I find hard to believe that the same app, same models and same db uri (so, same exact code) have a "preference" for working fine in an app and raising exceptions in another. Something MUST be different. On Monday, February 18, 2

[web2py] Re: Block oversized uploads serverside

2013-02-18 Thread Niphlod
usually in production you can put a limit on post size directly in the webserver. On Monday, February 18, 2013 6:55:46 PM UTC+1, Andriy wrote: > > I just checked on server (and not localhost as I did before) and I must > correct myself. File transfer goes though, but file never appears in >

Re: [web2py] Connecting to MySQL via SSL

2013-02-18 Thread Richard Vézina
You are welcome! Richard On Sat, Feb 16, 2013 at 5:40 PM, Osman Masood wrote: > Thanks, Richard. It worked. > > The command I used was: > ssh linux_user@ip_address -L 3307:database_ip:3306 > > (Our database is hosted on Amazon RDS, so for us ip_address was different > from database_ip. ) > > O

[web2py] Re: Querying values from two databases using Dal

2013-02-18 Thread Christian Espinoza
Yeah, it worked!!!: query = """SELECT *FROM db_alerts.alerts, db_app.trucks WHERE db_app.trucks.customer_id = 1 AND db_alerts.alerts.truck_lic = db_app.trucks.lic ORDER BY db_alerts.alerts.id DESC LIMIT 1""" db_app.executesql(query) Thanks Niphlod !! Christian. El lunes, 18 de febrero de 2013

[web2py] Re: Block oversized uploads serverside

2013-02-18 Thread Andriy
I just checked on server (and not localhost as I did before) and I must correct myself. File transfer goes though, but file never appears in uploads folder (which is a plus, but transfer itself is not safe). I`ll still open a ticket, may be you can do something to prevent file transfer. -- --

[web2py] Re: Block oversized uploads serverside

2013-02-18 Thread Massimo Di Pierro
Please open a ticket. Something like this could go in. On Monday, 18 February 2013 11:26:00 UTC-6, Andriy wrote: > > I`m writing a forum with possibility of attachments and looking for a way > to refuse over-sized uploads. Validator IS_LENGTH() checks for upload file > size, but only after the w

[web2py] Re: How do I define a table that references itself

2013-02-18 Thread Massimo Di Pierro
The only problem is that for self referendes you do not get an automatic represent and validator (because the field is created before the table referenced is created): You can do it manually: db.define_table('Docket', Field('Docket_No', 'integer', required = True), F

[web2py] Re: login by ajax

2013-02-18 Thread Massimo Di Pierro
self.login_bare() calls self.login_user(...) and it automatically logs in the user and stores user in session.auth.user On Sunday, 17 February 2013 23:34:01 UTC-6, yashar wrote: > > is there any way that i log in user by code? > for example after checking username and password with login_bar

[web2py] notnull in case of 'reference table'

2013-02-18 Thread Annet
I defined the following table in db.py: db.define_table('timetable', Field('nodeID','reference node',default='',requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('Select a value'))],ondelete='CASCADE',notnull=True,writable=False,readable=False), Field('dayID','reference day',label='Dag *

[web2py] Block oversized uploads serverside

2013-02-18 Thread Andriy
I`m writing a forum with possibility of attachments and looking for a way to refuse over-sized uploads. Validator IS_LENGTH() checks for upload file size, but only after the whole file transfered to server. This may be a security issue, since several attackers can start to upload Gb files to se

[web2py] Re: 'appadmin' on trying ot load data admin

2013-02-18 Thread Andrew Buchan
I should have added a bit more info... I'm running on MsSQL, and have 2 applications pointing at the same database, one live and one mirror copy for minor changes. From one application the data admin interface opens fine, from the other it gives me the appadmin exceptions. The files in /model a

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Jonathan Lundell
On 18 Feb 2013, at 9:04 AM, Alec Taylor wrote: > Thanks, what's the routes syntax to specific functions? > > This didn't work: > > fruit = dict( >default_function = 'index', >controllers = ['salad'], >functions = ['index','user','download','call', > 'data','error','profil

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Alec Taylor
*controllers that is On Tue, Feb 19, 2013 at 4:04 AM, Alec Taylor wrote: > Thanks, what's the routes syntax to specific functions? > > This didn't work: > > fruit = dict( > default_function = 'index', > controllers = ['salad'], > functions = ['index','user','download','cal

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Alec Taylor
Thanks, what's the routes syntax to specific functions? This didn't work: fruit = dict( default_function = 'index', controllers = ['salad'], functions = ['index','user','download','call', 'data','error','profile',] ) Am I meant to specify the list in BASE? On Tue, Feb

[web2py] Re: How to remove items that a user owns when selecting rows from db?

2013-02-18 Thread bracquet
I mean if we have a list of products called: Product 1 Product 2 Product 3 Product 4 And we have a list of registered buyers: Buyer 1 Buyer 2 Buyer 3 And the sales contains which products a buyer has bought: Buyer 1 Product 1 Buyer 2 Product 2 Product 3 What I'm trying to figure out is, when

Re: [web2py] Re: web2py contains pyfpdf version 1.54b, but there is version 1.7 with utf-8 support

2013-02-18 Thread Mariano Reingart
Martin: I've updated the web2py fpdf example addressing your issues (described bellow): http://pyfpdf.googlecode.com/files/web2py.app.fpdf_20130218.w2p (2) About unicode support, You need to pass unicode strings: u"my unicode string" (look at the u prefix). Also, you need embed a ttf unicode fon

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Jonathan Lundell
On 18 Feb 2013, at 8:38 AM, Niphlod wrote: > ! Missed that. > > On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote: > > You've listed salad as a function, but it's a controller. > > PS: Next thing to code is a small page where you load routes, a text input > where you c

[web2py] Re: Fatal problem with date field, SQLite and DAL - german/czech date format

2013-02-18 Thread Niphlod
A custom translation is ok (I'm italian and use the italian date format, that is %d/%m/%Y), as long as respects the way web2py handles it (and as long as the widget you chose for date(time(s)) fields can cope with the "correct translation"). On Monday, February 18, 2013 5:37:20 PM UTC+1, Mirek

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Niphlod
! Missed that. On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote: > > > You've listed salad as a function, but it's a controller. > PS: Next thing to code is a small page where you load routes, a text input where you can insert an http url, and a textarea with the result

[web2py] Re: Fatal problem with date field, SQLite and DAL - german/czech date format

2013-02-18 Thread Mirek Zvolský
Yes. I think this can be my problem - custom translation of formats. I'm very sorry, that I was too fast with entering this user group. I will study more about it and I will give then message, if the problem is in format definition or really inside web2py. Thanks, Mirek Dne pondělí, 18. února 2

[web2py] Re: Querying values from two databases using Dal

2013-02-18 Thread Niphlod
DAL can't do cross database queries, unless you use executesql. On Monday, February 18, 2013 5:27:38 PM UTC+1, Christian Espinoza wrote: > > Hi all, I'm need get the last alert(a table record) from db_alerts > database for every customer's truck, > but I'm can't get it, I'm using MYSQL. > > Table

[web2py] Querying values from two databases using Dal

2013-02-18 Thread Christian Espinoza
Hi all, I'm need get the last alert(a table record) from db_alerts database for every customer's truck, but I'm can't get it, I'm using MYSQL. Table trucks at db_base: db_app.define_table('trucks', Field('customer_id', db_app.customers), Field('lic', length=10), Field('cap', 'integer'

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Jonathan Lundell
On 18 Feb 2013, at 8:09 AM, Alec Taylor wrote: > > I have created a tiny test-case which proves that I can't properly > acquire request.args: https://gist.github.com/anonymous/4978457 > > What am I doing wrong; how am I supposed to acquire request.args? > > (I want URL per uid of record) You'v

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Alec Taylor
I have created a tiny test-case which proves that I can't properly acquire request.args: https://gist.github.com/anonymous/4978457 What am I doing wrong; how am I supposed to acquire request.args? (I want URL per uid of record) On Tue, Feb 19, 2013 at 12:48 AM, Niphlod wrote: > did you try turn

[web2py] Re: Fatal problem with date field, SQLite and DAL - german/czech date format

2013-02-18 Thread Niphlod
as a general rule of thumb, in web2py date(time(s)) are stored always in "pseudo-iso" format (-MM-DD) and transformed to/from according to the date format specified into languages. Are you using custom translation files and/or a different date-time widget than the default one included in we

Re: [web2py] Re: Graph Model (proposal to contribute)

2013-02-18 Thread António Ramos
D3js pure javascript on client! see this example of meteorjs using d3js http://meteor.com/examples/parties That is something... 2013/2/18 Niphlod > the only issue with the current implementation in trunk is that on Windows > it's almost impossible to get it going, due to the requirements. >

[web2py] Fatal problem with date field, SQLite and DAL - german/czech date format

2013-02-18 Thread Mirek Zvolský
Hi, maybe this is DAL.py error? Or more as one - strange behavior for dates in czech/german format - 'date' fields in tables cannot be used at all (!!) I have 'date' field in table 'akce' in SQLite database. I try a) after removing SQLite database I try run appadmin and browse table 'akce'

[web2py] Re: Graph Model (proposal to contribute)

2013-02-18 Thread Niphlod
the only issue with the current implementation in trunk is that on Windows it's almost impossible to get it going, due to the requirements. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving

[web2py] Re: Setting up memcache on GAE - a basic question

2013-02-18 Thread Niphlod
cacheable=True does not help ? On Monday, February 18, 2013 4:11:13 PM UTC+1, howesc wrote: > > ah yes > > the Rows() object returned from a select is not pickable. > > i do this a lot: > > students = cache.ram('students', > lambda:db(db.student.id>0).select(db.stud

[web2py] Re: Setting up memcache on GAE - a basic question

2013-02-18 Thread howesc
ah yes the Rows() object returned from a select is not pickable. i do this a lot: students = cache.ram('students', lambda:db(db.student.id>0).select(db.student.id, db.student.family_name, ...

Re: [web2py] Removing HTML TAGS

2013-02-18 Thread Bruno Rocha
http://stackoverflow.com/questions/9662346/python-code-to-remove-html-tags-from-a-string -- --- 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...

[web2py] Removing HTML TAGS

2013-02-18 Thread Kenneth
Hello, def parser(): from gluon.html import web2pyHTMLParser from gluon.sanitizer import sanitize folder = os.path.join(request.folder,'static') file = os.path.join(folder,'MYY.03.02.5.1.asp') source = open(file) html = source.read() tree=web2pyHTMLParser(html).tree

[web2py] Re: Graph Model (proposal to contribute)

2013-02-18 Thread pablo . angulo
Thanks a ton, Jose, I did a much more modest attempt at the same thing: print 'digraph Bloques{\n' \ 'ranksep="2"\n' \ 'splines="true"\n' for table in db: for field in table:

Re: [web2py] User Management Backoffice

2013-02-18 Thread Bruno Rocha
You can customize the web2admin https://github.com/rif/web2admin -- --- 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

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Niphlod
did you try turning debug on for routes ? Can you confirm that curl hits the function you're printing args into ? (i.e. it doesn't call /fruit/index/salad/foo) -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this grou

[web2py] Re: String interpreted as html code

2013-02-18 Thread Andriy
Use XML() helper - http://web2py.com/books/default/chapter/29/05#XML -- --- 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. F

[web2py] String interpreted as html code

2013-02-18 Thread BlueShadow
Hi, I got a string containing some html code and I want that to be interpreted as html. but when i do the simple{{=string}} i get that html printed as if it were text. there has to be a very simple way to do that. thanks -- --- You received this message because you are subscribed to the Googl

Re: [web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Alec Taylor
routers = dict( BASE = dict( default_application = 'fruit', applications = ['fruit', 'admin'], default_controller = 'default', controllers = 'DEFAULT', default_function = 'index', ), fruit = dict( default_function = 'index', functions = [

[web2py] widget: unexpected error

2013-02-18 Thread leone
Hi all! I built a widget that scans the local server file system. I attach the code of the widget. The content of form.vars and request.vars when the form is submitted is inexplicable for me: form = SQLFORM.factory( Field('tree2','string', widget=WDG.field_treeview(startpath=sta

[web2py] User Management Backoffice

2013-02-18 Thread Leonel Câmara
I finally need a backoffice where I allow the site owner to moderate the users. Before I start doing it I'd like to know if you guys have any tips, best practices or lists of things that I cannot forget as I'm certain this road has been traveled before. -- --- You received this message becau

[web2py] Re: web2py auth question

2013-02-18 Thread Leonel Câmara
You can use LOAD to put the login form on the homepage. It's also possible to do it in a completely ajaxified way, I did it using login_bare. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receivin

[web2py] Re: MySQL, self-reference, and null values

2013-02-18 Thread Loïc
Done http://code.google.com/p/web2py/issues/detail?id=1342 Thanks Le lundi 11 février 2013 00:40:59 UTC+1, Massimo Di Pierro a écrit : > > Can you please open a ticket so the issue is tracked? > > On Friday, 1 February 2013 09:20:54 UTC-6, Loïc wrote: >> >> Dear All, >> >> I have a 'page' model wi

Re: [web2py] Re: Unable to send email - password reset.

2013-02-18 Thread Andrew Buchan
Indeed it is subtle, perhaps it should make it clearer that it assumes TLS by default whereas previous versions didn't. As for the debug statements I was just looking for a way to get this from my live app, on occasions when I need to monitor live use. I guess I can always switch off the servic

[web2py] Re: web2py apache2 setup with htaccess authorization

2013-02-18 Thread Chr_M
Ah, thanks for the link and the example. I see some clues there. Regards, Chris On Monday, February 18, 2013 12:40:34 AM UTC+1, Massimo Di Pierro wrote: > > Perhaps this can help? > http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives > > Anyway you can mimic it with web2py. In a model a

Re: [web2py] Re: How do I define a table that references itself

2013-02-18 Thread Paul Whipp
Yes it can - the table I'm trying to create is perfectly valid and sensible (and it works fine if implemented directly in postgres or mysql). I'm just having trouble representing it effectively with the DAL. On 18 February 2013 18:54, pbreit wrote: > Can a reference be optional? > > > On Monday,

[web2py] Re: How do I define a table that references itself

2013-02-18 Thread pbreit
Can a reference be optional? On Monday, February 18, 2013 12:19:04 AM UTC-8, Paul Whipp wrote: > > Here is an example of what I need to do: > > db.define_table('Docket', > Field('Docket_No', 'integer', > required = True), > Field('Reference_Docket_ID', 'reference Docket

[web2py] How do I define a table that references itself

2013-02-18 Thread Paul Whipp
Here is an example of what I need to do: db.define_table('Docket', Field('Docket_No', 'integer', required = True), Field('Reference_Docket_ID', 'reference Docket', required = False), Field('Reference_Docket_No', 'integer', required = Fals

[web2py] Re: How to get request.args from an index() function?

2013-02-18 Thread Niphlod
of course this can't be possible, the entire framework will implode without a proper request routing: have you some custom routing in place ? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receivi

[web2py] Re: login by ajax

2013-02-18 Thread Paolo valleri
+1 for auth,ajax_login() paolo On Monday, February 18, 2013 4:50:20 AM UTC+1, Massimo Di Pierro wrote: > > Should we offer something like {{=auth.ajax_login()}} helper which submits > to /user/login? If would not be difficult to write. > How should it work? > > > > > On Sunday, 17 February 2013