Re: [web2py:37998] Re: how to safely process a big queue?

2009-12-29 Thread Thadeus Burgess
Ah yes, so back to my original thought db(status == 'pending').update(status = 'pending-' + request.now) for db(status == 'pending-' + request.now).select(): task.update_record(status = 'processing-' + request.now success = do_the_long_thing(task) fail if success:

[web2py:37999] CleverCSS

2009-12-29 Thread Thadeus Burgess
Just letting everyone know about this... This is AWESOME. As a programmer, I don't like css... but this makes css that much more bearable :) http://sandbox.pocoo.org/clevercss/ now only if I could integrate this into web2py -Thadeus -- You received this message because you are

[web2py:38000] Re: Error at startup of Web2Py

2009-12-29 Thread pierreth
OK, It works perfectly well using the Python version of my distribution. :-) I wanted to install version 2.4, 2.5, 2.6 of Python to test my code and later contribute to Web2Py. Why do I need to do more than just build and install Python from the source? Here are the test results for my Python

[web2py:38001] Re: Let Eclipse know about variables being passed into the controller at runtime

2009-12-29 Thread Benigno
I never got the global thing to work, there is another article somewhere (cant remember maybe at slices) that tells of a different option by using a conditional at the begining of your controllers. I am using the following now: if 0: from gluon.globals import * from gluon.html import *

[web2py:38002] Re: CleverCSS

2009-12-29 Thread Mengu
what's the problem with integrating it into web2py? On Dec 29, 10:31 am, Thadeus Burgess thade...@thadeusb.com wrote: Just letting everyone know about this... This is AWESOME. As a programmer, I don't like css... but this makes css that much more bearable :)

Re: [web2py:38003] Re: plugin development notes/docs ?

2009-12-29 Thread Alexandre Andrade
Sugestion: I think that a better spec would be a directory to plugins, with a diretory for the plugin, and a application-like struture. So web2py read it as read application directory. - application --cache --controllers .. --models --modules .. --plugins ---myplugin cache

[web2py:38005] Re: auth.settings.controller

2009-12-29 Thread mdipierro
It is a bug. On Dec 28, 11:54 pm, Thadeus Burgess thade...@thadeusb.com wrote: When I set auth.settings.controller = 'admin' Shouldn't it then default to that? When I request an action that requries login, it takes me tohttp://127/init/default/user/loginwhich is... well wrong.

[web2py:38006] Re: Error at startup of Web2Py

2009-12-29 Thread mdipierro
I think you need both sqlite3 and (optional) tkinter On Dec 29, 3:12 am, pierreth pierre.thibau...@gmail.com wrote: OK, It works perfectly well using the Python version of my distribution. :-) I wanted to install version 2.4, 2.5, 2.6 of Python to test my code and later contribute to

[web2py:38007] Re: web2py and python 2.4

2009-12-29 Thread mdipierro
web2py libraries does not use (a if Condition else b) but example apps and plugins may. It works with 2.4 but you need some extra modules. There is an AlterEgo entry about this. On Dec 29, 7:48 am, Richard richar...@gmail.com wrote: did you manage to get web2py running with 2.4? I noticed

[web2py:38009] Re: plugin development notes/docs ?

2009-12-29 Thread mdipierro
This was discussed. I did not rule it out but now as then I have to point out that things are more complex than it seems. If plugins have models in their own folder, then should all models be executed when a non-plugin controller is called, including plugin models? If so, there would be a lot

Re: [web2py:38010] CleverCSS

2009-12-29 Thread Alex Fanjul
As a programmer??? But if Blogitizer has the shiny and cleaner interface I could see in web2py... thanks for lower my morale :-P Alex El 29/12/2009 9:31, Thadeus Burgess escribió: Just letting everyone know about this... This is AWESOME. As a programmer, I don't like css... but this makes css

[web2py:38011] Cron error

2009-12-29 Thread vvk
Hi, I'm getting an error for putting cron in default welcome application which came with web2py 1.74.4 src code I edited crontab file in welcome application as: 0-59/1 * * * * *default/index Error: WARNING:root:WEB2PY CRON: exception: list index out of range WARNING:root:Traceback (most recent

[web2py:38012] Re: Cron error

