[web2py] Re: RFC: validator IS_NOT_IN_SET

2014-01-27 Thread User
I think this is a useful validator, any chance this can end up in web2py? On Friday, August 9, 2013 4:13:30 PM UTC-4, Kyle Flanagan wrote: > > I had to use this today. However, this does not work correctly when the > set is empty. We assume that if the set is empty, whatever variable value > bei

[web2py] Re: move from sqlite to postgres using cpdb.py failed

2014-01-27 Thread Alan Etkin
> I have check sql.tmp - it contains only 'END'. After adding the print line > I have got following message, with no tables([]): > Have you run the app connecting to sqlite once? You must do it so web2py automatically creates the table files. cpdb reads those files from the database folder to

[web2py] Cassandra and web2py

2014-01-27 Thread Manoj bhupathiraju
Any idea of how to link cassandra and web2py. Please reply ASAP Thanks in advance -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this mess

[web2py] Unable to edit static files in web-editor

2014-01-27 Thread Yuriy Lopin
When I click some static js file even in example application, I get like this empty editing area. So I cant edit file. Any suggestions what it can be? -- Resources: - http://web2py.com - ht

[web2py] can't edit static files by web-editor

2014-01-27 Thread Yuriy Lopin
When i click some file in static folder i get - http://screen.w3.ua/Jan14/54426627.jpg You see - there is no any code. Plz answer why? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/is

[web2py] Re: Is there a way to cache images from "download" function?

2014-01-27 Thread Niphlod
probably you're not running a recent web2py release. On Saturday, January 25, 2014 9:37:12 PM UTC+1, James Burke wrote: > > def fast_download(): > import time, os > import contenttype as c > > cache.client(time_expire=604800, quick='SVL')(lambda: 0)() > > file_id = request.arg

[web2py] Re: Cassandra and web2py

2014-01-27 Thread Anthony
The DAL does not have a Cassandra adapter, so you'll have to use an external Python driver (e.g., https://github.com/datastax/python-driver). Anthony On Monday, January 27, 2014 1:55:03 AM UTC-5, Manoj bhupathiraju wrote: > > Any idea of how to link cassandra and web2py. Please reply ASAP > > T

[web2py] Re: caching TAG()

2014-01-27 Thread Anthony
Don't use XML() in your SMALL definition. Instead, create the entire HTML helper object, call the .xml() method, store the resulting string in the cache, and then after retrieving from cache, use XML() to display the string in a view. For example: myoutput = XML(cache.disk('Hello', lambda: CAT(

[web2py] Re: Cassandra and web2py

2014-01-27 Thread Alan Etkin
The DAL does not have a Cassandra adapter, so you'll have to use an > external Python driver (e.g., https://github.com/datastax/python-driver). > Or code your own adapter (and perhaps share it) http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Note-on-new-DAL-and

[web2py] Re: caching TAG()

2014-01-27 Thread Calvin
Thanks Leonel-I tried this without any success. It still rendering incorrectly but this time consistently before and after caching. On Tuesday, 21 January 2014 03:34:39 UTC+8, Leonel Câmara wrote: > > You can use {{=XML(output, sanitize=False)}} to get the correct rendering > -- Resources: - ht

[web2py] Caching selects or use memcache, is it the same?

2014-01-27 Thread Tito Garrido
Hi Folks, I am planning a new application and I am wondering, should I use memcache instead of cache selects? Do I need to use memcache if I am using cache select? Which one is faster? What is the best practice? The plan is to cache some selects to show in view and get a fast response time. Tha

[web2py] Re: Form on every page?

2014-01-27 Thread Apple Mason
I found this thread that has a similar problem: https://groups.google.com/forum/#!searchin/web2py/form$20in$20layout.html/web2py/JRxUYp_YpHk/4uVM7kg9Ja4J The example was: def contact(): form=SQLFORM.factory() if form.accepts() return form # not dict(form=form) and in

