Re: [web2py] Sorting alphanumeric data

2010-07-23 Thread Thadeus Burgess
It is possible to create SQL functions that will represent your natural sort. You can use db.executesql("") to call the function. Read the following comments in the below link for examples on performing this with postgresql. http://www.postgresql.org/docs/8.0/interactive/queries-order.html -- Th

Re: [web2py] best way to take advantage of sidebar in layout.html

2010-07-23 Thread Bruno Rocha
if you define a function sidebar in your model sidebar.py def sidebar(): return SPAN('teste') #this could return anything to be rendered in sidebar You can call that in any view, even yout layout.html: default/index.html ... README {{=sidebar()}} ... 2010/7/23 Rob : > Hi, > > I would

Re: [web2py] Sorting alphanumeric data

2010-07-23 Thread Jonathan Lundell
On Jul 23, 2010, at 5:39 PM, DJ wrote: > I have sorting problem with a column in the database (string) that > stores alphanumeric data. The data is A1, A2, A3..A10, A11, A12. > > When I sort by column type, I get A1, A10, A11, A12 but I would like > to get A1, A2, A3...A10, A11, A12. Is there any

[web2py] Sorting alphanumeric data

2010-07-23 Thread DJ
Hello, I have sorting problem with a column in the database (string) that stores alphanumeric data. The data is A1, A2, A3..A10, A11, A12. When I sort by column type, I get A1, A10, A11, A12 but I would like to get A1, A2, A3...A10, A11, A12. Is there anything I can try with orderby="columntype"?

[web2py] best way to take advantage of sidebar in layout.html

2010-07-23 Thread Rob
Hi, I would really like to take advantage of the left sidebar in the stock layout.html. After reading http://web2py.com/book/default/section/5/4, it says that {{include}} must come before any function calls. I only want to use the left_sidebar on a single page. How do I rewrite this so it works

Re: [web2py] Re: which is the preferred way?

2010-07-23 Thread Jonathan Lundell
On Jul 23, 2010, at 4:39 PM, Rob wrote: > Hi Massimo, > > Thanks, that is what I prefer as well. There are MVC arguments for pushing the html into the view. But this example is an easy one in this regard. Most of my tables don't go straight from the database to the view. Rather, they get manip

[web2py] Re: which is the preferred way?

2010-07-23 Thread Rob
Hi Massimo, Thanks, that is what I prefer as well. On Jul 23, 2:08 pm, mdipierro wrote: > I tend to do it in the views but I would make it a rule > > On Jul 23, 3:49 pm, Rob wrote: > > > What is the preferred way you guys do things? > > > controller (this covers both examples): > > def index():

[web2py] storing a token to identify a service user

2010-07-23 Thread Miguel Lopes
Hi, How can a token be stored between service calls in order to know a service is logged in? Miguel