2009-12-29 Thread mdipierro
0-59/1 * * * * user *default/index On Dec 29, 11:55 am, vvk varunk.ap...@gmail.com wrote: Hi, I'm getting an error for putting cron in default welcome application which came with web2py 1.74.4 src code I edited crontab file in welcome application as: 0-59/1 * * * * *default/index Error:

[web2py:38013] Re: Cron error

2009-12-29 Thread vvk
Thanks sir, it's working now. On Dec 29, 10:57 pm, mdipierro mdipie...@cs.depaul.edu wrote: 0-59/1 * * * * user *default/index On Dec 29, 11:55 am, vvk varunk.ap...@gmail.com wrote: Hi, I'm getting an error for putting cron in default welcome application which came with web2py 1.74.4

[web2py:38014] Re: Standalone Web2py that accepts all request on a given port.

2009-12-29 Thread Delaney
My testing show that having a taskbar=True in the options.py results in the splash screen and the taskbar icon However using 'web2py_no_console.exe -t -L options.py ' results in not having the splash screen but also not the taskbar icon as well. Task Manager shows the exe actually running in the

Re: [web2py:38015] Re: plugin development notes/docs ?

2009-12-29 Thread Thadeus Burgess
If plugins have models in their own folder, then should all models be executed when a non-plugin controller is called, including plugin models? If so, there would be a lot overhead to new directory structure. Moreover in which order would they be executed? Whatever you choose would not be obvious.

Re: [web2py:38016] CleverCSS

2009-12-29 Thread Thadeus Burgess
I mean integrate into web2py in that it will generate new css files if the clevercss file has changed on the next pass through... its just some glue code in a model to make it happen. As a programmer??? But if Blogitizer has the shiny and cleaner interface I could see in web2py... thanks for

[web2py:38017] Re: Standalone Web2py that accepts all request on a given port.

2009-12-29 Thread mdipierro
Let me look more into this and think about it. On Dec 29, 12:23 pm, Delaney delaneygilli...@gmail.com wrote: My testing show that having a taskbar=True in the options.py results in the splash screen and the taskbar icon However using 'web2py_no_console.exe -t -L options.py ' results in not

Re: [web2py:37680] Re: plugin development notes/docs ?

2009-12-29 Thread Alex Fanjul
I think I agree with Thadeus in his exposition, this way we could implement a quickly module setup page for applications where you can choose install uninstall modules inside applications. Another thing: What about a plugin designed to overrides views/layout.html or views/ web2py_ajax.html or

[web2py:38019] Re: plugin development notes/docs ?

2009-12-29 Thread mdipierro
I agree that what I call a plugin^1 is not what other people call a plugin^2. Within the current system you can already create a plugins/ subfolder and put stuff in there as Alexandre and others have proposed. They would not be visible by web2py but you could create a special model

[web2py:38020] Re: CleverCSS

2009-12-29 Thread mdipierro
You can just put your clevercss in private/style.clevercss and use a controller like this: def style(): import os, stat, clevercss expire = 10**10 # never filename = os.path.join (request.folder,'private','style.clevercss') def gettime(): return os.stat(filename)[stat.ST_SIZE]

[web2py:38021] Re: how to safely process a big queue?

2009-12-29 Thread toomim
Very clever, thank you! If it crashes, these items will be lost though. Is there a way to use transactions, to pull a single item at a time from the table, process and delete it, within a single transaction? Something like this: while queue is not empty: db.begin() task =

[web2py:38023] Re: web2py and python 2.4

2009-12-29 Thread Richard
I think there are a few examples in sql.py, such as lines 2928 and 2939 On Dec 30, 1:53 am, mdipierro mdipie...@cs.depaul.edu wrote: web2py libraries does not use (a if Condition else b) but example apps and plugins may. It works with 2.4 but you need some extra modules. There is an

[web2py:38024] How the 'auth.settings.allow_basic_login = True' works like?

2009-12-29 Thread David Marko
How the settings 'auth.settings.allow_basic_login = True' is supposed to work? I tried to login to protected method('@auth.requires_login ()') via basic auth, but was not succesfull. Is there some additional setting for protected methods or '@auth.requires_login()'' is simply used for both auth ?

Re: [web2py:38025] Re: breadcrumb design

2009-12-29 Thread Alexandre Andrade
I make a new version, Full Breadcrumb for applications that use nested functions, where you want the user pass by a function first to go to another, so you can set the parent functions, getting the history of navigation or hide the own function

[web2py:38026] Re: how to safely process a big queue?