[web2py] Re: Form on every page?

2014-01-27 Thread Anthony
You can set the "action" attribute of the form to the URL of your searchbar() function (you might also change the method from post to get since the form is for search). How you create the form itself in the view depends on your needs. Do you just need a single text search field? What does the s

[web2py] Re: Form on every page?

2014-01-27 Thread Apple Mason
If I manually create the raw html form and set the action attribute, how would I get csrf protection? SQLFORM would generate a token to handle this, but wouldn't I lack this protection is I write the html myself? Also, since there's no form.process().accepted, does this also mean I'm open to un

[web2py] rname and xml?

2014-01-27 Thread Richard
Hello, What's going to happen with rname in xml? Richard -- 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 subsc

[web2py] Re: Form on every page?

2014-01-27 Thread Anthony
Is this just a search form making GET requests open to the public? In that case, I don't think you need to worry about CSRF or input sanitizing. Anthony On Monday, January 27, 2014 2:16:04 PM UTC-5, Apple Mason wrote: > > If I manually create the raw html form and set the action attribute, how

[web2py] Email and PGP

2014-01-27 Thread horridohobbyist
As per the web2py book, I installed the python-pyme package in Ubuntu Server and inserted the following into db.py: from gpgme import pgp mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'your passphrase' mail.settings.encrypt = True I get "ImportError:

[web2py] Re: Redis caching

2014-01-27 Thread Derek
Not at all. I'm simply suggesting you get a patent for your idea right away and start implementing it, so we can see just how awesome the idea really is. I can only imagine! On Thursday, January 16, 2014 3:57:05 PM UTC-7, Arnon Marcus wrote: > > Derek: Are you being sarcastic and mean? > > > >

[web2py] Re: Redis caching

2014-01-27 Thread Niphlod
> Hmmm... I don't know, redis is famous for crunching somewhere in the order > of 500K requests per-second - have you tested it? > I though it was clear, anyway, I reinstate: yep, it was clearly loosing performances each step of complexity added. I'm a big fan of NoSQL but please do mind th

[web2py] Re: Email and PGP

2014-01-27 Thread Niphlod
you need the gpgme package, not the python-pyme one On Monday, January 27, 2014 8:42:33 PM UTC+1, horridohobbyist wrote: > > As per the web2py book, I installed the python-pyme package in Ubuntu > Server and inserted the following into db.py: > > from gpgme import pgp > mail.settings.cipher_type

Re: [web2py] rname and xml?

2014-01-27 Thread Niphlod
Can you elaborate ? On Monday, January 27, 2014 8:34:31 PM UTC+1, Richard wrote: > > Hello, > > What's going to happen with rname in xml? > > Richard > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google

[web2py] Re: Form on every page?

2014-01-27 Thread Apple Mason
Yeah, the search terms will be open to the public. But the search terms will be queried in the database using like() or contains() from the DAL. Will that be okay if those search terms are unsanitized? On Monday, January 27, 2014 2:34:45 PM UTC-5, Anthony wrote: > > Is this just a search form ma

[web2py] Re: Caching selects or use memcache, is it the same?

2014-01-27 Thread Niphlod
memcache is a storage engine that web2py can use to cache selects. Both memcache or redis are faster than cache.ram or cache.disk (especially with concurrent access): those are "pure-python" solutions embedded in the framework. On Monday, January 27, 2014 3:50:36 PM UTC+1, Tito Garrido wrote: >

[web2py] Re: Form on every page?

2014-01-27 Thread Anthony
On Monday, January 27, 2014 3:21:25 PM UTC-5, Apple Mason wrote: > > Yeah, the search terms will be open to the public. But the search terms > will be queried in the database using like() or contains() from the DAL. > Will that be okay if those search terms are unsanitized? > Should be fine. Any

Re: [web2py] rname and xml?

