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:
  task.update_record(status = 'done')

-Thadeus





On Tue, Dec 29, 2009 at 1:52 AM, toomim too...@gmail.com wrote:
 sk.update_record(status == 'proce

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 installations:

Python 2.4.6
251 tests OK.
40 tests skipped:
test_aepack test_al test_applesingle test_bsddb test_bsddb185
test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_curses test_dbm test_dl test_gdbm test_gl
test_imageop test_imgfile test_linuxaudiodev test_macfs
test_macostools test_nis test_normalization test_ossaudiodev
test_pep277 test_plistlib test_rgbimg test_scriptpackages
test_socket_ssl test_socketserver test_sunaudiodev test_tcl
test_timeout test_urllib2net test_urllibnet test_winreg
test_winsound
5 skips unexpected on linux2:
test_tcl test_dbm test_bz2 test_gdbm test_bsddb

Python 2.5.4
279 tests OK.
43 tests skipped:
test_aepack test_al test_applesingle test_bsddb test_bsddb185
test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_curses test_dbm test_dl test_gdbm test_gl
test_imageop test_imgfile test_linuxaudiodev test_macfs
test_macostools test_nis test_normalization test_ossaudiodev
test_pep277 test_plistlib test_rgbimg test_scriptpackages
test_socket_ssl test_socketserver test_sqlite test_startfile
test_sunaudiodev test_tcl test_timeout test_urllib2net
test_urllibnet test_winreg test_winsound test_zipfile64
5 skips unexpected on linux2:
test_tcl test_dbm test_bz2 test_gdbm test_bsddb

Python 2.6.4
323 tests OK.
42 tests skipped:
test_aepack test_al test_applesingle test_bsddb test_bsddb185
test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_curses test_dbm test_dl test_gdbm test_gl
test_imageop test_imgfile test_kqueue test_linuxaudiodev
test_macos test_macostools test_normalization test_ossaudiodev
test_pep277 test_py3kwarn test_scriptpackages test_smtpnet
test_socketserver test_sqlite test_startfile test_sunaudiodev
test_tcl test_timeout test_urllib2net test_urllibnet test_winreg
test_winsound test_zipfile64
5 skips unexpected on linux2:
test_tcl test_dbm test_bz2 test_gdbm test_bsddb

What should I do to fix them? Just install the missing sqlite3? As you
said, sqlite seems to be installed only with the Python version of my
distribution.

On 24 déc, 22:47, mdipierro mdipie...@cs.depaul.edu wrote:
 as Yarko pointed out. We only need to look at this last line to see
 the problem is.
 Normally at startup, before you even open the browser, web2py lists
 all the db drivers it found. sqlite should be there. You will find it
 is not. If you installed it, it is possible you have different
 versions of Python and you are not running web2py with the version of
 Python that you used to install sqlite3. I suggest try to start web2py
 by specifying explicitly a version of Python.

 Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 *
from gluon.http import *
from gluon.html import TABLE
from gluon.sqlhtml import SQLFORM, SQLTABLE, form_factory
from gluon.languages import translator as T
from applications.eibport.models import db, serials_labels,
mylink, sernr_access, user_id, serialnr_form, category_labels
from gluon.tools import Auth as auth
from gluon.tools import Crud as crud
session = Session()
request = Request()
response = Response()

Still I need to keep adding things when I need them. So its kind of
ugly but it works. If anyone knows of a better solution, I'd love to
use it.

On the model I am using:
if 0:
from gluon.sql import *
from gluon.validators import *
from gluon.globals import *
from gluon.sqlhtml import SQLFORM
from gluon.html import *
from gluon.languages import translator as T
from gluon.tools import Auth as auth
request = Request()
session = Session()

Happy New Year,
Benigno.

On Dec 28, 7:32 pm, salbefe salb...@gmail.com wrote:
 Hello,

 I'm using eclipse IDE to develop an application. After reading  the
 FAQ Support Eclipse, web2py, imports, code hints and code
 completion. There it explains that to let Eclipse know about
 variables being passed into the controller at runtime, you can do the
 following

 global db
 global request
 global session
 global reqponse

 This will remove the warnings about them being undefined.

 Well, I have try to put all that code at the beginning of my controler
 but it does not work. There are a lot of variables that are undefined
 for eclipse. Could anyone that uses eclipse help me, please??

 In my opinion that FAQ about eclipse is dificult to understand for
 people that is new to eclipse and web2py.

 Thanks

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 :)

 http://sandbox.pocoo.org/clevercss/

  now only if I could integrate this into web2py 

 -Thadeus

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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
 controllers
 docs (instructions, examples)
  ..
 models
 modules
 ..
 views
 --views

it make easy install/uninstall plugins, just creating/delete the directory.

More ideias?



2009/12/29 mdipierro mdipie...@cs.depaul.edu

 I cannot find it either.

 On Dec 28, 8:51 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  Buried beyond 100's of google posts.
 
  Good Luck!
 
  There is also a screen cast on plugins at vimeo.
 
  http://www.vimeo.com/7182692
 
  The reason there is no official spec is because the system most
  likely change. In my recent efforts making plugins, it leads to a
  quite archaic design pattern for the plugins... and honestly, the
  current spec is not a plugin its a naming convention. A true
  plugin system really needs to be developed, but the reason it hasn't
  is because there is no reason for them at this point in the ballgame.
 
  So here is the spec in a nutshell.
 
  Take web2py controllers/modules/views... and append the word plugin_
  in front of the filename, database tables, etc.
 
  You now have a web2py plugin, congratulations.
 
  -Thadeus
 
  On Mon, Dec 28, 2009 at 6:29 AM, Alexandre Andrade
 
  alexandrema...@gmail.com wrote:
   where we find the not finalised plugin spec?
 
   2009/12/9 Darcy Clark d4r...@gmail.com
 
   sorry to answer my own (dumb) question . looks like the plugin
   spec isn't finalised yet, so understandably there aren't many docs
   floating around yet
 
   On Dec 9, 4:08 pm, Darcy Clark d4r...@gmail.com wrote:
where would I look if I was interested in learning how to develop
plugins for web2py ?
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group at
  http://groups.google.com/group/web2py?hl=en.
 
   --
   Atenciosamente
 
   --
   =
   Alexandre Andrade
   Hipercenter.com
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group at
  http://groups.google.com/group/web2py?hl=en.
 
 

 --

 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.