2009-12-29 Thread mdipierro
Attention. There is no db.begin(). it is implicit. You can commit automatically but why not: while queue is not empty: task = db(~status.belongs(('done','failed'))).select(limitby= (0,1))[0] success = do_long_thing(task) if success: task.update(status =

[web2py:38027] Re: How the 'auth.settings.allow_basic_login = True' works like?

2009-12-29 Thread mdipierro
The allow basic login allows you to call functions that @auth.requires_login() by passing the credential using basic auth for example call the url using wget and curl. How are you using it? On Dec 29, 2:59 pm, David Marko dma...@tiscali.cz wrote: How the settings

[web2py:38028] Re: web2py and python 2.4

2009-12-29 Thread mdipierro
Ouch! You are right. That code slipped in. I have just removed them in trunk (hg only, I am having problem posting on launchpad) and will repost 1.74.5 later this week. Massimo On Dec 29, 2:59 pm, Richard richar...@gmail.com wrote: I think there are a few examples in sql.py, such as lines 2928

Re: [web2py:38029] Re: breadcrumb design

2009-12-29 Thread Alex Fanjul
Sorry I don't understand you, could you put an example please? Alex F El 29/12/2009 22:14, Alexandre Andrade escribió: I make a new version, Full Breadcrumb for applications that use nested functions, where you want the user pass by a function first to go to another, so you can set the

[web2py:38030] Invalid function in Crash course

2009-12-29 Thread Jesper Mouritzen
Hi, I was going through the Crash course in web2py found on http://www.web2py.com/AlterEgo/default/show/253/1. After the Adding Views part I get a invalid function message when clicking on a blog post and I was wondering what lies beneath this error. Is invalid function covering for a 404 or

Re: [web2py:38032] Re: plugin development notes/docs ?

2009-12-29 Thread Alexandre Andrade
I want to know how create a w2p file of plugin, like in themes.w2p 2009/12/29 mdipierro mdipie...@cs.depaul.edu This was discussed. I did not rule it out but now as then I have to point out that things are more complex than it seems. If plugins have models in their own folder, then should

[web2py:38033] Re: Invalid function in Crash course

2009-12-29 Thread mdipierro
Actually I did found a couple of more typos in the code example and I have fixed them now. Also it is important that before you create posts using appadmin, you create an account and login in your application, else the posts have no author. This was designed to mimic the Django app referenced in

[web2py:38034] Re: plugin development notes/docs ?

2009-12-29 Thread mdipierro
There are two ways. 1) In admin if you create a model or controller called plugin_somrthing.py you will se at the bottom of the edit page a plugin item already created for you. Click on it and you get to the plugin page. There is a [pack plugin] button that will give you the w2p. 2) For more

Re: [web2py:38035] Re: plugin development notes/docs ?

2009-12-29 Thread Alexandre Andrade
thanks 2009/12/29 mdipierro mdipie...@cs.depaul.edu There are two ways. 1) In admin if you create a model or controller called plugin_somrthing.py you will se at the bottom of the edit page a plugin item already created for you. Click on it and you get to the plugin page. There is a [pack

Re: [web2py:38036] Re: Excess whitespace in html

2009-12-29 Thread Jonathan Lundell
On Dec 15, 2009, at 3:23 PM, mdipierro wrote: You may also want to look into scripts/cleanhtml.py and scripts/ cleancss.py. cleanhtml.py would benefit from some comments -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this

Re: [web2py:38037] Re: how to safely process a big queue?

2009-12-29 Thread Thadeus Burgess
Does .update_record() call a db.commit()? -Thadeus On Tue, Dec 29, 2009 at 2:10 PM, toomim too...@gmail.com wrote:        if success:            db.commit()        else:            db.rollback() -- You received this message because you are subscribed to the Google Groups

Re: [web2py:38038] Re: Excess whitespace in html

2009-12-29 Thread Thadeus Burgess
Currently I am using the following, works perfect for my applications... import re def save_pre(match): s = match.group() if s.startswith('pre') \ or s.startswith('textarea') \ or s.startswith('blockquote'): pass else: s = '' return s def

[web2py:38041] Re: Excess whitespace in html

2009-12-29 Thread mdipierro
You can also do: def compress_response(d): if not isinstance(d,dict): return d import scripts.cleanhtml return scripts.cleanhtml.cleanhtml(response.render(d)) On Dec 29, 8:06 pm, Thadeus Burgess thade...@thadeusb.com wrote: Currently I am using the following, works perfect for my

Re: [web2py:38042] Re: Excess whitespace in html

2009-12-29 Thread Thadeus Burgess
Mine compresses it all to one line. -Thadeus On Tue, Dec 29, 2009 at 9:15 PM, mdipierro mdipie...@cs.depaul.edu wrote: You can also do: def compress_response(d):    if not isinstance(d,dict): return d    import scripts.cleanhtml    return scripts.cleanhtml.cleanhtml(response.render(d))

[web2py:38043] Re: how to safely process a big queue?

2009-12-29 Thread mdipierro
A transaction starts when a request arrive and it is committed when a request returns. If there is an error that it not caught the transaction is rolledback. You can insert db.commit() (and db.rollback()) everywhere to break the transaction in smaller parts. Massimo On Dec 29, 8:54 pm, toomim

[web2py:38044] Re: Cron error

2009-12-29 Thread vvk
Hi sir, Cron job function in my application is working only when there is no validator for that function. My function: @auth.requires_permision('xyz') def takebackup(): Is there a way to put a validator for that function because if there is no validator, any one can run backup function. This is

[web2py:38045] Re: how to safely process a big queue?

2009-12-29 Thread toomim
Thank you. So you are saying that each request basically does: sql BEGIN ... call appropriate controller function ... sql COMMIT if success What I do not understand is: 1) When called from cron, there is no automatic begin transaction, so where does the begin come from? 2)