Re: [web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread Thadeus Burgess
Also, I don't have time to read every google group posting anymore. This may have been suggested in a thread that was buried from those who just scan the post titles. Changes like this need to be called out, we need some way of being able to review and vote for certain changes something like u

[web2py] Re: How to submit a custom form

2010-07-23 Thread mr.freeze
Sorry, that's {{=lbl.username}}:{{=wdgt.username}} On Jul 23, 5:16 pm, "mr.freeze" wrote: > I noticed that some of your table is malformed. > {{=lbl.username}}:{{=wdgt.username}} > should be > {{=lbl.username}}:{{=wdgt.username}} > > There are several like this. Make sure all of your table conten

[web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread mr.freeze
There was talk of a week long RC period for all releases unless there was an important bug fix but we seem to have reverted to old habits. On Jul 23, 5:28 pm, Thadeus Burgess wrote: > I also agree that this is a break in backwards compatibility. It is also a > change that was never considered for

[web2py] Re: book revision

2010-07-23 Thread mr.freeze
crud.search RPXAccount populate plugins and PluginManager any new validators LOAD On Jul 23, 5:16 pm, "mr.freeze" wrote: > Definitely these:http://web2pyslices.com/main/slices/take_slice/16 > > On Jul 23, 4:53 pm, mdipierro wrote: > > > I am revising the book. > > > Please list what features ar

Re: [web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread Thadeus Burgess
I also agree that this is a break in backwards compatibility. It is also a change that was never considered for longer than 15 minutes before the decision to make the change was implemented. I really wish we would put certain things such as this under a review board so they don't get into web2py a

[web2py] Re: book revision

2010-07-23 Thread mr.freeze
Definitely these: http://web2pyslices.com/main/slices/take_slice/16 On Jul 23, 4:53 pm, mdipierro wrote: > I am revising the book. > > Please list what features are not mentioned in the book or deserve > more space they correctly get. > You suggestions will be appreciated. > > Massimo

[web2py] Re: How to submit a custom form

2010-07-23 Thread mr.freeze
I noticed that some of your table is malformed. {{=lbl.username}}:{{=wdgt.username}} should be {{=lbl.username}}:{{=wdgt.username}} There are several like this. Make sure all of your table content is in td's then try again. On Jul 23, 5:13 pm, elfuego1 wrote: > I had removed this part of the cod

[web2py] chat appliance (newbie)

2010-07-23 Thread Stef Mientki
hello, I just started with web2py (after a long period of doubt, which to choose, Django or Web2Py) and it looks really great, although the first steps looks difficult. I tried to install the appliance chat (did anyone used this application already?) At first sight chat looked great, but after

[web2py] Re: How to submit a custom form

2010-07-23 Thread elfuego1
I had removed this part of the code but it's not working anyway. Answering your quetion: I can see the button but it's not wroking as it should. On 23 Lip, 19:47, "mr.freeze" wrote: > Are you not seeing the submit button or is it just not working? I see > in your javascript that you are basicall

[web2py] book revision

2010-07-23 Thread mdipierro
I am revising the book. Please list what features are not mentioned in the book or deserve more space they correctly get. You suggestions will be appreciated. Massimo

[web2py] Re: rocket performance issues

2010-07-23 Thread mdipierro
On a second thought this open the door to more sever denial of service attacks than caused by the original problem. How about, until there is a better under understanding and solution, we just increase max_threads from the original 128 to 1024. On Jul 22, 11:27 am, Timbo wrote: > Try one quick ch

[web2py] Re: SQLite Logging

2010-07-23 Thread mdipierro
about #3. I would prefer if this were written as a gluon.contrib.logging module that users can import if needed. On Jul 23, 2:02 pm, Iceberg wrote: > Well done Yarin! Some comments. > > 1. Change those time_expire= into time_expire=None please. The clumsy > trick was my early "i

[web2py] Re[2]: SQLite Logging

2010-07-23 Thread Iceberg
Well done Yarin! Some comments. 1. Change those time_expire= into time_expire=None please. The clumsy trick was my early "invention" before I know the time_expire=None approach. 2. My another later improvement is to write the log file at {web2py path}/applications/{your app}/s

[web2py] Re: which is the preferred way?

2010-07-23 Thread mdipierro
I tend to do it in the views but I would make it a rule On Jul 23, 3:49 pm, Rob wrote: > What is the preferred way you guys do things? > > controller (this covers both examples): > def index(): >     rows = db().select(db.Category.ALL) >     table = TABLE() >     for row in rows: >         table.

[web2py] which is the preferred way?

2010-07-23 Thread Rob
What is the preferred way you guys do things? controller (this covers both examples): def index(): rows = db().select(db.Category.ALL) table = TABLE() for row in rows: table.append(TR(row.name, A("Delete", _href=URL(r=request, f='delete', args=row.id return dict(table=t

[web2py] Re: LEFT JOIN a table to a SUM query

2010-07-23 Thread mwolfe02
That seems to work for this simple example. The actual query I'm trying to write is much more involved, but I'll see if I can apply the concept to my specific problem. You have certainly gotten me a step closer to a solution. Thanks so much for your help. On Jul 23, 3:22 pm, "mr.freeze" wrote:

[web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread MikeEllis
Typo: 2 sentence in prior message should read " ... after XML() supplies the unescaped string." On Jul 23, 3:28 pm, Michael Ellis wrote: > Urgh!  FWIW, putting XML() around the strings doesn't seem to work.  Looks > like the escaping is applied after XML() supplies the unquoted string. > > I tr

Re: [web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread Michael Ellis
Urgh! FWIW, putting XML() around the strings doesn't seem to work. Looks like the escaping is applied after XML() supplies the unquoted string. I tried {{ for optstring in (schartoptions, countpieoptions, cchartoptions): optstring = XML(optstring) debug("opstring=%s"%optstring) pass

[web2py] Re: LEFT JOIN a table to a SUM query

2010-07-23 Thread mr.freeze
Does this work? count = db.dog.id.count() rows=db().select(db.person.name, count, groupby=db.person.id, left=db.dog.on(db.person.id==db.dog.owner)) On Jul 23, 2:08 pm, mwolfe02 wrote: > The example under Grouping and Counting returns: > > Alex 2 > Bob  1 > > In other words, it performs an INNER J

[web2py] Re: exercise of the day

2010-07-23 Thread Iceberg
On Jul 24, 1:35am, weheh wrote: > Pardon, professor, but my dog ate my reading assignment on virtual > fields and I couldn't find it in the documentation. I've seen a few > threads on the topic, but none that fully described what it is. > Compute fields were also consumed by the mutt. Could you te

[web2py] Re: LEFT JOIN a table to a SUM query

2010-07-23 Thread mwolfe02
The example under Grouping and Counting returns: Alex 2 Bob 1 In other words, it performs an INNER JOIN not an OUTER JOIN. This is a critical difference. In this simple example we don't get a row of information for 'Carl' because he owns no dogs. It may not be a big deal for such a simple, co

[web2py] Re: Wiki in Chap 3 of Documentation

2010-07-23 Thread Jeff S
You can attach the w2p package if you want to, but I modified the "def bg_find()" as you did and now it's working as expected. Thank you, Jeff

[web2py] Re: LEFT JOIN a table to a SUM query

2010-07-23 Thread mr.freeze
Doesn't the example under Grouping and Counting do what you want? On Jul 23, 1:41 pm, Michael Wolfe wrote: > Expanding on the LEFT OUTER JOIN example from > here:http://web2py.com/book/default/section/6/6 > > How would I build a query using the DAL that would return the number > of dogs each own

[web2py] LEFT JOIN a table to a SUM query

2010-07-23 Thread Michael Wolfe
Expanding on the LEFT OUTER JOIN example from here: http://web2py.com/book/default/section/6/6 How would I build a query using the DAL that would return the number of dogs each owner has? In MS Access, it is done most easily using two queries: DogsByOwnerID: SELECT dog.owner, Count(dog.name) AS

Re: [web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread Michael Ellis
Thanks, Nathan. That's certainly a possibility. It's just that I'm not sure what security issue this change actually fixes. There are no user-supplied strings in what I'm using to generate the jQuery calls. If that were the case, then yes it would definitely be my responsibility to properly sani

[web2py] Re: Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread mr.freeze
It was probably introduced as a security fix. You can do: {{ schartoptions = XML("""{ type: 'bar', barColor: 'green', chartRangeMin: '%d', chartRangeMax: '%d' } """%(chartmin,chartmax)) }} and it won't be escaped. On Jul 23, 12:39 pm, Michael Ellis wrote: > I've got an a

[web2py] Re: How to submit a custom form

2010-07-23 Thread mr.freeze
Are you not seeing the submit button or is it just not working? I see in your javascript that you are basically cancelling the submit with this code: var submit = false; $(document).ready(function(){ $("form").submit(function() { return submit; }); }); On Jul 2

[web2py] Recent change to string escaping breaks dynamic javascript

2010-07-23 Thread Michael Ellis
I've got an app with views that generate jQuery code on the fly. This was all working fine until recently, i.e. sometime after 1.92. With more recent builds, single and double quotes in strings are now escaped and it breaks the javascript. Here's an example The view has (with much snipped out)

[web2py] Re: How to submit a custom form

2010-07-23 Thread elfuego1
Can I count on some help? On 23 Lip, 15:50, elfuego1 wrote: > First submit button on login page works like a charm. > But submit button on registration page - doesn't. > > Content of my user.html > --- > > {{extend 'layout.h

[web2py] Re: exercise of the day

2010-07-23 Thread weheh
Pardon, professor, but my dog ate my reading assignment on virtual fields and I couldn't find it in the documentation. I've seen a few threads on the topic, but none that fully described what it is. Compute fields were also consumed by the mutt. Could you tell us where to find doc on these construc

Re: [web2py] Re: rocket performance issues

2010-07-23 Thread Michele Comitini
Yes that could be really a small problem with Rocket's threaded implementation, not the GIL, which usually shows up on higher concurrency loads. Anyway that would be a point for Guido... :D ciao, mic 2010/7/23 mdipierro > I am not convinced this is a GIL problem. Why the lock after the 400 >

Re: [web2py] chunks

2010-07-23 Thread Jonathan Lundell
On Jul 23, 2010, at 3:31 AM, Jason Brower wrote: > Is this because you have large amounts of data? > When I has some work, we used TCL for the pages. TCL loads as you go. > This is because back in the day webbrowsers we nasty slow and it sent > the data as it came. Now-a-day we create the page

Re: [web2py] Re: Create detail record

2010-07-23 Thread Massimiliano
Ok... It's friday :D row_id = db.invoice_rows.insert(invoce_id=my_invoice_id) form=SQLFORM(db.invoicesrows, row_id) On Fri, Jul 23, 2010 at 4:51 PM, Massimiliano wrote: > Thank you. > > So I need to do it manually... > > row_id = db.invoice_rows.insert(invoce_id=my_invoice_id) > > > and aft

[web2py] Re: invoke controllers' actions from template

2010-07-23 Thread Vidul Petrov
Great! Thank you, Massimo! On Jul 23, 5:47 pm, mdipierro wrote: > Yes but I reccoment you do it via ajax > > {{=LOAD('controller','action',vars={},args=[],ajax=True)}} > > On Jul 23, 9:32 am, Vidul Petrov wrote: > > > > > Hi all, > > > Does web2py support (imho a bad practice still I need this f

Re: [web2py] Re: Create detail record

2010-07-23 Thread Massimiliano
Thank you. So I need to do it manually... row_id = db.invoice_rows.insert(invoce_id=my_invoice_id) and after redirect to the edit page... redirect(URL(r=request, f='edit', args=[row_id])) I thought the was a way to pass the invoice_id to the SQLFORM... Something like that: form=SQLFORM(db.i

[web2py] Re: invoke controllers' actions from template

2010-07-23 Thread mdipierro
Yes but I reccoment you do it via ajax {{=LOAD('controller','action',vars={},args=[],ajax=True)}} On Jul 23, 9:32 am, Vidul Petrov wrote: > Hi all, > > Does web2py support (imho a bad practice still I need this feature) > invocation of controllers' actions from templates? > My aim is to include

[web2py] Re: Create detail record

2010-07-23 Thread Vidul Petrov
You may want to read this part of the book: http://web2py.com/book/default/section/6/6?search=joins On Jul 23, 4:41 pm, Massimiliano wrote: > Hi, > > I'm sorry if it is a basic question but I don't find a clean way to do that. > > Imagine I'm showing an Invoice with related rows. > > How can I cr

[web2py] invoke controllers' actions from template

2010-07-23 Thread Vidul Petrov
Hi all, Does web2py support (imho a bad practice still I need this feature) invocation of controllers' actions from templates? My aim is to include into a given template the results from different controllers' actions conditionally. Or just functions in the models files which are invoked directly

[web2py] Re: rocket performance issues

2010-07-23 Thread mdipierro
I am not convinced this is a GIL problem. Why the lock after the 400 errors only? On Jul 23, 9:18 am, Michele Comitini wrote: > Because of the GIL threads on CPython are problematic more than one could > think.  Googling "GIL python" gives an idea... > Not to start the war threading vs forking mo

Re: [web2py] Interesting - bpython

2010-07-23 Thread Michele Comitini
cool! +1 2010/7/23 Albert Abril > Nice. I didn't know it. > Seems a few better than ipython. > > On Fri, Jul 23, 2010 at 2:09 PM, David Marko wrote: > >> http://bpython-interpreter.org/ > > >

Re: [web2py] Re: rocket performance issues

2010-07-23 Thread Michele Comitini
Because of the GIL threads on CPython are problematic more than one could think. Googling "GIL python" gives an idea... Not to start the war threading vs forking model in general, but the GIL will not go away from van Rossum's python implementation (no not even in 3.x), he rather suggests to stay

[web2py] Re: SQLite Logging

2010-07-23 Thread Yarin Kessler
Glad you like- I'd love to see this as part of the core. Let me know if there's anything else I can do. >I am not so keen to include the sqlite part because it is too specific Is this because it requires the extra module? I kept it separate because it's a Python, not web2py, specific class, but

[web2py] Re: How to submit a custom form

2010-07-23 Thread elfuego1
First submit button on login page works like a charm. But submit button on registration page - doesn't. Content of my user.html --- {{extend 'layout.html'}} {{lbl=form.custom.label}} {{wdgt=form.custom.widget}} {{if request

[web2py] Create detail record

2010-07-23 Thread Massimiliano
Hi, I'm sorry if it is a basic question but I don't find a clean way to do that. Imagine I'm showing an Invoice with related rows. How can I create a row and to assign automaticaly the invoice_id field in the row record? db.define_table( 'invoices', Field('dateinvoice', 'date', default=

[web2py] Re: SQLite Logging

2010-07-23 Thread Massimo Di Pierro
Very good work. We should think about a way to include this in web2py core. I am not so keen to include the sqlite part because it is too specific but: I see the log.py file could go in contrib with minimal changes (it it were implemented as a function that takes the request and cache obj

[web2py] Re: SQLite Logging

2010-07-23 Thread mdipierro
+1 notice that you can use expire_time=None to prevent cache from expiring instead of On Jul 23, 8:24 am, Yarin wrote: > Added a slice: Application > Logginghttp://web2pyslices.com/main/slices/take_slice/91 > > It covers logging to both a file and SQLite.  The code is well > documented

[web2py] Re: SQLite Logging

2010-07-23 Thread Yarin
Added a slice: Application Logging http://web2pyslices.com/main/slices/take_slice/91 It covers logging to both a file and SQLite. The code is well documented- use this instead of the previous code. Would love to get your comments. @Iceberg, btw apparently the SQLite cross-thread issues weren't s

[web2py] Re: rocket performance issues

2010-07-23 Thread mdipierro
Good idea. In trunk. On Jul 23, 6:47 am, Iceberg wrote: > Nice to have partial progress in 1.81.5 anyway. Congratulations. Even > so, how comes an HTTP 400 error can lock Rocket? �...@_@ > > And if that is somehow really the cause, we need to prevent 400 error > from /favicon.ico  It is simple, a

[web2py] Re: Trouble creating session variable

2010-07-23 Thread weheh
I was beginning to suspect as much. That would have been convenient. Now I have to do a map table.

[web2py] Re: How to submit a custom form

2010-07-23 Thread mdipierro
Please show us the form and the customization. {{=form.custom.submit}} should just produce . The problem is somewhere else. On Jul 22, 6:37 pm, elfuego1 wrote: > Hi, > > I had made my custom form, but adding {{=form.custom.submit}} doesn't > let me send the form. > How should I add submit button

[web2py] Re: How to submit a custom form

2010-07-23 Thread elfuego1
Does anyone know how to do that? On 23 Lip, 01:37, elfuego1 wrote: > Hi, > > I had made my custom form, but adding {{=form.custom.submit}} doesn't > let me send the form. > How should I add submit button to the page, so I would get a default > fields validation and form submit functionallity? >

[web2py] Re: exercise of the day

2010-07-23 Thread Iceberg
By the way, I don't know how about everyone else, but I always confuse compute and virtualfield feature, and each time I need to check document to know which one is for reading from db and the other is for writing into db. How about giving an alias "onvalidation" to the feature "compute", so that

[web2py] Re: [Plugin_wiki] - Manage categories for blog pages and posts

2010-07-23 Thread Bruno Rocha
I forget... How to use `` name: categoryAdd slug: {{=request.args(0)}} categories: Page,Post,Food,Tech message: This page is under %s category(ies) showmessage: True ``:widget 2010/7/23 Bruno Rocha : > Hello, I'm migrating my blog from wordpress to web2py, and to make > this possible, I'm crea

Re: [web2py] Interesting - bpython

2010-07-23 Thread Albert Abril
Nice. I didn't know it. Seems a few better than ipython. On Fri, Jul 23, 2010 at 2:09 PM, David Marko wrote: > http://bpython-interpreter.org/

[web2py] Interesting - bpython

2010-07-23 Thread David Marko
http://bpython-interpreter.org/

[web2py] Re: Problem with TH html helpers

2010-07-23 Thread Iceberg
That is why we need "Stop pollution, protect the environment!" :-) On Jul 23, 5:16am, marcelielapointe wrote: > I finally find the problem!! > > I am doing some import in a models, in particular: > > from pylab import * > > if I comment this line everything works fine > > So It's look like i

[web2py] Re: rocket performance issues

2010-07-23 Thread Iceberg
Nice to have partial progress in 1.81.5 anyway. Congratulations. Even so, how comes an HTTP 400 error can lock Rocket? @_@ And if that is somehow really the cause, we need to prevent 400 error from /favicon.ico It is simple, add this lines into welcome scaffold's layout.html and supply a def

[web2py] mystockmodel.com

2010-07-23 Thread mdipierro
http://www.mystockmodel.com/web2py I found this. I noticed a serious security issue. If you are the author please contact me about it. Massimo

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Iceberg
In case you forget this: localhost:8000/yourapp/appadmin/ccache this page gives an overall stat about your cache On Jul 23, 6:23pm, mdipierro wrote: > correction > >   cache.ram.storage['web2py_cache_statistics']['total_hits'] > > counts total calls to cache function while > >   cache.ram.stora

Re: [web2py] Re: oauth

2010-07-23 Thread Michele Comitini
the draft: http://tools.ietf.org/html/draft-ietf-oauth-v2-10 has some dark corners, for instance and seems that facebook has some slight incompatibilities: 1) "expires" instead of "expires_in" 2) support for POST besides GET? 3) support for Basic Auth? 4) returns "application/www-url-encoded" data

Re: [web2py] Serving Static files with Space under /static/?

2010-07-23 Thread Jason Brower
It's my understanding that it is generally a bad idea. It's like going to the site... http://google.com/I have spaces.com <- That's bad! If your putting that static data there, couldn't you just ad the spaces yourself? I_add_them_when_I_dont_even_know_it. That same also applies for non english

Re: [web2py] chunks

2010-07-23 Thread Jason Brower
Is this because you have large amounts of data? When I has some work, we used TCL for the pages. TCL loads as you go. This is because back in the day webbrowsers we nasty slow and it sent the data as it came. Now-a-day we create the page remotely and then send the entire thing. If your working wi

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Adi
Ok I changed cache.ram, 0 to cache.ram, 3600 in the first query as well - I'm assuming web2py knows when something is not in cache, and has to be fetched from db. This makes the "misses" count remain static (not incrementing), and results are correct as well. On Jul 23, 3:28 pm, Adi wrote: > Nu

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Adi
Number of 'misses' is incrementing by one every time. This means cache technique is not working? On Jul 23, 3:23 pm, mdipierro wrote: > correction > >   cache.ram.storage['web2py_cache_statistics']['total_hits'] > > counts total calls to cache function while > >   cache.ram.storage['web2py_cache_

[web2py] Re: Cache query results on the server side

2010-07-23 Thread mdipierro
correction cache.ram.storage['web2py_cache_statistics']['total_hits'] counts total calls to cache function while cache.ram.storage['web2py_cache_statistics']['misses'] counts misses, i.e. result not found in cache and recomputed. I guess you want to monitor the latter. Massimo On Jul 23,

[web2py] Re: Cache query results on the server side

2010-07-23 Thread mdipierro
cache.ram.storage['web2py_cache_statistics']['total_hits'] is a counter and you can read its status before and after. Mind it will be affected by other concurrent ptocesses. On Jul 23, 5:09 am, Adi wrote: > Seems to work. One last question - how can I check if a particular > call hit the db or no

Re: [web2py] Re: Serving files which have space in filename?

2010-07-23 Thread Phyo Arkar
Thanks massimo I will try it out soon and let you know! On 7/23/10, mdipierro wrote: > If the path contains spaces, web2py replaces them with _ before > accessing the filesystem. You need to rename your files and folders > that contains ' '. This is for portability. > > On Jul 23, 4:43 am, Phyo

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Adi
Seems to work. One last question - how can I check if a particular call hit the db or not? On Jul 23, 3:03 pm, Adi wrote: > Great. That's what I was looking for - in memory filtering. Will try > and let you know! > > On Jul 23, 3:02 pm, mdipierro wrote: > > > > > No because they two queries are

[web2py] Re: Serving files which have space in filename?

2010-07-23 Thread mdipierro
In gluon main replace match = regex_static.match(regex_space.sub('_', path)) with match = re.compile('/(?P\w+)/static/(?P.*)').match(path) I cannot promise this will not introduce problems. On Jul 23, 4:58 am, Phyo Arkar wrote: > That is the problem as i cannot afford extra Performanc

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Adi
Great. That's what I was looking for - in memory filtering. Will try and let you know! On Jul 23, 3:02 pm, mdipierro wrote: > No because they two queries are different. The second query will not > find the cached results from the first and pull them again. > > You can do > > def index(): >     vi

[web2py] Re: Cache query results on the server side

2010-07-23 Thread mdipierro
One caveat, make sure you do not cache a variable that depends on use variable else you have a potential memory leak. On Jul 23, 4:52 am, Adi wrote: > Ok I'm going to bug you a little more till I understand this well > enough :) > > there are two functions in controller: > def index(): >     # he

[web2py] Re: Cache query results on the server side

2010-07-23 Thread mdipierro
No because they two queries are different. The second query will not find the cached results from the first and pull them again. You can do def index(): videos = db( myquery ).select(cache=(cache.ram,0)) # myquery is across multiple tables, with joins. def favorites(): fav_videos =db( myq

Re: [web2py] Re: Serving files which have space in filename?

2010-07-23 Thread Phyo Arkar
That is the problem as i cannot afford extra Performance. I will have to iterate over 3000+ files to rename , which will cost considerable amount of processing power plus it is Disk IO. http://localhost:8000/welcome/static/My Photo.png Is there any way to change this behavior ? As i am doing it f

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Adi
Ok I'm going to bug you a little more till I understand this well enough :) there are two functions in controller: def index(): # here I will hit database because user first comes here videos = db( myquery ).select(cache=(cache.ram,0)) # myquery is across multiple tables, with joins. def

Re: [web2py] Re: new in trunk: clone.py

2010-07-23 Thread Phyo Arkar
it is not OK, Unless website is Under Opensource Terms. Especially Graphics, They are heavily copyrighted. For example Google, I was a Unix/Linux system admin of a company website , which is a web development company. We do not copy anyone else design , we did our own , But under a page which is f

[web2py] Re: Cache query results on the server side

2010-07-23 Thread mdipierro
You place videos=db(db.video.id>0).select(cache=(cache.ram,0)) where you want the videos to be extracted from db. videos=db(db.video.id>0).select(cache=(cache.ram,3600)) everywhere you need to get the list of videos. On Jul 23, 4:38 am, Adi wrote: > But where will I place this query, for

[web2py] Re: Serving files which have space in filename?

2010-07-23 Thread mdipierro
If the path contains spaces, web2py replaces them with _ before accessing the filesystem. You need to rename your files and folders that contains ' '. This is for portability. On Jul 23, 4:43 am, Phyo Arkar wrote: > Hello Web2py. > > I guess previous post didn't go out due to mobile connection pr

[web2py] Serving files which have space in filename?

2010-07-23 Thread Phyo Arkar
Hello Web2py. I guess previous post didn't go out due to mobile connection problem. How can i serve static files which have space in filename? eg : http://localhost:8000/welcome/static/My Photo.png I am making an archive extractor which extract files over web2py and it may have files with space

[web2py] Re: Cache query results on the server side

2010-07-23 Thread Adi
But where will I place this query, for "videos" to be accessible everywhere else? On Jul 23, 2:29 pm, mdipierro wrote: > videos=db(db.video.id>0).select(cache=(cache.ram,3600)) > > 3600 are seconds and it is the cache time. If you replace the value > with 0, it will be re-computed. > > On Jul 23,

[web2py] Re: Cache query results on the server side

2010-07-23 Thread mdipierro
videos=db(db.video.id>0).select(cache=(cache.ram,3600)) 3600 are seconds and it is the cache time. If you replace the value with 0, it will be re-computed. On Jul 23, 4:13 am, Adi wrote: > Hi all, > > I have this use-case: > > There is a set of rows being queried from the database. > > videos=db

[web2py] Re: questions on groups

2010-07-23 Thread Frank
howesc, Thanks, Frank

[web2py] Cache query results on the server side

2010-07-23 Thread Adi
Hi all, I have this use-case: There is a set of rows being queried from the database. videos=db(db.video.id>0).select() Now I have three different views (in same controller) where I want to access these rows (with additional filters), but I want to prevent multiple db calls. def index():

[web2py] Re: new in trunk: clone.py

2010-07-23 Thread mdipierro
On Jul 23, 3:54 am, Ramjee Ganti wrote: > Hi *Massimo,* > > An awesome feature. I can see it can be very useful for people like me to > create good looking UI's. > > Can this be a production feature ever? Is it Ok (and here I am liking to > their resource files) to take the design from different s

Re: [web2py] new in trunk: clone.py

2010-07-23 Thread Ramjee Ganti
Hi *Massimo,* An awesome feature. I can see it can be very useful for people like me to create good looking UI's. Can this be a production feature ever? Is it Ok (and here I am liking to their resource files) to take the design from different site without their permission? rAm i Think, i Wait,

[web2py] jqgrid header caption

2010-07-23 Thread Massimiliano
Hi, I would to propose a little modify to use field.label as header caption in plugin_jqgrid: just replace the line: colnames = [x.replace('_',' ').capitalize() for x in columns] with colnames = [table[c].label or c.replace('_',' ').capitalize() for c in columns] -- Massimiliano

[web2py] Ajax works differently in IE and Firefox

2010-07-23 Thread Paul Gerrard
Hi, I have a view that displays rows of data, each of which a form that can be edited (passed in an array). Each row has (among other fields), two SELECT lists. The values displayed in the second list depend on the first. I use Ajax to refresh the second list if the first one changes. Using IE 8

[web2py] Re: questions on groups

2010-07-23 Thread howesc
Frank, the code in db.py gets executed again on the second request. since auth.id_group() returns True the auth.add_group is not called. so you need an else that sets group_id11=auth.id_group() cfh On Jul 22, 7:56 am, Frank wrote: > I get a problem, after I created a fresh new app,I only add

[web2py] Re: new in trunk: clone.py

2010-07-23 Thread mdipierro
I forgot. Before you run you must have the web2py folder in PYTHONPATH or sys.path or do export WEB2PY=/path/to/web2py/; On Jul 23, 2:41 am, mdipierro wrote: > Let's say you have a web2py application "myapp" and you want it to > look like a existing web site, for example "http://www.reddit.

[web2py] new in trunk: clone.py

2010-07-23 Thread mdipierro
Let's say you have a web2py application "myapp" and you want it to look like a existing web site, for example "http://www.reddit.com";, here is what you do from the web2py/ folder: ./scripts/clone.py -m '.tabmenu' -c '.content' -u 'http:// www.reddit.com' -o applications/myapp/views/layout.html

[web2py] [Plugin_wiki] - Manage categories for blog pages and posts

2010-07-23 Thread Bruno Rocha
Hello, I'm migrating my blog from wordpress to web2py, and to make this possible, I'm creating and testing a series of widgets in plugin_wiki. My intention is to create a blog platform to be based only on the plugin_wiki custom widgets, creating tables and defining widgets through "meta-code. I d