-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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

 Looking at the code, the login_url, etc... uses self.url() however the
 setttings.controller references 'default'. So when you are setting
 this in your model its already too late, and you need to set every
 single one of the url's (again).

 Is this part of the design or... ?

 -Thadeus

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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

 Why do I need to do more than just build and install Python from the
 source?

 Here are the test results for my Python installations:

 Python 2.4.6
 251 tests OK.
 40 tests skipped:
     test_aepack test_al test_applesingle test_bsddb test_bsddb185
     test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
     test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
     test_codecmaps_tw test_curses test_dbm test_dl test_gdbm test_gl
     test_imageop test_imgfile test_linuxaudiodev test_macfs
     test_macostools test_nis test_normalization test_ossaudiodev
     test_pep277 test_plistlib test_rgbimg test_scriptpackages
     test_socket_ssl test_socketserver test_sunaudiodev test_tcl
     test_timeout test_urllib2net test_urllibnet test_winreg
     test_winsound
 5 skips unexpected on linux2:
     test_tcl test_dbm test_bz2 test_gdbm test_bsddb

 Python 2.5.4
 279 tests OK.
 43 tests skipped:
     test_aepack test_al test_applesingle test_bsddb test_bsddb185
     test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
     test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
     test_codecmaps_tw test_curses test_dbm test_dl test_gdbm test_gl
     test_imageop test_imgfile test_linuxaudiodev test_macfs
     test_macostools test_nis test_normalization test_ossaudiodev
     test_pep277 test_plistlib test_rgbimg test_scriptpackages
     test_socket_ssl test_socketserver test_sqlite test_startfile
     test_sunaudiodev test_tcl test_timeout test_urllib2net
     test_urllibnet test_winreg test_winsound test_zipfile64
 5 skips unexpected on linux2:
     test_tcl test_dbm test_bz2 test_gdbm test_bsddb

 Python 2.6.4
 323 tests OK.
 42 tests skipped:
     test_aepack test_al test_applesingle test_bsddb test_bsddb185
     test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
     test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
     test_codecmaps_tw test_curses test_dbm test_dl test_gdbm test_gl
     test_imageop test_imgfile test_kqueue test_linuxaudiodev
     test_macos test_macostools test_normalization test_ossaudiodev
     test_pep277 test_py3kwarn test_scriptpackages test_smtpnet
     test_socketserver test_sqlite test_startfile test_sunaudiodev
     test_tcl test_timeout test_urllib2net test_urllibnet test_winreg
     test_winsound test_zipfile64
 5 skips unexpected on linux2:
     test_tcl test_dbm test_bz2 test_gdbm test_bsddb

 What should I do to fix them? Just install the missing sqlite3? As you
 said, sqlite seems to be installed only with the Python version of my
 distribution.

 On 24 déc, 22:47, mdipierro mdipie...@cs.depaul.edu wrote:

  as Yarko pointed out. We only need to look at this last line to see
  the problem is.
  Normally at startup, before you even open the browser, web2py lists
  all the db drivers it found. sqlite should be there. You will find it
  is not. If you installed it, it is possible you have different
  versions of Python and you are not running web2py with the version of
  Python that you used to install sqlite3. I suggest try to start web2py
  by specifying explicitly a version of Python.

  Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 uses
 (a if Condition else b), which was syntax introduced in 2.5.
 Richard

 On Nov 22, 11:12 am, pepe_eloy pepe.e...@gmail.com wrote:

  Returning to the theme about installhashlibin python 2.4,, excuse my
  ignorance, but is it possible to install these packages in a shared
  environment? (assuming I do not have root access)

  Regards

  Jose Eloy Torres



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 overhead to new directory
structure. Moreover in which order would they be executed? Whatever
you choose would not be obvious. If plugin modules where only to be
executed when plugin controllers are called then they would be
accessible by appadmin and they would have very limited functionality.
for example they would not be able to act on non-plugin modules.

A similar arguments applies to controllers. We would need special
routing rules for a plugin. Can it be done in backward compatible way?
What if there is already a controller with the same name as a plugin?

What about a plugin designed to overrides views/layout.html or views/
web2py_ajax.html or static/base.css? It would not be possible. You
would not be able to use your proposed structure to create a plugin
that applies a layout to an existing app.

I think the current plugin mechanism is more general and therefore it
is better. For me a plugin is just a subset of an app that you can
extract from an app and you can apply over an existing app. Some
plugin have files that start with plugin_... so you can avoid naming
conflicts and you know how to call them when applied.

Massimo



On Dec 29, 7:43 am, Alexandre Andrade alexandrema...@gmail.com
wrote:
 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
      controllers
      docs (instructions, examples)
       ..
      models
      modules
      ..
      views
  --views

 it make easy install/uninstall plugins, just creating/delete the directory.

 More ideias?

 2009/12/29 mdipierro mdipie...@cs.depaul.edu



  I cannot find it either.

  On Dec 28, 8:51 pm, Thadeus Burgess thade...@thadeusb.com wrote:
   Buried beyond 100's of google posts.

   Good Luck!

   There is also a screen cast on plugins at vimeo.

  http://www.vimeo.com/7182692

   The reason there is no official spec is because the system most
   likely change. In my recent efforts making plugins, it leads to a
   quite archaic design pattern for the plugins... and honestly, the
   current spec is not a plugin its a naming convention. A true
   plugin system really needs to be developed, but the reason it hasn't
   is because there is no reason for them at this point in the ballgame.

   So here is the spec in a nutshell.

   Take web2py controllers/modules/views... and append the word plugin_
   in front of the filename, database tables, etc.

   You now have a web2py plugin, congratulations.

   -Thadeus

   On Mon, Dec 28, 2009 at 6:29 AM, Alexandre Andrade

   alexandrema...@gmail.com wrote:
where we find the not finalised plugin spec?

2009/12/9 Darcy Clark d4r...@gmail.com

sorry to answer my own (dumb) question . looks like the plugin
spec isn't finalised yet, so understandably there aren't many docs
floating around yet

On Dec 9, 4:08 pm, Darcy Clark d4r...@gmail.com wrote:
 where would I look if I was interested in learning how to develop
 plugins for web2py ?

--

You received this message because you are subscribed to the Google
  Groups
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
For more options, visit this group at
   http://groups.google.com/group/web2py?hl=en.

--
Atenciosamente

--
=
Alexandre Andrade
Hipercenter.com

--

You received this message because you are subscribed to the Google
  Groups
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
For more options, visit this group at
   http://groups.google.com/group/web2py?hl=en.

  --

  You received this message because you are subscribed to the Google Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this 

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 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 subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.





-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 call last):
  File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
293, in crondance
task = parsecronline(cline)
  File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
230, in parsecronline
task['cmd'] = params[6].strip()
IndexError: list index out of range

WARNING:root:WEB2PY CRON: exception: list index out of range

Any help would be greatly appreciated.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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:

 WARNING:root:WEB2PY CRON: exception: list index out of range
 WARNING:root:Traceback (most recent call last):
   File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
 293, in crondance
     task = parsecronline(cline)
   File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
 230, in parsecronline
     task['cmd'] = params[6].strip()
 IndexError: list index out of range

 WARNING:root:WEB2PY CRON: exception: list index out of range

 Any help would be greatly appreciated.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 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 call last):
    File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
  293, in crondance
      task = parsecronline(cline)
    File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
  230, in parsecronline
      task['cmd'] = params[6].strip()
  IndexError: list index out of range

  WARNING:root:WEB2PY CRON: exception: list index out of range

  Any help would be greatly appreciated.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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

With my limited understanding of the web2py source it looks like its
only being called from web2py/gluon/widget.py from 273-302 and I'm not
seeing anything  the would disable it because of using the command
line versus the options.py file.  Not sure where to go with this.

On a seperate note are there any instructions/guides on how to use
py2exe with the web2py source?  Doesn't seem like 'python setup_exe.py
py2exe' works out of the box.

On Dec 28, 3:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 It is hard to test this for me since I do not have windows. There
 should not be a splash screen when running with -t if options.py is
 present. I would take a patch to fix this.

 On Dec 28, 2:21 pm, Delaney delaneygilli...@gmail.com wrote:

  That doesn't seem to be true if you combine with -t option.  For
  web2py.exe as well.

  On Dec 28, 11:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

   Not sure if this is what you are asking but if you run web2py.exe with
   -a 'password' there will be no splash screen. Not sure about
   web2py_no_console.exe since i do not use windows and I never tried it
   myself.

   Massimo

   On Dec 28, 1:04 pm, Delaney delaneygilli...@gmail.com wrote:

Yep, with a few more things (profiler_filename, ssl, etc) the options
file works!

On last thing.  Since this is a backend that a non-techy will run (as
the 'server' at a expo kiosk)  is there anyway to either disable or
modify the splash screen for the web2py_no_console.exe -t at
startup.  I have no problem having a 'Powered by Web2py on the splash
screen but having no control to show its 'my app' USING web2py makes
it confusing and not as finished a project.  Also would be nice to be
able to change the icon displayed as well, which I know is hardcoded
at the moment.

Any thoughts Massimo?

On Dec 28, 10:40 am, mdipierro mdipie...@cs.depaul.edu wrote:

 you need these in options.py

 extcron = None
 nocron = None

 On Dec 28, 12:20 pm, Delaney delaneygilli...@gmail.com wrote:

  Thanks... This works as a param on the command line ''' start
  web2py_no_console.exe -t -a recycle -p 80 -i 0.0.0.0 '''

  But if create a options.py with

  import socket,os
  ip = '0.0.0.0'
  port = 80
  taskbar = True
  password = 'recycle'
  folder = os.getcwd()
  server_name = socket.gethostname()

  I get...

  web2py.exe -L options.py

  default applications appear to be installed already
  web2py Enterprise Web Framework
  Created by Massimo Di Pierro, Copyright 2007-2009
  Version 1.72.3 (2009-11-10 09:17:13)
  Database drivers available: SQLite3, MySQL
  Starting cron...
  Traceback (most recent call last):
    File web2py.py, line 5, in module
    File gluon/widget.py, line 779, in start
  AttributeError: 'module' object has no attribute 'extcron'

  Note this happens with a options.py with even just 'port=80' in it.
  Is there something else I'm missing?

  On Dec 28, 9:57 am, mdipierro mdipie...@cs.depaul.edu wrote:

   If you use the built-in web server, when you start it, serve from
   0.0.0.0

   On Dec 28, 11:39 am, Delaney delaneygilli...@gmail.com wrote:

I'm using web2py for an intranet but notice that in the default 
config
web2py does not handle all requests to the port you serve from.
Basically I want to accept connections from
'localhost','127.0.0.1','whatevermyhostnameis','etc' all on say 
port
80 of the server.  I know how to set this up but can't seem to 
find
the right page explaining it in the manual.  I see on page 111 
it
talks about the 'options_std.py' file but doesn't explain if for
example you can set the ip to for example  
['127.0.0.1','192.168.0.1']
or hostname to [socket.gethostname(),'localhost']

Any help would be appreciated... Thanks!

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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. If plugin modules where only to be
executed when plugin controllers are called then they would be
accessible by appadmin and they would have very limited functionality.
for example they would not be able to act on non-plugin modules.

This is why django has...

installed_applications = [
'contrib.auth',
'my.blog',
'comments',
]

Which solves this problem. Its just one more line in db.py (or settings.py), I
already have to declare admin, why not installed_plugins = [] ?? then
web2py will go through the plugins in that order, create their models,
etc etc...

For another example, I view Auth, Crud, Mail etc... as 'plugins' that
happen to be included with web2py always
For me a plugin is just a subset of an app that you can
extract from an app and you can apply over an existing app.

I think we've been trying to get this out of you for quite some time now :)

So what you call a plugin, is not what I call/imagine a plugin.

-Thadeus





On Tue, Dec 29, 2009 at 9:40 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 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. If plugin modules where only to be
 executed when plugin controllers are called then they would be
 accessible by appadmin and they would have very limited functionality.
 for example they would not be able to act on non-plugin modules.


--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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 lower my morale :-P

Lol :) Ok ok... **I** do not like css and its flat hierarchy.

-Thadeus





On Tue, Dec 29, 2009 at 9:42 AM, Alex Fanjul alex.fan...@gmail.com wrote:
 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 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 subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.





 --
 Alejandro Fanjul Fdez.
 alex.fan...@gmail.com
 www.mhproject.org


--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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
 having the splash screen but also not the taskbar icon as well.  Task
 Manager shows the exe actually running in the background.

 With my limited understanding of the web2py source it looks like its
 only being called from web2py/gluon/widget.py from 273-302 and I'm not
 seeing anything  the would disable it because of using the command
 line versus the options.py file.  Not sure where to go with this.

 On a seperate note are there any instructions/guides on how to use
 py2exe with the web2py source?  Doesn't seem like 'python setup_exe.py
 py2exe' works out of the box.

 On Dec 28, 3:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  It is hard to test this for me since I do not have windows. There
  should not be a splash screen when running with -t if options.py is
  present. I would take a patch to fix this.

  On Dec 28, 2:21 pm, Delaney delaneygilli...@gmail.com wrote:

   That doesn't seem to be true if you combine with -t option.  For
   web2py.exe as well.

   On Dec 28, 11:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

Not sure if this is what you are asking but if you run web2py.exe with
-a 'password' there will be no splash screen. Not sure about
web2py_no_console.exe since i do not use windows and I never tried it
myself.

Massimo

On Dec 28, 1:04 pm, Delaney delaneygilli...@gmail.com wrote:

 Yep, with a few more things (profiler_filename, ssl, etc) the options
 file works!

 On last thing.  Since this is a backend that a non-techy will run (as
 the 'server' at a expo kiosk)  is there anyway to either disable or
 modify the splash screen for the web2py_no_console.exe -t at
 startup.  I have no problem having a 'Powered by Web2py on the splash
 screen but having no control to show its 'my app' USING web2py makes
 it confusing and not as finished a project.  Also would be nice to be
 able to change the icon displayed as well, which I know is hardcoded
 at the moment.

 Any thoughts Massimo?

 On Dec 28, 10:40 am, mdipierro mdipie...@cs.depaul.edu wrote:

  you need these in options.py

  extcron = None
  nocron = None

  On Dec 28, 12:20 pm, Delaney delaneygilli...@gmail.com wrote:

   Thanks... This works as a param on the command line ''' start
   web2py_no_console.exe -t -a recycle -p 80 -i 0.0.0.0 '''

   But if create a options.py with

   import socket,os
   ip = '0.0.0.0'
   port = 80
   taskbar = True
   password = 'recycle'
   folder = os.getcwd()
   server_name = socket.gethostname()

   I get...

   web2py.exe -L options.py

   default applications appear to be installed already
   web2py Enterprise Web Framework
   Created by Massimo Di Pierro, Copyright 2007-2009
   Version 1.72.3 (2009-11-10 09:17:13)
   Database drivers available: SQLite3, MySQL
   Starting cron...
   Traceback (most recent call last):
     File web2py.py, line 5, in module
     File gluon/widget.py, line 779, in start
   AttributeError: 'module' object has no attribute 'extcron'

   Note this happens with a options.py with even just 'port=80' in 
   it.
   Is there something else I'm missing?

   On Dec 28, 9:57 am, mdipierro mdipie...@cs.depaul.edu wrote:

If you use the built-in web server, when you start it, serve 
from
0.0.0.0

On Dec 28, 11:39 am, Delaney delaneygilli...@gmail.com wrote:

 I'm using web2py for an intranet but notice that in the 
 default config
 web2py does not handle all requests to the port you serve 
 from.
 Basically I want to accept connections from
 'localhost','127.0.0.1','whatevermyhostnameis','etc' all on 
 say port
 80 of the server.  I know how to set this up but can't seem 
 to find
 the right page explaining it in the manual.  I see on page 
 111 it
 talks about the 'options_std.py' file but doesn't explain if 
 for
 example you can set the ip to for example  
 ['127.0.0.1','192.168.0.1']
 or hostname to [socket.gethostname(),'localhost']

 Any help would be appreciated... Thanks!



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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 static/base.css? It would not be possible. You
would not be able to use your proposed structure to create a plugin
that applies a layout to an existing app.