2014-01-27 Thread Richard Vézina
If I do rows = db(...).select(db.table.ALL).as_list() from gluon.serializers import xml xmlrows = XML(xml(rows, quote=False)) import gluon.contenttype response.headers['Content-Type'] = gluon.contenttype.contenttype('.xml') return dict(xmlrows=xmlrows) I will get xml looking like this :

Re: [web2py] rname and xml?

2014-01-27 Thread Niphlod
the whole point of rname is decoupling and "masking" the underlying backend identifiers without changing the model entities. I don't think that rname will (or should) be exposed when serializing the rows object (that, BTW, doesn't and shouldn't retain any notion of rname) You'll probably need

Re: [web2py] rname and xml?

2014-01-27 Thread Richard Vézina
Yes I guess I need to write my own serializer... I will work on it and figure how excel will digest xml... Thanks If applies I will write a slice when I have something interresting, that could maybe goes in the book as an example... Richard On Mon, Jan 27, 2014 at 4:04 PM, Niphlod wrote: >

[web2py] Re: Printing statements from Python

2014-01-27 Thread Rowdy
On 27/01/2014 05:30, horridohobbyist wrote: I'm looking for a simple way to print out statements in Python. I understand the 'print' function outputs to the console on the server side, but once web2py is deployed through Apache, I don't there's a "console" anymore. I tried looking at Python logg

[web2py] Slow response

2014-01-27 Thread Calvin Morrison
Hi guys, I have a fairly typical web2py application I am trying to deploy with a standard CentOS 6 configuration using Apache and MySQL. What seems to be bugging me right now is that the responses are very slow, around .7 seconds to load the home page. I have a feeling this is because of my

[web2py] Re: Email and PGP

2014-01-27 Thread horridohobbyist
>From the web2py book: It is possible to send PGP encrypted emails. First of all you need to install the *python-pyme* package. Then you can use GnuPG (GPG) to create the key-files for the sender (take the email-address from mail.settings.sender) and put the files pubring.gpg and secring.gpg in

[web2py] Re: Email and PGP

2014-01-27 Thread horridohobbyist
Oh, wait a sec...there are two references in my Google search for the web2py book, one of which is probably an older version. This confused me. On Monday, 27 January 2014 16:25:52 UTC-5, horridohobbyist wrote: > > From the web2py book: > > It is possible to send PGP encrypted emails. First of al

[web2py] Re: Email and PGP

2014-01-27 Thread Niphlod
a little clear-up: You posted a snippet of code that required the gpgme package. Web2py Mail are only compatible with python-pyme package you don't need to do any import in the models because it's imported directly by web2py https://github.com/web2py/web2py/blob/master/gluon/tools.py#L481

[web2py] Re: Slow response

2014-01-27 Thread Niphlod
check http://web2py.com/books/default/chapter/29/13/deployment-recipes for all kinds of setups ^_^ On Monday, January 27, 2014 10:14:01 PM UTC+1, Calvin Morrison wrote: > > Hi guys, > > I have a fairly typical web2py application I am trying to deploy with a > standard CentOS 6 configuration usi

[web2py] CentOS install notes

2014-01-27 Thread Calvin Morrison
I've been having trouble with centOS getting a 503 Service unavailable using Apache's httpd. If anyone else is seeing this same problem, I found that this solved my problem: adding this to my main httpd.conf: WSGISocketPrefix /var/run/wsgi -- Resources: - http://web2py.com - http://web2py.com

[web2py] DAL callback "before read" / "before select" ?

2014-01-27 Thread Tim Richardson
I have a table which stores data from an expensive web service query. It's used in some read-only grids as well as in some geolocation logic. At the moment, I use cache to determine if a certain time has elapsed before rebuilding the table; this fixed-time logic is good enough for the purpose. I

[web2py] Get individual data from remote JSON Response

2014-01-27 Thread David
Ok I've spent several hours trying to understand how Python/Web2Py can pull a piece of data from a json response but it is still eluding me. Could someone be so kind enough to show me the python way of handling this response so I can put a piece of data on the screen from a remote host? Situa