[web2py:38046] Re: Postgresql-types limited by web2py :(

2009-12-29 Thread KMax
Please advise. Error traceback Traceback (most recent call last): File gluon/restricted.py, line 173, in restricted exec ccode in environment File /home/web2py/applications/test/models/db.py, line 12, in module SQLField('network',type=cidr)) File

[web2py:38047] Re: Postgresql-types limited by web2py :(

2009-12-29 Thread mdipierro
I need your help debugging this... the relevant code in sql.py is if isinstance(field.type,SQLCustomType): ftype = field.type.native or field.type.type elif ... elif not field.type in self._db._translator: raise SyntaxError,

[web2py:38048] Re: Cron error

2009-12-29 Thread mdipierro
You are referring to the auth decorator. Try this: @auth.requires(not request.env.remote_addr or auth.has_permission ('xyz')) def takebackup(): When the request comes from cron there is no request.env.remote_addr On Dec 29, 9:29 pm, vvk varunk.ap...@gmail.com wrote: Hi sir, Cron job

[web2py:38049] Re: how to safely process a big queue?

2009-12-29 Thread mdipierro
From: http://www.firstsql.com/tutor5.htm In SQL92, there is no BEGIN TRANSACTION statement. A transaction begins with the execution of a SQL-Data statement when there is no current transaction. All subsequent SQL-Data statements until COMMIT or ROLLBACK become part of the transaction. Execution

[web2py:38050] persistent background process

2009-12-29 Thread Auden RovelleQuartz
any simple example on how to create a persistent background process that runs continuously on the server side no matter what user signs in or out, and no matter how many concurrent users are on the system? Here are a couple of examples: when a user performs an event, it kicks off a server side

[web2py:38051] Experimental in trunk: GAE StringListProperty

2009-12-29 Thread mdipierro
There are many GAE types that one may want to use. Today I needed StringListProperty so I extended the web2py GAE apy so that you can have a field of type db.define_table('person',Field('names','.StringListProperty()')) and you can do db.person.insert(names=['Massimo','Max'])

[web2py:38052] Re: How the 'auth.settings.allow_basic_login = True' works like?

2009-12-29 Thread David Marko
I simply tried to call the method with URLcontaining the username/ password. e.g. tttp://username:p...@localhost:8080/ . Its just internal call so its fine that username/pwd is in URL. I simply tried this in browser, but login form apeared instead. David On Dec 29, 10:25 pm, mdipierro

[web2py:38054] Re: Postgresql-types limited by web2py :(

2009-12-29 Thread KMax
This code start to work === from gluon.sql import SQLCustomType db = DAL('postgres://web2py:gfhj...@db.sibnet.su/test1', pool_size=10) inet = SQLCustomType ( type='string',native='inet') db.define_table('firewall', SQLField('network',type=inet)) === Look like ==from gluon.dal