Massimo, maybe we could clear up plugin system if we could distinguish 
between Plugins and Themes? where themes could be installed the same way 
but based on overrides/extend some html/views/layouts?
this way folder structure would remain:

- application
--cache
--controllers
..
--models
--modules
..
--plugins
  ---myplugin
  ---myplugin2
--views
   --themes
 ---default
--web2py_ajax.html
--...
 ---mytheme
 ---myothertheme

Just some thoughts,
Alex

El 29/12/2009 19:25, Thadeus Burgess escribió:
 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. If plugin modules where only to be
 executed when plugin controllers are called then they would be
 accessible by appadmin and they would have very limited functionality.
 for example they would not be able to act on non-plugin modules.
  
 This is why django has...

 installed_applications = [
  'contrib.auth',
  'my.blog',
  'comments',
 ]

 Which solves this problem. Its just one more line in db.py (or settings.py), I
 already have to declare admin, why not installed_plugins = [] ?? then
 web2py will go through the plugins in that order, create their models,
 etc etc...

 For another example, I view Auth, Crud, Mail etc... as 'plugins' that
 happen to be included with web2py always

 For me a plugin is just a subset of an app that you can
 extract from an app and you can apply over an existing app.
  
 I think we've been trying to get this out of you for quite some time now :)

 So what you call a plugin, is not what I call/imagine a plugin.

 -Thadeus





 On Tue, Dec 29, 2009 at 9:40 AM, mdipierromdipie...@cs.depaul.edu  wrote:

 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. If plugin modules where only to be
 executed when plugin controllers are called then they would be
 accessible by appadmin and they would have very limited functionality.
 for example they would not be able to act on non-plugin modules.

  
 --

 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.





-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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

models/plugin_generic.py

with code that does what you want (explores the plugin folder, looks
for plugins^2 declared in

current_plugins = [ ... ]

etc. etc.)

All you need to do it create a modes/plugin_generic.py and a
controllers/plugin_generic.py and within my plugin^1 system you will
be able to support your plugin^2 system. The opposite is not true.

Massimo

On Dec 29, 12:25 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 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. If plugin modules where only to be
 executed when plugin controllers are called then they would be
 accessible by appadmin and they would have very limited functionality.
 for example they would not be able to act on non-plugin modules.

 This is why django has...

 installed_applications = [
     'contrib.auth',
     'my.blog',
     'comments',
 ]

 Which solves this problem. Its just one more line in db.py (or settings.py), I
 already have to declare admin, why not installed_plugins = [] ?? then
 web2py will go through the plugins in that order, create their models,
 etc etc...

 For another example, I view Auth, Crud, Mail etc... as 'plugins' that
 happen to be included with web2py always

 For me a plugin is just a subset of an app that you can
 extract from an app and you can apply over an existing app.

 I think we've been trying to get this out of you for quite some time now :)

 So what you call a plugin, is not what I call/imagine a plugin.

 -Thadeus

 On Tue, Dec 29, 2009 at 9:40 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  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. If plugin modules where only to be
  executed when plugin controllers are called then they would be
  accessible by appadmin and they would have very limited functionality.
  for example they would not be able to act on non-plugin modules.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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]
if not gettime() == cache.ram(filename,gettime,expire): expire = 0
# now
return cache.ram(filename+':data',lambda: clevercss.convert(open
(filename,'rb').read(),{}),expire)

to retrieve it cached and processed.

On Dec 29, 12:28 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 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 lower my morale :-P

 Lol :) Ok ok... **I** do not like css and its flat hierarchy.

 -Thadeus

 On Tue, Dec 29, 2009 at 9:42 AM, Alex Fanjul alex.fan...@gmail.com wrote:
  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 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 subscribed to the Google Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

  --
  Alejandro Fanjul Fdez.
  alex.fan...@gmail.com
 www.mhproject.org



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 = db(status != 'done').select(limitby=(0,1))[0]
task.update(status = 'done')
success = do_long_thing(task)
if success:
db.commit()
else:
db.rollback()

This way if the code fires an exception, or the computer crashes, the
database will roll back to its prior state automatically.  The problem
is there is no begin statement in web2py.  All begin statements seem
to be automatic.  Is it possible to do one manually?  Can I turn off
the automatic one?

On Dec 29, 12:04 am, Thadeus Burgess thade...@thadeusb.com wrote:
 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:
       task.update_record(status = 'done')

 -Thadeus



 On Tue, Dec 29, 2009 at 1:52 AM, toomim too...@gmail.com wrote:
  sk.update_record(status == 'proce

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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
 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 uses
  (a if Condition else b), which was syntax introduced in 2.5.
  Richard

  On Nov 22, 11:12 am, pepe_eloy pepe.e...@gmail.com wrote:

   Returning to the theme about installhashlibin python 2.4,, excuse my
   ignorance, but is it possible to install these packages in a shared
   environment? (assuming I do not have root access)

   Regards

   Jose Eloy Torres

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 ? Can someone explain please?

David

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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

http://www.web2pyslices.com/main/slices/take_slice/47

2009/12/29 Richard richar...@gmail.com

 neat!


 On Dec 29, 7:45 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  I improved the function and put it athttp://
 www.web2pyslices.com/main/slices/take_slice/46
 
  Features:
 
 - links in every breadcrumb
 - can set a breadcrumb to args
 - can localize/personalize the controllers - using T()
 
  Thanks to Richard richardbp(at)gmail.com, for original function that I
  made improvements
 
  Put in your model/module:
  [image: Select]
 
  def breadcrumbs(arg_title=None):
 Create breadcrumb links for current request
 # make links pretty by capitalizing and using 'home' instead of
 'default'
 #pretty = lambda s: s.replace('default', 'Início').replace('_',
  ' ').capitalize()
 menus = [A(T('Home'), _href=URL(r=request, c='default',
 f='index'))]
 if request.controller != 'default':
 # add link to current controller
 menus.append(A(T(pretty(request.controller)),
  _href=URL(r=request, c=request.controller, f='index')))
 if request.function == 'index':
 # are at root of controller
 menus[-1] = A(T(pretty(request.controller)),
  _href=URL(r=request, c=request.controller, f=request.function))
 else:
 # are at function within controller
 menus.append(A(T(pretty(request.function)),
  _href=URL(r=request, c=request.controller, f=request.function)))
 # you can set a title putting using breadcrumbs('My Detail
 Title')
 if request.args and arg_title:
 menus.append(A(T(arg_title)), _href=URL(r=request,
  c=request.controller, f=request.function,args=[request.args]))
 else:
 #menus.append(A(pretty(request.controller),
  _href=URL(r=request, c=request.controller, f='index')))
 if request.function == 'index':
 # are at root of controller
 #menus[-1] = pretty(request.controller)
 pass
 #menus.append(A(pretty(request.controller),
  _href=URL(r=request, c=request.controller, f=request.function)))
 else:
 # are at function within controller
 menus.append(A(T(pretty(request.function)),
  _href=URL(r=request, c=request.controller, f=request.function)))
 # you can set a title putting using breadcrumbs('My Detail
 Title')
 if request.args and arg_title:
 menus.append(A(T(arg_title), _href=URL(r=request,
  f=request.function,args=[request.args])))
 
 return XML('  '.join(str(m) for m in menus))
 
  To use, put in your view:
  [image: Select]
 
   {{=breadcrumbs() }}
 
  or
  [image: Select]
 