[web2py] Re: Slow response

2014-01-27 Thread David
I switched to Nginx. It helps. On Monday, January 27, 2014 3:14:01 PM UTC-6, Calvin Morrison wrote: > > Hi guys, > > I have a fairly typical web2py application I am trying to deploy with a > standard CentOS 6 configuration using Apache and MySQL. > > What seems to be bugging me right now is th

[web2py] Re: Get individual data from remote JSON Response

2014-01-27 Thread Niphlod
post the controller code. Then we can talk! :P On Monday, January 27, 2014 11:06:01 PM UTC+1, David wrote: > > Ok I've spent several hours trying to understand how Python/Web2Py can > pull a piece of data from a json response but it is still eluding me. > > Could someone be so kind enough to sh

[web2py] Ouch! It looks like 3L, it asserts like 3L, it quacks like 3L, but it's a gluon.dal.Reference

2014-01-27 Thread Horst Horst
I've just spent several hours debugging a mysterious bug until I figured out that what I thought was a long int (passed trough several layers of code) was in fact a gluon.dal.Reference instance. I think I would have found it immediately if repr(gluon.dal.Reference(3)) had been 'Reference(3L)' r

[web2py] Re: Get individual data from remote JSON Response

2014-01-27 Thread David
It's not much but here's what I got. I removed all the broken code. def get_pools(): cgminer = CgminerAPI(host="samplehost.com", port=4028) version = cgminer.version() return dict(version) You can see a raw response and beautifed response on the dev host. https://rigs

[web2py] Re: response.menu links alt attribute and target="blank"

2014-01-27 Thread pang
Sorry to revive this old thread, but using Anthony's solution, a click on the menu entry both opens the link in a new page and in the current page. My bet is this only happens with the new bootstrap menus, and it didn't happen with the old superfish ones. -- Resources: - http://web2py.com - ht

[web2py] Re: questions about using xml files in web2py

2014-01-27 Thread Dave S
On Friday, January 24, 2014 6:10:13 AM UTC-8, greaneym wrote: > > I found what I needed by > > reading more about requests, > http://docs.python-requests.org/en/latest/index.html > > and this reading this link, > http://stackoverflow.com/questions/2667509/curl-alternative-in-python > > and by read

[web2py] Getting a 400 bad request instead of 404 for urls with hyphens?

2014-01-27 Thread User
I am trying to get error handling for page not found errors working. I'm using the following example: http://www.web2pyslices.com/slice/show/1529/custom-error-routing This seems to be working for URLs such as www.example.com/asdf www.example.com/longurlthatdoesnotexit?_next=/ I get my 404 pag

Re: [web2py] rname and xml?

2014-01-27 Thread Richard Vézina
May have found a way... It seems possible to tell Excel to import a given table in a page : http://office.microsoft.com/en-us/excel-help/get-and-analyze-data-from-the-web-in-excel-HA001054848.aspx Point 3 : - *Only the tables* returns all tables or preformatted () sections on the page.

[web2py] Re: Get individual data from remote JSON Response

2014-01-27 Thread David
Solution: Coming from PHP Print_r but it's done differently in Python and much easier print s['STATUS'][0]['Description'] On Monday, January 27, 2014 4:06:01 PM UTC-6, David wrote: > > Ok I've spent several hours trying to understand how Python/Web2Py can > pull a piece of data from a json re

Re: [web2py] Unable to acces admin app in production

2014-01-27 Thread Richard Vézina
Did you backup before? You probably need to update a couple of file that are web2py specific in static/ all the js, in views/ the generic views and the web2py_ajax also in you case the appadmin.py controller must be update... You migrate from which version... If you search the list there is a po

[web2py] Re: Printing statements from Python