{{=breadcrumbs('My Title for request.args ') }}
 
  
  2009/8/7 Richard richar...@gmail.com
 
 
 
 
 
 
 
   hi Alex,
 
   I am now using this automatic breadcrumb function:
 
   def breadcrumbs():
  Create breadcrumb links for current request
  # make links pretty by capitalizing and using 'home' instead of
   'default'
  pretty = lambda s: s.replace('default', 'home').replace('_', '
   ').capitalize()
  menus = [A('Home', _href=URL(r=request, c='default', f='index'))]
  if request.controller != 'default':
  # add link to current controller
  menus.append(A(pretty(request.controller), _href=URL
   (r=request, c=request.controller, f='index')))
  if request.function == 'index':
  # are at root of controller
  menus[-1] = pretty(request.controller)
  else:
  # are at function within controller
  menus.append(pretty(request.function))
  return XML('  '.join(str(m) for m in menus))
 
   Has anyone else got a system they can share?
   Richard
 
   On Aug 5, 10:48 am, Richard richar...@gmail.com wrote:
On Jul 17, 10:52 am, Alex Fanjul alex.fan...@gmail.com wrote:
 
 I agree with you Richard,
 In deed, in statusbar there is already a kind of breadcrumb but
 wihtout links...
 
 A vote for this inbuild functionallity...
 Otherwise, I bet that someone has a quick and simple idea to do
 this
 with one function and getting the information from url app,
 controller,
 function.
 
hmm, doing it automatically from the URL might work for me if I plan
it right.
Does anyone else already have their own breadcrumb system?
 
Richard
   --~--~-~--~~~---~--~~
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to 

[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 = 'done')
else:
task.update(status = 'failed')



On Dec 29, 2:10 pm, toomim too...@gmail.com wrote:
 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 = db(status != 'done').select(limitby=(0,1))[0]
         task.update(status = 'done')
         success = do_long_thing(task)
         if success:
             db.commit()
         else:
             db.rollback()

 This way if the code fires an exception, or the computer crashes, the
 database will roll back to its prior state automatically.  The problem
 is there is no begin statement in web2py.  All begin statements seem
 to be automatic.  Is it possible to do one manually?  Can I turn off
 the automatic one?

 On Dec 29, 12:04 am, Thadeus Burgess thade...@thadeusb.com wrote:

  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:
        task.update_record(status = 'done')

  -Thadeus

  On Tue, Dec 29, 2009 at 1:52 AM, toomim too...@gmail.com wrote:
   sk.update_record(status == 'proce



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 '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 ? Can someone explain please?

 David

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 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
  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 uses
   (a if Condition else b), which was syntax introduced in 2.5.
   Richard

   On Nov 22, 11:12 am, pepe_eloy pepe.e...@gmail.com wrote:

Returning to the theme about installhashlibin python 2.4,, excuse my
ignorance, but is it possible to install these packages in a shared
environment? (assuming I do not have root access)

Regards

Jose Eloy Torres



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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 parent functions, getting the 
 history of navigation or hide the own function

 http://www.web2pyslices.com/main/slices/take_slice/47

 2009/12/29 Richard richar...@gmail.com mailto:richar...@gmail.com

 neat!


 On Dec 29, 7:45 am, Alexandre Andrade alexandrema...@gmail.com
 mailto:alexandrema...@gmail.com
 wrote:
  I improved the function and put it
 athttp://www.web2pyslices.com/main/slices/take_slice/46
 http://www.web2pyslices.com/main/slices/take_slice/46
 
  Features:
 
 - links in every breadcrumb
 - can set a breadcrumb to args
 - can localize/personalize the controllers - using T()
 
  Thanks to Richard richardbp(at)gmail.com http://gmail.com,
 for original function that I
  made improvements
 
  Put in your model/module:
  [image: Select]
 
  def breadcrumbs(arg_title=None):
 Create breadcrumb links for current request
 # make links pretty by capitalizing and using 'home'
 instead of 'default'
 #pretty = lambda s: s.replace('default',
 'Início').replace('_',
  ' ').capitalize()
 menus = [A(T('Home'), _href=URL(r=request, c='default',
 f='index'))]
 if request.controller != 'default':
 # add link to current controller
 menus.append(A(T(pretty(request.controller)),
  _href=URL(r=request, c=request.controller, f='index')))
 if request.function == 'index':
 # are at root of controller
 menus[-1] = A(T(pretty(request.controller)),
  _href=URL(r=request, c=request.controller, f=request.function))
 else:
 # are at function within controller
 menus.append(A(T(pretty(request.function)),
  _href=URL(r=request, c=request.controller, f=request.function)))
 # you can set a title putting using breadcrumbs('My
 Detail Title')
 if request.args and arg_title:
 menus.append(A(T(arg_title)), _href=URL(r=request,
  c=request.controller, f=request.function,args=[request.args]))
 else:
 #menus.append(A(pretty(request.controller),
  _href=URL(r=request, c=request.controller, f='index')))
 if request.function == 'index':
 # are at root of controller
 #menus[-1] = pretty(request.controller)
 pass
 #menus.append(A(pretty(request.controller),
  _href=URL(r=request, c=request.controller, f=request.function)))
 else:
 # are at function within controller
 menus.append(A(T(pretty(request.function)),
  _href=URL(r=request, c=request.controller, f=request.function)))
 # you can set a title putting using breadcrumbs('My
 Detail Title')
 if request.args and arg_title:
 menus.append(A(T(arg_title), _href=URL(r=request,
  f=request.function,args=[request.args])))
 
 return XML('  '.join(str(m) for m in menus))
 
  To use, put in your view:
  [image: Select]
 
   {{=breadcrumbs() }}
 
  or
  [image: Select]
 
{{=breadcrumbs('My Title for request.args ') }}
 
  
  2009/8/7 Richard richar...@gmail.com mailto:richar...@gmail.com
 
 
 
 
 
 
 
   hi Alex,
 
   I am now using this automatic breadcrumb function:
 
   def breadcrumbs():
  Create breadcrumb links for current request
  # make links pretty by capitalizing and using 'home' instead of
   'default'
  pretty = lambda s: s.replace('default', 'home').replace('_', '
   ').capitalize()
  menus = [A('Home', _href=URL(r=request, c='default',
 f='index'))]
  if request.controller != 'default':
  # add link to current controller
  menus.append(A(pretty(request.controller), _href=URL
   (r=request, c=request.controller, f='index')))
  if request.function == 'index':
  # are at root of controller
  menus[-1] = pretty(request.controller)
  else:
  # are at function within controller
  menus.append(pretty(request.function))
  return XML('  '.join(str(m) for m in menus))
 
   Has anyone else got a system they can share?
   Richard
 
   On Aug 5, 10:48 am, Richard richar...@gmail.com
 mailto:richar...@gmail.com wrote:
 

[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 something different?

regards,

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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 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. If plugin modules where only to be
 executed when plugin controllers are called then they would be
 accessible by appadmin and they would have very limited functionality.
 for example they would not be able to act on non-plugin modules.

 A similar arguments applies to controllers. We would need special
 routing rules for a plugin. Can it be done in backward compatible way?
 What if there is already a controller with the same name as a plugin?

 What about a plugin designed to overrides views/layout.html or views/
 web2py_ajax.html or static/base.css? It would not be possible. You
 would not be able to use your proposed structure to create a plugin
 that applies a layout to an existing app.

 I think the current plugin mechanism is more general and therefore it
 is better. For me a plugin is just a subset of an app that you can
 extract from an app and you can apply over an existing app. Some
 plugin have files that start with plugin_... so you can avoid naming
 conflicts and you know how to call them when applied.

 Massimo



 On Dec 29, 7:43 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  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
   controllers
   docs (instructions, examples)
..
   models
   modules
   ..
   views
   --views
 
  it make easy install/uninstall plugins, just creating/delete the
 directory.
 
  More ideias?
 
  2009/12/29 mdipierro mdipie...@cs.depaul.edu
 
 
 
   I cannot find it either.
 
   On Dec 28, 8:51 pm, Thadeus Burgess thade...@thadeusb.com wrote:
Buried beyond 100's of google posts.
 
Good Luck!
 
There is also a screen cast on plugins at vimeo.
 
   http://www.vimeo.com/7182692
 
The reason there is no official spec is because the system most
likely change. In my recent efforts making plugins, it leads to a
quite archaic design pattern for the plugins... and honestly, the
current spec is not a plugin its a naming convention. A true
plugin system really needs to be developed, but the reason it hasn't
is because there is no reason for them at this point in the ballgame.
 
So here is the spec in a nutshell.
 
Take web2py controllers/modules/views... and append the word plugin_
in front of the filename, database tables, etc.
 
You now have a web2py plugin, congratulations.
 
-Thadeus
 
On Mon, Dec 28, 2009 at 6:29 AM, Alexandre Andrade
 
alexandrema...@gmail.com wrote:
 where we find the not finalised plugin spec?
 
 2009/12/9 Darcy Clark d4r...@gmail.com
 
 sorry to answer my own (dumb) question . looks like the plugin
 spec isn't finalised yet, so understandably there aren't many docs
 floating around yet
 
 On Dec 9, 4:08 pm, Darcy Clark d4r...@gmail.com wrote:
  where would I look if I was interested in learning how to
 develop
  plugins for web2py ?
 
 --
 
 You received this message because you are subscribed to the Google
   Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   .
 For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.
 
 --
 Atenciosamente
 
 --
 =
 Alexandre Andrade
 Hipercenter.com
 
 --
 
 You received this message because you are subscribed to the Google
   Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   .
 For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To 

[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
text, therefore many checks that I would normally do are skipped.

Massimo

On Dec 29, 5:01 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Ouch! You found a typo.

 This line

     def view_post(request, post_id):

 should be

     def view_post():

 I fixed it in the AlterEgo page. I hope this was the only typo. Sorry
 about this.

 On Dec 29, 4:10 pm, Jesper Mouritzen jesper.mourit...@gmail.com
 wrote:

  Hi,

  I was going through the Crash course in web2py found 
  onhttp://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 something different?

  regards,



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 fancy plugins use the shell

cd applications/yourapp
tar zcvf /somewhere/web2py.plugin.name.w2p models/plugin_name.py any/
other/file/in/folder



On Dec 29, 5:13 pm, Alexandre Andrade alexandrema...@gmail.com
wrote:
 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 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. If plugin modules where only to be
  executed when plugin controllers are called then they would be
  accessible by appadmin and they would have very limited functionality.
  for example they would not be able to act on non-plugin modules.

  A similar arguments applies to controllers. We would need special
  routing rules for a plugin. Can it be done in backward compatible way?
  What if there is already a controller with the same name as a plugin?

  What about a plugin designed to overrides views/layout.html or views/
  web2py_ajax.html or static/base.css? It would not be possible. You
  would not be able to use your proposed structure to create a plugin
  that applies a layout to an existing app.

  I think the current plugin mechanism is more general and therefore it
  is better. For me a plugin is just a subset of an app that you can
  extract from an app and you can apply over an existing app. Some
  plugin have files that start with plugin_... so you can avoid naming
  conflicts and you know how to call them when applied.

  Massimo

  On Dec 29, 7:43 am, Alexandre Andrade alexandrema...@gmail.com
  wrote:
   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
        controllers
        docs (instructions, examples)
         ..
        models
        modules
        ..
        views
    --views

   it make easy install/uninstall plugins, just creating/delete the
  directory.

   More ideias?

   2009/12/29 mdipierro mdipie...@cs.depaul.edu

I cannot find it either.

On Dec 28, 8:51 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Buried beyond 100's of google posts.

 Good Luck!

 There is also a screen cast on plugins at vimeo.

http://www.vimeo.com/7182692

 The reason there is no official spec is because the system most
 likely change. In my recent efforts making plugins, it leads to a
 quite archaic design pattern for the plugins... and honestly, the
 current spec is not a plugin its a naming convention. A true
 plugin system really needs to be developed, but the reason it hasn't
 is because there is no reason for them at this point in the ballgame.

 So here is the spec in a nutshell.

 Take web2py controllers/modules/views... and append the word plugin_
 in front of the filename, database tables, etc.

 You now have a web2py plugin, congratulations.

 -Thadeus

 On Mon, Dec 28, 2009 at 6:29 AM, Alexandre Andrade

 alexandrema...@gmail.com wrote:
  where we find the not finalised plugin spec?

  2009/12/9 Darcy Clark d4r...@gmail.com

  sorry to answer my own (dumb) question . looks like the plugin
  spec isn't finalised yet, so understandably there aren't many docs
  floating around yet

  On Dec 9, 4:08 pm, Darcy Clark d4r...@gmail.com wrote:
   where would I look if I was interested in learning how to
  develop
   plugins for web2py ?

  --

  You received this message because you are subscribed to the Google
Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com

.
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

  --
  Atenciosamente

  --
  =
  Alexandre Andrade
  Hipercenter.com

  --

  You received this message because you are subscribed to the Google

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 plugin] button that will give you the
 w2p.

 2) For more fancy plugins use the shell

 cd applications/yourapp
 tar zcvf /somewhere/web2py.plugin.name.w2p models/plugin_name.py any/
 other/file/in/folder



 On Dec 29, 5:13 pm, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  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 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. If plugin modules where only to be
   executed when plugin controllers are called then they would be
   accessible by appadmin and they would have very limited functionality.
   for example they would not be able to act on non-plugin modules.
 
   A similar arguments applies to controllers. We would need special
   routing rules for a plugin. Can it be done in backward compatible way?
   What if there is already a controller with the same name as a plugin?
 
   What about a plugin designed to overrides views/layout.html or views/
   web2py_ajax.html or static/base.css? It would not be possible. You
   would not be able to use your proposed structure to create a plugin
   that applies a layout to an existing app.
 
   I think the current plugin mechanism is more general and therefore it
   is better. For me a plugin is just a subset of an app that you can
   extract from an app and you can apply over an existing app. Some
   plugin have files that start with plugin_... so you can avoid naming
   conflicts and you know how to call them when applied.
 
   Massimo
 
   On Dec 29, 7:43 am, Alexandre Andrade alexandrema...@gmail.com
   wrote:
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
 controllers
 docs (instructions, examples)
  ..
 models
 modules
 ..
 views
 --views
 
it make easy install/uninstall plugins, just creating/delete the
   directory.
 
More ideias?
 
2009/12/29 mdipierro mdipie...@cs.depaul.edu
 
 I cannot find it either.
 
 On Dec 28, 8:51 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  Buried beyond 100's of google posts.
 
  Good Luck!
 
  There is also a screen cast on plugins at vimeo.
 
 http://www.vimeo.com/7182692
 
  The reason there is no official spec is because the system most
  likely change. In my recent efforts making plugins, it leads to a
  quite archaic design pattern for the plugins... and honestly, the
  current spec is not a plugin its a naming convention. A true
  plugin system really needs to be developed, but the reason it
 hasn't
  is because there is no reason for them at this point in the
 ballgame.
 
  So here is the spec in a nutshell.
 
  Take web2py controllers/modules/views... and append the word
 plugin_
  in front of the filename, database tables, etc.
 
  You now have a web2py plugin, congratulations.
 
  -Thadeus
 
  On Mon, Dec 28, 2009 at 6:29 AM, Alexandre Andrade
 
  alexandrema...@gmail.com wrote:
   where we find the not finalised plugin spec?
 
   2009/12/9 Darcy Clark d4r...@gmail.com
 
   sorry to answer my own (dumb) question . looks like the
 plugin
   spec isn't finalised yet, so understandably there aren't many
 docs
   floating around yet
 
   On Dec 9, 4:08 pm, Darcy Clark d4r...@gmail.com wrote:
where would I look if I was interested in learning how to
   develop
plugins for web2py ?
 
   --
 
   You received this message because you are subscribed to the
 Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 

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 group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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 compress_response(d):
if not isinstance(d,dict):  d = d()
cpat = 
re.compile(r'[\n\t\r\f\v]|(?s)\s\s\s|(?s)pre(.*?)/pre|(?s)blockquote(.*?)/blockquote|(?s)textarea(.*?)/textarea')
dd = cpat.sub(save_pre, response.render(d))
lgh = latest_guppy_heapy()
return dd

if request.controller not in ['',] \
   and request.function not in ['error','preview_markdown',
'download', 'call', 'raw_download']:
response._caller = compress_response

-Thadeus





On Tue, Dec 29, 2009 at 6:58 PM, Jonathan Lundell jlund...@pobox.com wrote:
 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 group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 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 compress_response(d):
     if not isinstance(d,dict):  d = d()
     cpat = 
 re.compile(r'[\n\t\r\f\v]|(?s)\s\s\s|(?s)pre(.*?)/pre|(?s)blockquote(.*?)/blockquote|(?s)textarea(.*?)/textarea')
     dd = cpat.sub(save_pre, response.render(d))
     lgh = latest_guppy_heapy()
     return dd

 if request.controller not in ['',] \
    and request.function not in ['error','preview_markdown',
 'download', 'call', 'raw_download']:
     response._caller = compress_response

 -Thadeus

 On Tue, Dec 29, 2009 at 6:58 PM, Jonathan Lundell jlund...@pobox.com wrote:
  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 group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




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



 On Dec 29, 8:06 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 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 compress_response(d):
     if not isinstance(d,dict):  d = d()
     cpat = 
 re.compile(r'[\n\t\r\f\v]|(?s)\s\s\s|(?s)pre(.*?)/pre|(?s)blockquote(.*?)/blockquote|(?s)textarea(.*?)/textarea')
     dd = cpat.sub(save_pre, response.render(d))
     lgh = latest_guppy_heapy()
     return dd

 if request.controller not in ['',] \
    and request.function not in ['error','preview_markdown',
 'download', 'call', 'raw_download']:
     response._caller = compress_response

 -Thadeus

 On Tue, Dec 29, 2009 at 6:58 PM, Jonathan Lundell jlund...@pobox.com wrote:
  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 group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.



 --

 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 too...@gmail.com wrote:
 Mossimo, unfortunately this proposal does not solve the multi-
 threading problem.

 Can you tell me what the semantics of the implicit begin is?  The
 problem is that I do not know where begin is inserted.  I thought it
 happened at the beginning of every controller function call.  That
 would make it impossible to do multiple transactions (with multiple
 begins) inside a single function.  Is that assumption incorrect?

 On Dec 29, 1:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  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 = 'done')
          else:
              task.update(status = 'failed')

  On Dec 29, 2:10 pm, toomim too...@gmail.com wrote:

   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 = db(status != 'done').select(limitby=(0,1))[0]
           task.update(status = 'done')
           success = do_long_thing(task)
           if success:
               db.commit()
           else:
               db.rollback()

   This way if the code fires an exception, or the computer crashes, the
   database will roll back to its prior state automatically.  The problem
   is there is no begin statement in web2py.  All begin statements seem
   to be automatic.  Is it possible to do one manually?  Can I turn off
   the automatic one?

   On Dec 29, 12:04 am, Thadeus Burgess thade...@thadeusb.com wrote:

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:
      task.update_record(status = 'done')