2014-01-27 Thread horridohobbyist
Gee, that's a clever idea! Thanks. On Monday, 27 January 2014 16:09:20 UTC-5, Rowdy wrote: > > On 27/01/2014 05:30, horridohobbyist wrote: > > I'm looking for a simple way to print out statements in Python. I > > understand the 'print' function outputs to the console on the server > > side, bu

[web2py] Re: Uploading application to server

2014-01-27 Thread Dave S
On Sunday, January 26, 2014 10:40:16 AM UTC-8, Wonton wrote: > Looking at this and seeing that it tries to access admin.py, maybe it was > a bad decision to remove the admin application? > How could I "enable" cloneofmyapplication in the server? > > Do you still have the welcome app? Perhap

[web2py] Re: Ouch! It looks like 3L, it asserts like 3L, it quacks like 3L, but it's a gluon.dal.Reference

2014-01-27 Thread Anthony
Perhaps not a bad idea. I recall going through a similar hunt. On Monday, January 27, 2014 5:27:17 PM UTC-5, Horst Horst wrote: > > I've just spent several hours debugging a mysterious bug until I figured > out that what I thought was a long int (passed trough several layers of > code) was in fa

[web2py] SQLTABLE and db.table.field.count()

2014-01-27 Thread Kurt Grutzmacher
It seems that change 14bcad629eb2b73266b11b4c9dbf63499c73d38b modified the way SQLTABLE handled column names by using this regex for table.field: REGEX_TABLE_DOT_FIELD = re.compile('^(\w+)\.([^.]+)$') This has c

[web2py] Re: Getting a 400 bad request instead of 404 for urls with hyphens?

2014-01-27 Thread Anthony
I think it's interpreting as-df as the app name, which by default is not allowed to contain hyphens. Your error handler can simply check for 400 codes and then in turn send a response with a 404. Anthony On Monday, January 27, 2014 8:00:51 PM UTC-5, User wrote: > > I am trying to get error hand

[web2py] Accessing a table with a reference field

2014-01-27 Thread horridohobbyist
I have two tables defined: db.define_table('orders', Field('buyer_id',db.auth_user), Field('order_date','datetime'), Field('status')) db.define_table('ordered_items', Field('order_num','reference orders'), Field('prod

[web2py] Re: Accessing a table with a reference field

2014-01-27 Thread horridohobbyist
Oh, sorry, I erred. That's not the problem. Please disregard until I investigate further. On Monday, 27 January 2014 23:47:05 UTC-5, horridohobbyist wrote: > > I have two tables defined: > > db.define_table('orders', > Field('buyer_id',db.auth_user), > Field('orde

[web2py] Re: Is there a way to cache images from "download" function?

2014-01-27 Thread James Burke
Version 2.7.4-stable+timestamp.2013.10.14.15.16.29 recent enough? It's after your original post. On Tuesday, January 28, 2014 2:49:52 AM UTC+13, Niphlod wrote: > > probably you're not running a recent web2py release. > > On Saturday, January 25, 2014 9:37:12 PM UTC+1, James Burke wrote: >> >> def

[web2py] Re: response.menu links alt attribute and target="blank"

2014-01-27 Thread pang
Found the bug: https://code.google.com/p/web2py/issues/detail?can=2&start=0&num=100&q=menu&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=1270 and posted a solution. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github

[web2py] Minimum password length not working?

2014-01-27 Thread User
In the web2py book it says: By default, auth also requires a minimum password length of 4. This can be changed: auth.settings.password_min_length = 4 (from http://www.web2py.com/book/default/chapter/09#Settings-and-messages) So I tried changing to: auth.settings.password_min_length = 7 Aft

[web2py] Re: Printing statements from Python

2014-01-27 Thread Tim Richardson
Apart from python documentation, please check the web2py docs :) http://web2py.com/books/default/chapter/29/04/the-core?search=logger logging is managed by the web2py app so there is a config file to set up in web2py. It's a good thing to have in the tool kit. On Monday, 27 January 2014 0