-Thadeus

On Tue, Dec 29, 2009 at 1:52 AM, toomim too...@gmail.com wrote:
 sk.update_record(status == 'proce



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 the error I'm getting when there is a validator like
@auth.requires_permission('xyz')

Traceback (most recent call last):
  File web2py.py, line 20, in module
gluon.widget.start(cron=True)
  File /home/www-data/web2py/gluon/widget.py, line 743, in start
import_models=options.import_models, startfile=options.run)
  File /home/www-data/web2py/gluon/shell.py, line 163, in run
exec ('print %s()' % f, _env)
  File string, line 1, in module
  File /home/www-data/web2py/gluon/tools.py, line 1688, in f
redirect(self.settings.login_url + '?_next='+urllib.quote(next))
  File /home/www-data/web2py/gluon/http.py, line 104, in redirect
Location=location)
gluon.http.HTTP


On Dec 29, 11:05 pm, vvk varunk.ap...@gmail.com wrote:
 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 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 call last):
     File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
   293, in crondance
       task = parsecronline(cline)
     File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
   230, in parsecronline
       task['cmd'] = params[6].strip()
   IndexError: list index out of range

   WARNING:root:WEB2PY CRON: exception: list index out of range

   Any help would be greatly appreciated.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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) When my controller function calls commit, how do I get another
begin to make a new transaction?


On Dec 29, 7:18 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 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 too...@gmail.com wrote:



  Mossimo, unfortunately this proposal does not solve the multi-
  threading problem.

  Can you tell me what the semantics of the implicit begin is?  The
  problem is that I do not know where begin is inserted.  I thought it
  happened at the beginning of every controller function call.  That
  would make it impossible to do multiple transactions (with multiple
  begins) inside a single function.  Is that assumption incorrect?

  On Dec 29, 1:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   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 = 'done')
           else:
               task.update(status = 'failed')

   On Dec 29, 2:10 pm, toomim too...@gmail.com wrote:

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 = db(status != 'done').select(limitby=(0,1))[0]
        task.update(status = 'done')
        success = do_long_thing(task)
        if success:
            db.commit()
        else:
            db.rollback()

This way if the code fires an exception, or the computer crashes, the
database will roll back to its prior state automatically.  The problem
is there is no begin statement in web2py.  All begin statements seem
to be automatic.  Is it possible to do one manually?  Can I turn off
the automatic one?

On Dec 29, 12:04 am, Thadeus Burgess thade...@thadeusb.com wrote:

 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:
       task.update_record(status = 'done')

 -Thadeus

 On Tue, Dec 29, 2009 at 1:52 AM, toomim too...@gmail.com wrote:
  sk.update_record(status == 'proce

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 gluon/sql.py, line 1249, in define_table
t._create(migrate=migrate, fake_migrate=fake_migrate)
  File gluon/sql.py, line 1600, in _create
(field.type, field.name)
SyntaxError: Field: unknown field type: string for network



In file: /home/web2py/applications/test/models/db.py

from gluon.dal import SQLCustomType

inet = SQLCustomType ( type='string', native='inet')

cidr = SQLCustomType ( type='string', native='cidr')

macaddr = SQLCustomType ( type='string', native='macaddr')

db = DAL('postgres://web2py:web...@localhost/test1', pool_size=10)

db.define_table('firewall',
SQLField('network',type=cidr))

On Dec 25, 9:15 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 yes this is definitively possible. I would try

         inet = SQLCustomType
 (
             type
 ='string',
             native
 ='inet'))

         db.define_table
 (

 'example',
             Field('value',
 type=inet)
             )

 Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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, 'Field: unknown field type: %s for %s' % \
(field.type, field.name)

You get error on the last line but given the code you show me, it
should never get there. The first if should be true because field.type
should be cidr which is SQLCustomType.

Try add some print statements and see what happens.

On Dec 29, 10:35 pm, KMax mkostri...@gmail.com wrote:
 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 gluon/sql.py, line 1249, in define_table
     t._create(migrate=migrate, fake_migrate=fake_migrate)
   File gluon/sql.py, line 1600, in _create
     (field.type, field.name)
 SyntaxError: Field: unknown field type: string for network

 In file: /home/web2py/applications/test/models/db.py

 from gluon.dal import SQLCustomType

 inet = SQLCustomType ( type='string', native='inet')

 cidr = SQLCustomType ( type='string', native='cidr')

 macaddr = SQLCustomType ( type='string', native='macaddr')

 db = DAL('postgres://web2py:web...@localhost/test1', pool_size=10)

 db.define_table('firewall',
     SQLField('network',type=cidr))

 On Dec 25, 9:15 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  yes this is definitively possible. I would try

          inet = SQLCustomType
  (
              type
  ='string',
              native
  ='inet'))

          db.define_table
  (

  'example',
              Field('value',
  type=inet)
              )

  Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 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 the error I'm getting when there is a validator like
 @auth.requires_permission('xyz')

 Traceback (most recent call last):
   File web2py.py, line 20, in module
     gluon.widget.start(cron=True)
   File /home/www-data/web2py/gluon/widget.py, line 743, in start
     import_models=options.import_models, startfile=options.run)
   File /home/www-data/web2py/gluon/shell.py, line 163, in run
     exec ('print %s()' % f, _env)
   File string, line 1, in module
   File /home/www-data/web2py/gluon/tools.py, line 1688, in f
     redirect(self.settings.login_url + '?_next='+urllib.quote(next))
   File /home/www-data/web2py/gluon/http.py, line 104, in redirect
     Location=location)
 gluon.http.HTTP

 On Dec 29, 11:05 pm, vvk varunk.ap...@gmail.com wrote:

  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 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 call last):
  File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
293, in crondance
    task = parsecronline(cline)
  File /Users/varun/Downloads/web2py/gluon/contrib/cron.py, line
230, in parsecronline
    task['cmd'] = params[6].strip()
IndexError: list index out of range

WARNING:root:WEB2PY CRON: exception: list index out of range

Any help would be greatly appreciated.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 of a COMMIT
Statement or ROLLBACK Statement completes the current transaction. A
subsequent SQL-Data statement starts a new transaction.





On Dec 29, 9:31 pm, toomim too...@gmail.com wrote:
 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) When my controller function calls commit, how do I get another
 begin to make a new transaction?

 On Dec 29, 7:18 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  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 too...@gmail.com wrote:

   Mossimo, unfortunately this proposal does not solve the multi-
   threading problem.

   Can you tell me what the semantics of the implicit begin is?  The
   problem is that I do not know where begin is inserted.  I thought it
   happened at the beginning of every controller function call.  That
   would make it impossible to do multiple transactions (with multiple
   begins) inside a single function.  Is that assumption incorrect?

   On Dec 29, 1:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:

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 = 'done')
        else:
            task.update(status = 'failed')

On Dec 29, 2:10 pm, toomim too...@gmail.com wrote:

 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 = db(status != 'done').select(limitby=(0,1))[0]
         task.update(status = 'done')
         success = do_long_thing(task)
         if success:
             db.commit()
         else:
             db.rollback()

 This way if the code fires an exception, or the computer crashes, the
 database will roll back to its prior state automatically.  The problem
 is there is no begin statement in web2py.  All begin statements seem
 to be automatic.  Is it possible to do one manually?  Can I turn off
 the automatic one?

 On Dec 29, 12:04 am, Thadeus Burgess thade...@thadeusb.com wrote:

  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:
        task.update_record(status = 'done')

  -Thadeus

  On Tue, Dec 29, 2009 at 1:52 AM, toomim too...@gmail.com wrote:
   sk.update_record(status == 'proce



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 process
that continues executing even when that user signs off.

when a user performs an event, then after a set period of time (say
two days) then an email is automatically sent to a specified e-mail
address that happens even if the user that triggers the event no
longer has an active session on the server side.

I am attempting to build an auction application in the web2py
framework and would be interested in learning a tecqnique of starting
(and stopping) persistent server-side background processes.

Much thanks

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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'])
db(db.person.names=='Massimo').select()

Basically you can put any native type as a web2py type just put it in
a string and start it with a '.'. You can also pass arguments this
way.

It is ugly but works.  It is ugly because I'd rather pass an object
than a string. It works because a type has to be a string. It is
experimental because when the new DAL comes this should be replaced by
a better API. This will not stay backward compatible.

Massimo


--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 mdipie...@cs.depaul.edu wrote:
 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 '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 ? Can someone explain please?

  David

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[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 import SQLCustomType
was not good idea.
BUT
Inserting or updating using web2py db admin
Shows following:
---
Traceback (most recent call last):
  File gluon/restricted.py, line 173, in restricted
exec ccode in environment
  File /home/web2py/applications/test/controllers/appadmin.py, line
304, in module
  File gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File /home/web2py/applications/test/controllers/appadmin.py, line
286, in update
if form.accepts(request.vars, session):
  File gluon/sqlhtml.py, line 896, in accepts
self.table._db(self.table.id == self.record.id).update(**fields)
  File gluon/sql.py, line 3151, in update
self._db._execute(query)
  File gluon/sql.py, line 952, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: syntax error at or near .3
LINE 1: UPDATE firewall SET network=1.2.3.5 WHERE firewall.id=1;
===
Traceback (most recent call last):
  File gluon/restricted.py, line 173, in restricted
exec ccode in environment
  File /home/web2py/applications/test/controllers/appadmin.py, line
304, in module
  File gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File /home/web2py/applications/test/controllers/appadmin.py, line
124, in insert
if form.accepts(request.vars, session):
  File gluon/sqlhtml.py, line 898, in accepts
self.vars.id = self.table.insert(**fields)
  File gluon/sql.py, line 1844, in insert
self._db._execute(query)
  File gluon/sql.py, line 952, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: syntax error at or near .1
LINE 1: INSERT INTO firewall(network) VALUES (1.1.1.2);

Thank you for your helping
On Dec 30, 12:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 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, 'Field: unknown field type: %s for %s' % \
                     (field.type, field.name)

 You get error on the last line but given the code you show me, it
 should never get there. The first if should be true because field.type
 should be cidr which is SQLCustomType.

 Try add some print statements and see what happens.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.