[web2py] how to extend view

2011-06-20 Thread Canhua Chen
hi, I want the body of all html pages to be base64 encoded before sending 
to the clients, how do I do it ? Can I extend the view syntax or add 
something middleware-like ? thanks.

Re: [web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread Pierre Thibault
2011/6/20 weheh richard_gor...@verizon.net

 Hi Pierre, I've read your excellent pages and followed your
 instructions before, to good effect. Of course, the downside is that
 one ends up with a lot of junk code in the beginning of one's files. I
 was under the impression that the latest version of web2py bypassed
 all that with a simple 1-liner: from gluon import *  but this doesn't
 seem to be the case as it doesn't work for me. Hence, my question and
 this thread. Thanks for the quick response!



Thank you Weheh. This is the best solution I know for working with Pydev and
web2py. Definitively not perfect.

The good news is that it seems that the Pydev team is working on something
to improve the support of web2py:
http://groups.google.com/group/web2py/browse_thread/thread/38784ca3ebf3bbb0/aeded9d3cab7c468?lnk=gstq=pydev#aeded9d3cab7c468

We can hope for the best.


-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: plugins

2011-06-20 Thread José L .
selecta, the downloads from 
http://pymantis.org/pymantis_server/plugin_release/download don't work in 
any of its versions.
Do you have some control version system where I could take a look to these 
plugins?

Thanks.


[web2py] email alert in cron

2011-06-20 Thread Manuele Pesenti

Dear all,
there could be some reason why a controller called by cron is executed 
except the command mail.send? Perhaps does it require a logged user? 
moreover no error ticket about it is listed in errors but no mail is 
send by function... any suggestion about it?


thanks a lot

Manuele


Re: [web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread Anthony
Massimo suggested this recently: 
https://groups.google.com/d/msg/web2py/z-ckQANc9PY/-tGhBE6oxYMJ

On Monday, June 20, 2011 2:14:47 AM UTC-4, Pierre Thibault wrote:

 2011/6/20 weheh richard...@verizon.net

 Hi Pierre, I've read your excellent pages and followed your
 instructions before, to good effect. Of course, the downside is that
 one ends up with a lot of junk code in the beginning of one's files. I
 was under the impression that the latest version of web2py bypassed
 all that with a simple 1-liner: from gluon import *  but this doesn't
 seem to be the case as it doesn't work for me. Hence, my question and
 this thread. Thanks for the quick response!



 Thank you Weheh. This is the best solution I know for working with Pydev 
 and web2py. Definitively not perfect.

 The good news is that it seems that the Pydev team is working on something 
 to improve the support of web2py: 
 http://groups.google.com/group/web2py/browse_thread/thread/38784ca3ebf3bbb0/aeded9d3cab7c468?lnk=gstq=pydev#aeded9d3cab7c468

 We can hope for the best.


 -- 


 A+

 -
 Pierre
 My blog and profile 
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2



Re: [web2py] problem with using powertable in components

2011-06-20 Thread Bruno Rocha
I will take a look in to it ASAP, can you share more code? or send your .w2p
?

datatables.net is the core od PowerTable, as it is Javscript could be some
name conflict that I need to solve.

I am planniing to check, test and release the new optimized  version that I
have here.



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]



On Sun, Jun 19, 2011 at 3:55 PM, apple simo...@gmail.com wrote:

 Just started using powertables. This is a brilliant tool and works
 fantastically in most cases. However I have had a problem trying to
 load two powertables on a page within components. It seems to show the
 two tables correctly but then renders a bunch of extra tables that are
 empty and misformatted. If I refresh the screen it also shows an error
 warning about not being able to reinitialize the table.

 # html view is:

 {{extend 'layout.html'}}
 link rel=stylesheet type=text/css href=/{{=request.application}}/
 static/css/{{=request.application}}.css /

 {{=LOAD(f=list, extension=load, ajax=True,
 vars=dict(table=customer))}}
 {{=LOAD(f=list, extension=load, ajax=True,
 vars=dict(table=todo))}}

 # load view is:

 {{include 'web2py_ajax.html'}}
 link rel=stylesheet type=text/css href=/{{=request.application}}/
 static/css/base.css /
 link rel=stylesheet type=text/css href=/{{=request.application}}/
 static/css/{{=request.application}}.css /

 div
{{=result}}
 /div
  controller just returns a basic table. no fancy hidden
 columns or anything.






[web2py] Re: Download of big files broken

2011-06-20 Thread Stefan Scholl

Sever OS: Linux (remote, behind Apache 2.2), Windows XP (local,
direct)
Client OS: Windows XP
Browser: Firefox 4, Internet Explorer 8
Rocket version: 1.2.2

All combinations break the download for big files (33 MiB),
regardless of chunk_size or server.

Only Internet Explorer 8 (all servers) had problems with small
files (160 KiB), before increasing chunk_size for the streamed
download.


Made the changes to rocket.py (1.2.2), restarted web2py, and the
download was still broken.


By the way: One of the new examples (Dog and owner registration,
with picture upload/download) doesn't use streamed download. It
reads the whole file and sends it. This method doesn't work for
big files, too.


Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Can you make a list of combinations
 
 browser name, version, server os, web server
 FF, 4, Windows 7, Rocket
 ...
 
 for which you experienced the problem?
 
 can you also try the following:
 1) in the rocket.py code replace
 
   'HTTP/1.1 ' with 'HTTP/1.0 '
 
 and replace
 
   environ['SERVER_PROTOCOL'] = request['protocol']
 
 with
 
   environ['SERVER_PROTOCOL'] = 1.0
 
 Looks like acts as if the protocol of response is the same as the
 request but always declare the protocol of the response to be 1.1 even
 if the request is 1.0. This may result in keep-alive connections
 ignored by the browser. Perhaps this is part of the problem?
 
 
 
 
 On Jun 17, 1:35 pm, Stefan Scholl ste...@no-spoon.de wrote:
 To Massimo and the list/group:

 You asked on Reddit if the only constant is the browser. No it
 isn't. But it was the browser which had the problem first, with
 smaller files.

 For smaller files it was enough to raise the chunk_size. IE8 is
 slow, maybe this is the reason?

 Firefox 4 failed when I tried to download a 33 MiB file remotely.
 IE8 failed for anything above 64 KiB on localhost.

 It's almost as if Rocket is so fast because it sends without
 regard for any receiver. Direct (localhost) or behind a proxy
 (Apache 2.2 on the remote Linux server).
 Don't know how this could happen. HTTP isn't ZModem. ;-)









 Stefan Scholl ste...@no-spoon.de wrote:
  I have a parameters_XXX.py file from the normal web2py (with
  rocket) and used the same IP and port with anyserver.py+Tornado
  (and the other one stopped, of course).

  Tested with web2py 1.91.6. Were there any changes regarding this?

  (I'm still very reluctant to upgrade this project.)

  Massimo Di Pierro massimo.dipie...@gmail.com wrote:
  Try this:

  python
  from gluon.main import save_password
  save_password(raw_input('admin password: '),XXX)

  This will create a parameters_XXX.py file. It must be in the main
  web2py folder. Caveats, the admin interface is disabled if you are not
  form localhost and you are not using https.
  Hope this helps. Hope to have you back on the mailing list.

  On Jun 17, 8:43 am, Stefan Scholl ste...@no-spoon.de wrote:
  Now I can't access the admin interface, because the password
  isn't set. (It isn't reading the stored password.)

  Stefan Scholl ste...@no-spoon.de wrote:
   OK, it was Rocket.

   Tested it with the old web2py and Tornado 1.2.1 via anyserver.py
   and the download is OK.

   Stefan Scholl stefan.sch...@gmail.com wrote:
   The higher value for chunk_size didn't work with a 33 MiB file. Even
   in Firefox 4.
   So I tried 1.96.4 (Rocket 1.2.2) on Windows XP.

   Made a new and simple app (dtest). The download there uses
   response.download(request,db) as well.

   1 simple table: db.define_table('stuff', Field('file', 'upload'))

   Upload of the 33 MiB file via db admin, content listed on
  http://127.0.0.1:8001/dtest/default/data/select/stuff(default
   function data with return dict(form=crud()). Download with
   Internet Explorer 8 (after removing the tag that switches to Chrome
   Frame, to have a realistic test like normal users).

   Download was broken. A few KiB were missing. This was on localhost.
   Remote tests have even worse results.

   On 6 Mai, 17:51, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
   Can you try 1.95.1

   On May 6, 6:03 am, Stefan Scholl stefan.sch...@gmail.com wrote:

The classicdownloadfunction:

defdownload():
return response.download(request, db)

I'm developing on localhost (127.0.0.1, no SSL) and one strange 
thing
happened: Downloads in IE8 (Windows XP) were all corrupt/broken if
they weren't below 64KiB in size. Very easy to see with large 
images.

Using a higher value for the argument 'chunk_size' solves this
problem, up to this new maximum.

web2py 1.91.6

 --
 Web (en):http://www.no-spoon.de/-*- Web (de):http://www.frell.de/
 !--[if IE 6]scriptfor(x in document.open);/script![endif]--
 


-- 
Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/
!--[if IE 6]scriptfor(x in document.open);/script![endif]--



[web2py] Strange behaviour with import.

2011-06-20 Thread Mike Veltman

When I dump a table from a SQLite3 db and import it in a mysql database some 
of the integers do not load. 

Interesting enough the .id do show up fine.

With regards,
Mike Veltman




[web2py] Re: import error

2011-06-20 Thread selecta
the open id error is gone now
(globals = None - AttributeError: 'NoneType' object has no attribute
'get')
but the pygments error still exists
 oldmod = sys.modules['pygments.lexers']
 KeyError: 'pygments.lexers'
any clue about this one?

On Jun 18, 1:39 am, Pierre Thibault pierre.thibau...@gmail.com
wrote:
 2011/6/17 selecta gr...@delarue-berlin.de

  I also have problems importing pygments from the modules directory
 http://jaguar.biologie.hu-berlin.de/~fkrause/web2py.app.pygments_test...

  i downloaded pygments fromhttp://pypi.python.org/pypi/Pygments

 Do you still have problems with you are using the last version of trunk?

 --

 A+

 -
 Pierre
 My blog and profile
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] import from my modules with reload

2011-06-20 Thread Manuele Pesenti

is it possible?
using features nearly introduced and importing modules with
import mymodules

is it possible to have a reload of the modules just modified?

thanks a lot

Manuele


Re: [web2py] Re: import error

2011-06-20 Thread Pierre Thibault
2011/6/20 selecta gr...@delarue-berlin.de

 the open id error is gone now
 (globals = None - AttributeError: 'NoneType' object has no attribute
 'get')
 but the pygments error still exists
  oldmod = sys.modules['pygments.lexers']
  KeyError: 'pygments.lexers'
 any clue about this one?
 --


Hello,

The importer will import the module as something like
applications.appname.modules.pygments (this the name used for sys.modules)
if the module to import is in the directory modules. This enables to have
different versions of the same module for different applications.

Since pygments is accessing a module with sys.modules, you cannot use
pygments in the modules directory. You can put pygments in site-packages
instead. Or you can modify pygments for working with web2py (more difficult
I guess).

This is feature. It is not a bug.

I guess I can improve the design by replacing sys.modules by a class that
will do the lockup in applications.appname if it fails like in this example.
How can I access appname from the code? I guess this is the new thread
variable thing implemented recently.

How much do you need this extra feature?

A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] import from my modules with reload

2011-06-20 Thread Pierre Thibault
2011/6/20 Manuele Pesenti manuele.pese...@gmail.com

 is it possible?
 using features nearly introduced and importing modules with
 import mymodules

 is it possible to have a reload of the modules just modified?

 thanks a lot

Manuele


Yes.

You can use the Python reload function.

Or you can use the date tracking feature of web2py that will check the date
of each module imported and import the last version automatically.

Put this code at the beginning of your models:

from gluon.custom_import import track_changes
track_changes()
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re : Re: web2py with Eclipse

2011-06-20 Thread Pierre Thibault
On May 10, 8:46 am, Massimo Di Pierro massimo@gmail.com 
wrote: 
 This is going to be easier in the future. Using trunk, just add this 
 to models: 
 
 from gluon import * 
 request,session,response,T,
cache=current.request,current,session,curremt.response,current.t,current.cache

Can we the same trick for the controllers?


[web2py] Re: import error

2011-06-20 Thread selecta



  but the pygments error still exists
   oldmod = sys.modules['pygments.lexers']
   KeyError: 'pygments.lexers'
  any clue about this one?
  --

 Hello,

 The importer will import the module as something like
 applications.appname.modules.pygments (this the name used for sys.modules)
 if the module to import is in the directory modules. This enables to have
 different versions of the same module for different applications.

 Since pygments is accessing a module with sys.modules, you cannot use
 pygments in the modules directory. You can put pygments in site-packages
 instead. Or you can modify pygments for working with web2py (more difficult
 I guess).

 This is feature. It is not a bug.

oh :P


 I guess I can improve the design by replacing sys.modules by a class that
 will do the lockup in applications.appname if it fails like in this example.
 How can I access appname from the code? I guess this is the new thread
 variable thing implemented recently.

not sure i can follow you here, do you mean request.application?? no i
guess i'm lost

 How much do you need this extra feature?

well, what i want to do is to create an application that i can
distribute easily (pyMantis, ...) for this i need to be able to add
new modules in future distributions and remove them again if they are
not needed, so far I have written a plugin for creating releases (win
linux mac and web2py app packages) and updating running releases
(using the web2py app packages). The plugin currently looks into the
site packages folder and adds all site packages from a local myapp/
site-packages directory. This i not so nice i think and also a bit
error-prone. So it would be nice to create web2py app packages that
just work without any further setup steps (just like web2pys
philosophy: batteries included)


[web2py] Re: problem with using powertable in components

2011-06-20 Thread apple
Have emailed you a w2p.

Alsotext fields seem to be truncated at 30 characters with just an
ellipsis showing. How does one turn off the truncation?

On Jun 20, 8:07 am, Bruno Rocha rochacbr...@gmail.com wrote:
 I will take a look in to it ASAP, can you share more code? or send your .w2p
 ?

 datatables.net is the core od PowerTable, as it is Javscript could be some
 name conflict that I need to solve.

 I am planniing to check, test and release the new optimized  version that I
 have here.

 --
 Bruno Rocha
 [ About me:http://zerp.ly/rochacbruno]
 [ Aprenda a programar:http://CursoDePython.com.br]
 [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
 [ Consultoria em desenvolvimento web:http://www.blouweb.com]







 On Sun, Jun 19, 2011 at 3:55 PM, apple simo...@gmail.com wrote:
  Just started using powertables. This is a brilliant tool and works
  fantastically in most cases. However I have had a problem trying to
  load two powertables on a page within components. It seems to show the
  two tables correctly but then renders a bunch of extra tables that are
  empty and misformatted. If I refresh the screen it also shows an error
  warning about not being able to reinitialize the table.

  # html view is:

  {{extend 'layout.html'}}
  link rel=stylesheet type=text/css href=/{{=request.application}}/
  static/css/{{=request.application}}.css /

  {{=LOAD(f=list, extension=load, ajax=True,
  vars=dict(table=customer))}}
  {{=LOAD(f=list, extension=load, ajax=True,
  vars=dict(table=todo))}}

  # load view is:

  {{include 'web2py_ajax.html'}}
  link rel=stylesheet type=text/css href=/{{=request.application}}/
  static/css/base.css /
  link rel=stylesheet type=text/css href=/{{=request.application}}/
  static/css/{{=request.application}}.css /

  div
     {{=result}}
  /div
   controller just returns a basic table. no fancy hidden
  columns or anything.


[web2py] Re: plugins

2011-06-20 Thread selecta


On Jun 20, 8:32 am, José L. jredr...@gmail.com wrote:
 selecta, the downloads 
 fromhttp://pymantis.org/pymantis_server/plugin_release/downloaddon't work in
 any of its versions.
i know but the strange thing is that i works from some locations (all
that i have access to :( ) and others not (download stalls at 99%)
it is extremely difficult to debug this since i do not have access to
a location where this happens

 Do you have some control version system where I could take a look to these
 plugins?

 Thanks.
here you go
https://sourceforge.net/projects/tlc2/
i know i really need to clean up the project and make it nice and
available, but unfortunatly this is beyond my time constraints right
now

there are two more plugins now in pyMantis

plugin_issue
create, edit and comment issue tickets, attach w2p error tickets to
issues (so you can see the stack traces), automatically show and
create issue tickets and status if a w2p error ticket is created (need
redirect on yourapp/500), server client issue tracking with the
ability to send issue tickets to a main server (aka do you want to
send your bug report to ...), rating of issues, tagging of
issues, 
most of the nice features are hard to demo since I do not want to
expose the w2p error tickets

plugin_wishlist
a rather project specific plugin to track wishes assign them to people
and comment them. if the wish is fulfilled you can mark it as closed.
It is similar to the issue tracker but alot more simple since it is
not made for IT stuff.


Re: [web2py] Re: import error

2011-06-20 Thread Pierre Thibault
2011/6/20 selecta gr...@delarue-berlin.de

  I guess I can improve the design by replacing sys.modules by a class that
  will do the lockup in applications.appname if it fails like in this
 example.
  How can I access appname from the code? I guess this is the new thread
  variable thing implemented recently.

 not sure i can follow you here, do you mean request.application?? no i
 guess i'm lost


It is a bit like you said but request is only available for models,
controllers and views so the thread variable thing was added for core
modules. I don't know yet if I can use this technique in
gluon.custom_import.



 
  How much do you need this extra feature?

 well, what i want to do is to create an application that i can
 distribute easily (pyMantis, ...) for this i need to be able to add
 new modules in future distributions and remove them again if they are
 not needed, so far I have written a plugin for creating releases (win
 linux mac and web2py app packages) and updating running releases
 (using the web2py app packages). The plugin currently looks into the
 site packages folder and adds all site packages from a local myapp/
 site-packages directory. This i not so nice i think and also a bit
 error-prone. So it would be nice to create web2py app packages that
 just work without any further setup steps (just like web2pys
 philosophy: batteries included)


Yes, but I think it is the only module to have that bug and it plays with
low level stuff instead of doing standard imports. Before a fix is made, you
try to replace:

oldmod = sys.modules['pygments.lexers']

with:

import pygments.lexers as oldmod

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: import error

2011-06-20 Thread selecta

 try to replace:

 oldmod = sys.modules['pygments.lexers']

 with:

 import pygments.lexers as oldmod

hagrr why must pygements be so ...

i tried that but i got
File applications/pygments_test/modules/pygments/lexers/__init__.py,
line 223, in module
import pygments.lexers as oldmod
AttributeError: 'module' object has no attribute 'lexers'

so i though i try to remove the whole oldmod stuff
#import pygments.lexers as oldmod
newmod = _automodule('pygments.lexers')
#newmod.__dict__.update(oldmod.__dict__)
sys.modules['pygments.lexers'] = newmod
#del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types

but unfortunately this does not help in the end because when i want to
use pygemtns to render some html i get

Traceback (most recent call last):
  File /home/fkrause/Dev/web2py/gluon/restricted.py, line 192, in
restricted
exec ccode in environment
  File /home/fkrause/Dev/web2py/applications/pyMantis/views/
plugin_restapidoc/method.html, line 26, in module
/tr
  File /home/fkrause/Dev/web2py/applications/pyMantis/models/
plugin_restapidoc.py, line 54, in code_highlight
lexer = pygments.lexers.get_lexer_by_name(language.lower(),
stripall=True)
  File applications/pyMantis/modules/pygments/lexers/__init__.py,
line 74, in get_lexer_by_name
_load_lexers(module_name)
  File applications/pyMantis/modules/pygments/lexers/__init__.py,
line 32, in _load_lexers
mod = __import__(module_name, None, None, ['__all__'])
  File /home/fkrause/Dev/web2py/gluon/custom_import.py, line 283, in
__call__
fromlist, level)
  File /home/fkrause/Dev/web2py/gluon/custom_import.py, line 75, in
__call__
level)
ImportError: No module named agile


[web2py] Re: import error

2011-06-20 Thread selecta
maybe it is better so switch to some javascript syntax highlighter?
any recommendations ...


Re: [web2py] Re: import error

2011-06-20 Thread Pierre Thibault
2011/6/20 selecta gr...@delarue-berlin.de


  try to replace:
 
  oldmod = sys.modules['pygments.lexers']
 
  with:
 
  import pygments.lexers as oldmod

 hagrr why must pygements be so ...

 i tried that but i got
 File applications/pygments_test/modules/pygments/lexers/__init__.py,
 line 223, in module
 import pygments.lexers as oldmod
 AttributeError: 'module' object has no attribute 'lexers'


The importer won't be very hard to fix. I just need the access the name of
the application with the thread local variable. I think Jonathan did that
stuff. I'll wait for his answer.
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: email alert in cron

2011-06-20 Thread Massimo Di Pierro
What do you mean not executed? Does send.mail return false?

On Jun 20, 1:38 am, Manuele Pesenti manuele.pese...@gmail.com wrote:
 Dear all,
 there could be some reason why a controller called by cron is executed
 except the command mail.send? Perhaps does it require a logged user?
 moreover no error ticket about it is listed in errors but no mail is
 send by function... any suggestion about it?

 thanks a lot

         Manuele


[web2py] Re: Strange behaviour with import.

2011-06-20 Thread Massimo Di Pierro
This is fixed in trunk.

On Jun 20, 3:38 am, Mike Veltman mike.velt...@gmail.com wrote:
 When I dump a table from a SQLite3 db and import it in a mysql database some
 of the integers do not load.

 Interesting enough the .id do show up fine.

 With regards,
 Mike Veltman


[web2py] Re: FORM Field change keyboary reaction type

2011-06-20 Thread max
thanks  a lot for the advice.

On Jun 19, 6:58 pm, pbreit pbreitenb...@gmail.com wrote:
 Any behaviors you see are provided by the browser. What you are seeing on a
 multi-down is that some browsers let you press enter to select the current
 entry and move to the next field. To do what you want, you'd need to trap
 keyboard entry using JavaScript, perhaps with onkeydown/onkeypress/onkeyup
 and event.keycode('13')

 Here's a short discussion that might 
 help:http://forums.devx.com/showthread.php?t=6688

 But I would strongly recommend against changing this since most users expect
 enter to submit the form.


[web2py] URL showing on links when printing a page

2011-06-20 Thread Auden RovelleQuartz
on my application, the display on my screen looks fine as expected;
but when I print the page or do a print preview operation, the path
URL shows up to the right of every hyperlink

why is this and how do I avoid that behavior?

many thanks


[web2py] Re: URL showing on links when printing a page

2011-06-20 Thread Anthony
I think that's probably an issue with your CSS. Your CSS may include a 
special print stylesheet that displays the URLs next to the links when 
the page is printed -- the idea is that when you print a document with 
hyperlinks, you might want a way to see the URLs behind the links (since 
they can't be hovered or clicked). You'll probably have to edit your CSS if 
you don't want that to happen.
 
Anthony

On Monday, June 20, 2011 11:10:47 AM UTC-4, Auden RovelleQuartz wrote:

 on my application, the display on my screen looks fine as expected; 
 but when I print the page or do a print preview operation, the path 
 URL shows up to the right of every hyperlink 

 why is this and how do I avoid that behavior? 

 many thanks



[web2py] Re: URL showing on links when printing a page

2011-06-20 Thread Anthony
I didn't realize the base.css file that comes with the web2py 'welcome' app 
does this (I was viewing it in IE, and the URL printing doesn't work in IE). 
The line of CSS to remove is near the bottom of /static/css/base.css in the 
print styles section:
 
  a:after { content:  ( attr(href) ); } 
 
Anthony

On Monday, June 20, 2011 11:32:07 AM UTC-4, Anthony wrote:

 I think that's probably an issue with your CSS. Your CSS may include a 
 special print stylesheet that displays the URLs next to the links when 
 the page is printed -- the idea is that when you print a document with 
 hyperlinks, you might want a way to see the URLs behind the links (since 
 they can't be hovered or clicked). You'll probably have to edit your CSS if 
 you don't want that to happen.
  
 Anthony

 On Monday, June 20, 2011 11:10:47 AM UTC-4, Auden RovelleQuartz wrote:

 on my application, the display on my screen looks fine as expected; 
 but when I print the page or do a print preview operation, the path 
 URL shows up to the right of every hyperlink 

 why is this and how do I avoid that behavior? 

 many thanks



[web2py] Re: URL showing on links when printing a page

2011-06-20 Thread Auden RovelleQuartz
Thanks, that did work!





On Jun 20, 10:39 am, Anthony abasta...@gmail.com wrote:
 I didn't realize the base.css file that comes with the web2py 'welcome' app
 does this (I was viewing it in IE, and the URL printing doesn't work in IE).
 The line of CSS to remove is near the bottom of /static/css/base.css in the
 print styles section:

   a:after { content:  ( attr(href) ); }

 Anthony



 On Monday, June 20, 2011 11:32:07 AM UTC-4, Anthony wrote:
  I think that's probably an issue with your CSS. Your CSS may include a
  special print stylesheet that displays the URLs next to the links when
  the page is printed -- the idea is that when you print a document with
  hyperlinks, you might want a way to see the URLs behind the links (since
  they can't be hovered or clicked). You'll probably have to edit your CSS if
  you don't want that to happen.

  Anthony

  On Monday, June 20, 2011 11:10:47 AM UTC-4, Auden RovelleQuartz wrote:

  on my application, the display on my screen looks fine as expected;
  but when I print the page or do a print preview operation, the path
  URL shows up to the right of every hyperlink

  why is this and how do I avoid that behavior?

  many thanks- Hide quoted text -

 - Show quoted text -


[web2py] Re: URL showing on links when printing a page

2011-06-20 Thread Matt Gorecki
My Google searches didn't yield much information.

There is a CSS trick that will show the URLs only when the page is
printed.  Maybe you have something like this in your stylesheets:
http://davidwalsh.name/optimize-your-links-for-print-using-css-show-url

The only other thing I can think is it's a printer setting in your
browser.

Matt

On Jun 20, 9:10 am, Auden RovelleQuartz oves@gmail.com wrote:
 on my application, the display on my screen looks fine as expected;
 but when I print the page or do a print preview operation, the path
 URL shows up to the right of every hyperlink

 why is this and how do I avoid that behavior?

 many thanks


[web2py] PFtabler application

2011-06-20 Thread Todor Todorov
Hello All,

Me and few colleagues have developed an application, called PFtabler.
The purpose of this application is to control the IP address tables of
the OpenBSD's packet filter.
I know that probably the audience of this type of software would be
narrow, but nevertheless, if somebody is interested:
The readme could be found here: 
http://goodspring-tech.com/images/stories/pftabler/pftabler_v0_7_readme.pdf
The web2py appliance: 
http://goodspring-tech.com/images/stories/pftabler/web2py.app.pftabler_v0_7.w2p
The version, bundled with web2py itself:
http://goodspring-tech.com/images/stories/pftabler/web2py.bundle.pftabler_v0_7.tar.gz

Off topic (or maybe exactly the on-topic): Web2py is great and easy!
But the greatest part is that using it is connected with much fun!

Cheers,
TTT



Re: [web2py] Re: plugins

2011-06-20 Thread José Luis Redrejo Rodríguez
2011/6/20 selecta gr...@delarue-berlin.de:


 On Jun 20, 8:32 am, José L. jredr...@gmail.com wrote:
 selecta, the downloads 
 fromhttp://pymantis.org/pymantis_server/plugin_release/downloaddon't work in
 any of its versions.
 i know but the strange thing is that i works from some locations (all
 that i have access to :( ) and others not (download stalls at 99%)
 it is extremely difficult to debug this since i do not have access to
 a location where this happens

 Do you have some control version system where I could take a look to these
 plugins?

 Thanks.
 here you go
 https://sourceforge.net/projects/tlc2/
 i know i really need to clean up the project and make it nice and
 available, but unfortunatly this is beyond my time constraints right
 now



Thanks

 there are two more plugins now in pyMantis

 plugin_issue
 create, edit and comment issue tickets, attach w2p error tickets to
 issues (so you can see the stack traces), automatically show and
 create issue tickets and status if a w2p error ticket is created (need
 redirect on yourapp/500), server client issue tracking with the
 ability to send issue tickets to a main server (aka do you want to
 send your bug report to ...), rating of issues, tagging of
 issues, 
 most of the nice features are hard to demo since I do not want to
 expose the w2p error tickets

 plugin_wishlist
 a rather project specific plugin to track wishes assign them to people
 and comment them. if the wish is fulfilled you can mark it as closed.
 It is similar to the issue tracker but alot more simple since it is
 not made for IT stuff.


I'm very interested in the users_admin plugin because this is a
feature needed in most of my projects and using the current
appadmin.py application is not an option for the end user.
If I find any bug, would you like me to send it to you (I've already
find one at line 235 of controllers/plugin_doc.py, an unneeded comma
at the beginning of the SPAN tag)


Regards.


[web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread weheh
@Anthony, Unfortunately, this code from the other thread does not work
for my Eclipse installation:

if 0:
from gluon.dal import DAL
from gluon.tools import Auth
db = DAL()
auth = Auth()


The only thing that has worked so far is Pierre's implementation,
which is (no offense) unbelievably ugly (but effective).


[web2py] Long Polling getting only the newly added records.

2011-06-20 Thread David J.

I am not sure how to go about long polling.

I need to know how to get only the most recently added items in the list;

My guess in solving this problem is to include a current row count and 
pass that as a parameter?

and then returning more rows that the current row count?

I am polling at 15 second intervals; so maybe a few rows are added in 
such time;


The idea is simply to avoid having to refresh the page.

I am not sure what is the most efficient way to handle it.

Any design ideas would be appreciated.


Thanks.




Re: [web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread Pierre Thibault
2011/6/20 weheh richard_gor...@verizon.net

 @Anthony, Unfortunately, this code from the other thread does not work
 for my Eclipse installation:

 if 0:
from gluon.dal import DAL
from gluon.tools import Auth
db = DAL()
auth = Auth()


 The only thing that has worked so far is Pierre's implementation,
 which is (no offense) unbelievably ugly (but effective).


To ease things, it is possible to make if fold-able: Window  Preferences 
Pydev  Editor  Code folding  Fold if statements. Then you click in the
gutter to reduce in only one line.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: Download of big files broken

2011-06-20 Thread Massimo Di Pierro
I just tried with chrome and osx and I cannot reproduce the problem (I
tried with a 166MB file).

TIm, who made rocket, also claims he tried this extensively on windows
and cannot reproduce the problem.

I do not doubt you experience this issue. In order to try isolate
better what may be causing it... is there anybody else having this
problem with large files download?

Massimo

On Jun 20, 2:53 am, Stefan Scholl ste...@no-spoon.de wrote:
 Sever OS: Linux (remote, behind Apache 2.2), Windows XP (local,
 direct)
 Client OS: Windows XP
 Browser: Firefox 4, Internet Explorer 8
 Rocket version: 1.2.2

 All combinations break the download for big files (33 MiB),
 regardless of chunk_size or server.

 Only Internet Explorer 8 (all servers) had problems with small
 files (160 KiB), before increasing chunk_size for the streamed
 download.

 Made the changes to rocket.py (1.2.2), restarted web2py, and the
 download was still broken.

 By the way: One of the new examples (Dog and owner registration,
 with picture upload/download) doesn't use streamed download. It
 reads the whole file and sends it. This method doesn't work for
 big files, too.

 Massimo Di Pierro massimo.dipie...@gmail.com wrote:









  Can you make a list of combinations

  browser name, version, server os, web server
  FF, 4, Windows 7, Rocket
  ...

  for which you experienced the problem?

  can you also try the following:
  1) in the rocket.py code replace

    'HTTP/1.1 ' with 'HTTP/1.0 '

  and replace

    environ['SERVER_PROTOCOL'] = request['protocol']

  with

    environ['SERVER_PROTOCOL'] = 1.0

  Looks like acts as if the protocol of response is the same as the
  request but always declare the protocol of the response to be 1.1 even
  if the request is 1.0. This may result in keep-alive connections
  ignored by the browser. Perhaps this is part of the problem?

  On Jun 17, 1:35 pm, Stefan Scholl ste...@no-spoon.de wrote:
  To Massimo and the list/group:

  You asked on Reddit if the only constant is the browser. No it
  isn't. But it was the browser which had the problem first, with
  smaller files.

  For smaller files it was enough to raise the chunk_size. IE8 is
  slow, maybe this is the reason?

  Firefox 4 failed when I tried to download a 33 MiB file remotely.
  IE8 failed for anything above 64 KiB on localhost.

  It's almost as if Rocket is so fast because it sends without
  regard for any receiver. Direct (localhost) or behind a proxy
  (Apache 2.2 on the remote Linux server).
  Don't know how this could happen. HTTP isn't ZModem. ;-)

  Stefan Scholl ste...@no-spoon.de wrote:
   I have a parameters_XXX.py file from the normal web2py (with
   rocket) and used the same IP and port with anyserver.py+Tornado
   (and the other one stopped, of course).

   Tested with web2py 1.91.6. Were there any changes regarding this?

   (I'm still very reluctant to upgrade this project.)

   Massimo Di Pierro massimo.dipie...@gmail.com wrote:
   Try this:

   python
   from gluon.main import save_password
   save_password(raw_input('admin password: '),XXX)

   This will create a parameters_XXX.py file. It must be in the main
   web2py folder. Caveats, the admin interface is disabled if you are not
   form localhost and you are not using https.
   Hope this helps. Hope to have you back on the mailing list.

   On Jun 17, 8:43 am, Stefan Scholl ste...@no-spoon.de wrote:
   Now I can't access the admin interface, because the password
   isn't set. (It isn't reading the stored password.)

   Stefan Scholl ste...@no-spoon.de wrote:
OK, it was Rocket.

Tested it with the old web2py and Tornado 1.2.1 via anyserver.py
and the download is OK.

Stefan Scholl stefan.sch...@gmail.com wrote:
The higher value for chunk_size didn't work with a 33 MiB file. Even
in Firefox 4.
So I tried 1.96.4 (Rocket 1.2.2) on Windows XP.

Made a new and simple app (dtest). The download there uses
response.download(request,db) as well.

1 simple table: db.define_table('stuff', Field('file', 'upload'))

Upload of the 33 MiB file via db admin, content listed on
   http://127.0.0.1:8001/dtest/default/data/select/stuff(default
function data with return dict(form=crud()). Download with
Internet Explorer 8 (after removing the tag that switches to Chrome
Frame, to have a realistic test like normal users).

Download was broken. A few KiB were missing. This was on localhost.
Remote tests have even worse results.

On 6 Mai, 17:51, Massimo Di Pierro massimo.dipie...@gmail.com 
wrote:
Can you try 1.95.1

On May 6, 6:03 am, Stefan Scholl stefan.sch...@gmail.com wrote:

 The classicdownloadfunction:

 defdownload():
 return response.download(request, db)

 I'm developing on localhost (127.0.0.1, no SSL) and one strange 
 thing
 happened: Downloads in IE8 (Windows XP) were all corrupt/broken 
 if
 they weren't below 64KiB in size. Very easy to see with large 
 images.

  

[web2py] Problem with models in subdirectories

2011-06-20 Thread Dane
Hello, I'm migrating an app to a new server (ubuntu 10.10) and
upgraded to the most newest web2py stable version as part of this.
This has introduced a problem where models in subdirectories of the
model folder don't seem to be getting executed. Files placed directly
in the model folder run correctly.  I have done a 'chown www-data . -
R'

Any ideas?


[web2py] Re: Download of big files broken

2011-06-20 Thread Anthony
I've tried on Windows 7 in IE 7, 8, and 9 with a 50MB file and cannot 
reproduce the problem either.
 
Anthony

On Monday, June 20, 2011 2:53:42 PM UTC-4, Massimo Di Pierro wrote:

 I just tried with chrome and osx and I cannot reproduce the problem (I 
 tried with a 166MB file). 

 TIm, who made rocket, also claims he tried this extensively on windows 
 and cannot reproduce the problem. 

 I do not doubt you experience this issue. In order to try isolate 
 better what may be causing it... is there anybody else having this 
 problem with large files download? 

 Massimo 

 On Jun 20, 2:53 am, Stefan Scholl ste...@no-spoon.de wrote: 
  Sever OS: Linux (remote, behind Apache 2.2), Windows XP (local, 
  direct) 
  Client OS: Windows XP 
  Browser: Firefox 4, Internet Explorer 8 
  Rocket version: 1.2.2 
  
  All combinations break the download for big files (33 MiB), 
  regardless of chunk_size or server. 
  
  Only Internet Explorer 8 (all servers) had problems with small 
  files (160 KiB), before increasing chunk_size for the streamed 
  download. 
  
  Made the changes to rocket.py (1.2.2), restarted web2py, and the 
  download was still broken. 
  
  By the way: One of the new examples (Dog and owner registration, 
  with picture upload/download) doesn't use streamed download. It 
  reads the whole file and sends it. This method doesn't work for 
  big files, too. 
  
  Massimo Di Pierro massimo@gmail.com wrote: 
  
  
  
  
  
  
  
  
  
   Can you make a list of combinations 
  
   browser name, version, server os, web server 
   FF, 4, Windows 7, Rocket 
   ... 
  
   for which you experienced the problem? 
  
   can you also try the following: 
   1) in the rocket.py code replace 
  
 'HTTP/1.1 ' with 'HTTP/1.0 ' 
  
   and replace 
  
 environ['SERVER_PROTOCOL'] = request['protocol'] 
  
   with 
  
 environ['SERVER_PROTOCOL'] = 1.0 
  
   Looks like acts as if the protocol of response is the same as the 
   request but always declare the protocol of the response to be 1.1 even 
   if the request is 1.0. This may result in keep-alive connections 
   ignored by the browser. Perhaps this is part of the problem? 
  
   On Jun 17, 1:35 pm, Stefan Scholl ste...@no-spoon.de wrote: 
   To Massimo and the list/group: 
  
   You asked on Reddit if the only constant is the browser. No it 
   isn't. But it was the browser which had the problem first, with 
   smaller files. 
  
   For smaller files it was enough to raise the chunk_size. IE8 is 
   slow, maybe this is the reason? 
  
   Firefox 4 failed when I tried to download a 33 MiB file remotely. 
   IE8 failed for anything above 64 KiB on localhost. 
  
   It's almost as if Rocket is so fast because it sends without 
   regard for any receiver. Direct (localhost) or behind a proxy 
   (Apache 2.2 on the remote Linux server). 
   Don't know how this could happen. HTTP isn't ZModem. ;-) 
  
   Stefan Scholl ste...@no-spoon.de wrote: 
I have a parameters_XXX.py file from the normal web2py (with 
rocket) and used the same IP and port with anyserver.py+Tornado 
(and the other one stopped, of course). 
  
Tested with web2py 1.91.6. Were there any changes regarding this? 
  
(I'm still very reluctant to upgrade this project.) 
  
Massimo Di Pierro massimo@gmail.com wrote: 
Try this: 
  
python 
from gluon.main import save_password 
save_password(raw_input('admin password: '),XXX) 
  
This will create a parameters_XXX.py file. It must be in the main 
web2py folder. Caveats, the admin interface is disabled if you are 
 not 
form localhost and you are not using https. 
Hope this helps. Hope to have you back on the mailing list. 
  
On Jun 17, 8:43 am, Stefan Scholl ste...@no-spoon.de wrote: 
Now I can't access the admin interface, because the password 
isn't set. (It isn't reading the stored password.) 
  
Stefan Scholl ste...@no-spoon.de wrote: 
 OK, it was Rocket. 
  
 Tested it with the old web2py and Tornado 1.2.1 via anyserver.py 

 and the download is OK. 
  
 Stefan Scholl stefan...@gmail.com wrote: 
 The higher value for chunk_size didn't work with a 33 MiB file. 
 Even 
 in Firefox 4. 
 So I tried 1.96.4 (Rocket 1.2.2) on Windows XP. 
  
 Made a new and simple app (dtest). The download there uses 
 response.download(request,db) as well. 
  
 1 simple table: db.define_table('stuff', Field('file', 
 'upload')) 
  
 Upload of the 33 MiB file via db admin, content listed on 
http://127.0.0.1:8001/dtest/default/data/select/stuff(default 
 function data with return dict(form=crud()). Download with 
 Internet Explorer 8 (after removing the tag that switches to 
 Chrome 
 Frame, to have a realistic test like normal users). 
  
 Download was broken. A few KiB were missing. This was on 
 localhost. 
 Remote tests have even worse results. 
  
 On 6 Mai, 17:51, Massimo Di Pierro massimo@gmail.com 
 

[web2py] Re: Problem with models in subdirectories

2011-06-20 Thread Anthony
1.96 introduced conditional models -- so model files in subfolders will only 
run if the name of the subfolder matches the name of the currently requested 
controller (you can also add an additional level of subfolders to match 
function names within controllers). Prior to 1.96, I don't think using 
subfolders in /models was officially supported.
 
Anthony

On Monday, June 20, 2011 3:29:24 PM UTC-4, Dane wrote:

 Hello, I'm migrating an app to a new server (ubuntu 10.10) and 
 upgraded to the most newest web2py stable version as part of this. 
 This has introduced a problem where models in subdirectories of the 
 model folder don't seem to be getting executed. Files placed directly 
 in the model folder run correctly.  I have done a 'chown www-data . - 
 R' 

 Any ideas?



[web2py] Re: Gigya - Janrain alternative

2011-06-20 Thread TekNullOG
Hey guys,

I found a new alternative. I've played around with their Free account.
They have very similar services to Gigya and Janrain but offer their
complete product for free to sites with less than 2500 monthly
registrations (that's what sold me). I called to see if they support
SSL encrypted pages and they said it was offered in their first paid
package which is 49$/month and the limit is then increased to 5000
monthly registrations.

The website is http://lanoba.com

I hope this helps you guys. Let me know if you have questions. I've
played around with most solutions out there.

Cheers

On May 13, 2:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Forget about it! This is really cool, I love the widgets but they are crazy!

 Gigya service cost for more than 1000 unique visitors/authentications per
 month is $15,000 per year


[web2py] Re: Problem with models in subdirectories

2011-06-20 Thread Dane
I see... any ideas for a quick method to force all models in
subfolders to run? I have dozens of model files organized in various
subfolders and I'd rather avoid lumping them all together. Thanks for
the help.

On Jun 20, 3:41 pm, Anthony abasta...@gmail.com wrote:
 1.96 introduced conditional models -- so model files in subfolders will only
 run if the name of the subfolder matches the name of the currently requested
 controller (you can also add an additional level of subfolders to match
 function names within controllers). Prior to 1.96, I don't think using
 subfolders in /models was officially supported.

 Anthony







 On Monday, June 20, 2011 3:29:24 PM UTC-4, Dane wrote:
  Hello, I'm migrating an app to a new server (ubuntu 10.10) and
  upgraded to the most newest web2py stable version as part of this.
  This has introduced a problem where models in subdirectories of the
  model folder don't seem to be getting executed. Files placed directly
  in the model folder run correctly.  I have done a 'chown www-data . -
  R'

  Any ideas?


[web2py] Re: problem with using powertable in components

2011-06-20 Thread apple
Ah:

powerTable.truncate=150

On Jun 20, 12:37 pm, apple simo...@gmail.com wrote:
 Have emailed you a w2p.

 Alsotext fields seem to be truncated at 30 characters with just an
 ellipsis showing. How does one turn off the truncation?

 On Jun 20, 8:07 am, Bruno Rocha rochacbr...@gmail.com wrote:







  I will take a look in to it ASAP, can you share more code? or send your .w2p
  ?

  datatables.net is the core od PowerTable, as it is Javscript could be some
  name conflict that I need to solve.

  I am planniing to check, test and release the new optimized  version that I
  have here.

  --
  Bruno Rocha
  [ About me:http://zerp.ly/rochacbruno]
  [ Aprenda a programar:http://CursoDePython.com.br]
  [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
  [ Consultoria em desenvolvimento web:http://www.blouweb.com]

  On Sun, Jun 19, 2011 at 3:55 PM, apple simo...@gmail.com wrote:
   Just started using powertables. This is a brilliant tool and works
   fantastically in most cases. However I have had a problem trying to
   load two powertables on a page within components. It seems to show the
   two tables correctly but then renders a bunch of extra tables that are
   empty and misformatted. If I refresh the screen it also shows an error
   warning about not being able to reinitialize the table.

   # html view is:

   {{extend 'layout.html'}}
   link rel=stylesheet type=text/css href=/{{=request.application}}/
   static/css/{{=request.application}}.css /

   {{=LOAD(f=list, extension=load, ajax=True,
   vars=dict(table=customer))}}
   {{=LOAD(f=list, extension=load, ajax=True,
   vars=dict(table=todo))}}

   # load view is:

   {{include 'web2py_ajax.html'}}
   link rel=stylesheet type=text/css href=/{{=request.application}}/
   static/css/base.css /
   link rel=stylesheet type=text/css href=/{{=request.application}}/
   static/css/{{=request.application}}.css /

   div
      {{=result}}
   /div
    controller just returns a basic table. no fancy hidden
   columns or anything.


Re: [web2py] Re: Gigya - Janrain alternative

2011-06-20 Thread Bruno Rocha
Thanks for sharing, very nice, I will test it.



On Mon, Jun 20, 2011 at 4:28 PM, TekNullOG a...@alexdavis.ca wrote:

 Hey guys,

 I found a new alternative. I've played around with their Free account.
 They have very similar services to Gigya and Janrain but offer their
 complete product for free to sites with less than 2500 monthly
 registrations (that's what sold me). I called to see if they support
 SSL encrypted pages and they said it was offered in their first paid
 package which is 49$/month and the limit is then increased to 5000
 monthly registrations.

 The website is http://lanoba.com

 I hope this helps you guys. Let me know if you have questions. I've
 played around with most solutions out there.

 Cheers

 On May 13, 2:23 pm, Bruno Rocha rochacbr...@gmail.com wrote:
  Forget about it! This is really cool, I love the widgets but they are
 crazy!
 
  Gigya service cost for more than 1000 unique visitors/authentications per
  month is $15,000 per year



Re: [web2py] Re: email alert in cron

2011-06-20 Thread Manuele Pesenti

On 20/06/2011 15:49, Massimo Di Pierro wrote:

What do you mean not executed? Does send.mail return false?



tomorrow I'll report about it, maybe I found an error that were blocking 
mail sending. I as just supposing... thankyou anyway.


Manuele


[web2py] Re: Problem with models in subdirectories

2011-06-20 Thread Anthony
There's some discussion about adding some kind of setting that will allow 
you to control/override the conditional execution behavior. Hopefully we'll 
have something soon, but in the meantime, I suppose you could hack 
gluon.compileapp.run_models_in (
http://code.google.com/p/web2py/source/browse/gluon/compileapp.py?name=R-1.96.4#345).
 
Change:
 
if not os.path.split(model)[0] in paths:
continue
elif compiled:
code = read_pyc(model)
elif is_gae:
code = getcfs(model, model,
  lambda: compile2(read_file(model), model))
else:
code = getcfs(model, model, None)  
 
To:
 
if compiled:
code = read_pyc(model)
elif is_gae:
code = getcfs(model, model,
  lambda: compile2(read_file(model), model))
else:
code = getcfs(model, model, None)  
 
Anthony

On Monday, June 20, 2011 3:57:33 PM UTC-4, Dane wrote:

 I see... any ideas for a quick method to force all models in 
 subfolders to run? I have dozens of model files organized in various 
 subfolders and I'd rather avoid lumping them all together. Thanks for 
 the help. 

 On Jun 20, 3:41 pm, Anthony abas...@gmail.com wrote: 
  1.96 introduced conditional models -- so model files in subfolders will 
 only 
  run if the name of the subfolder matches the name of the currently 
 requested 
  controller (you can also add an additional level of subfolders to match 
  function names within controllers). Prior to 1.96, I don't think using 
  subfolders in /models was officially supported. 
  
  Anthony 
  
  
  
  
  
  
  
  On Monday, June 20, 2011 3:29:24 PM UTC-4, Dane wrote: 
   Hello, I'm migrating an app to a new server (ubuntu 10.10) and 
   upgraded to the most newest web2py stable version as part of this. 
   This has introduced a problem where models in subdirectories of the 
   model folder don't seem to be getting executed. Files placed directly 
   in the model folder run correctly.  I have done a 'chown www-data . - 
   R' 
  
   Any ideas?



[web2py] a not null constraint for one of 2 fields and both field can't be filled...

2011-06-20 Thread Richard Vézina
Hello,

I am trying to implement a not null constraint for 2 fields... Both field
can't be filled at the same time... But at least one field should be filled.

It because of a not normalized design where there is a 2 FK are pointing on
differents tables.

I found this to be interresting :
http://groups.google.com/group/web2py/browse_thread/thread/6eb0a3ab92e3795c

Maybe someone of you could be aware of a something more clause of my need.

Thanks.

Richard


[web2py] Re: Download of big files broken

2011-06-20 Thread Stefan Scholl
I had to do something perverted to save the project: I make a
local redirect to a PHP script, which uses readfile
http://de.php.net/manual/en/function.readfile.php. No problem
there. (Retrieving the original file name and content-type in
web2py.)

It's only rocket. And it was reported by a co-worker and a
customer.

One silly idea: What if Rocket has problems with some
proxies/firewalls? The customer has a broken proxy which caused
different problems for other projects.

I don't know about any proxy at work, but it could be that they
reroute everything on port 80 through a proxy without me knowing.
(Ignore the non-technical implications of this assumption.)


Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 I just tried with chrome and osx and I cannot reproduce the problem (I
 tried with a 166MB file).
 
 TIm, who made rocket, also claims he tried this extensively on windows
 and cannot reproduce the problem.
 
 I do not doubt you experience this issue. In order to try isolate
 better what may be causing it... is there anybody else having this
 problem with large files download?
 
 Massimo
 
 On Jun 20, 2:53 am, Stefan Scholl ste...@no-spoon.de wrote:
 Sever OS: Linux (remote, behind Apache 2.2), Windows XP (local,
 direct)
 Client OS: Windows XP
 Browser: Firefox 4, Internet Explorer 8
 Rocket version: 1.2.2

 All combinations break the download for big files (33 MiB),
 regardless of chunk_size or server.

 Only Internet Explorer 8 (all servers) had problems with small
 files (160 KiB), before increasing chunk_size for the streamed
 download.

 Made the changes to rocket.py (1.2.2), restarted web2py, and the
 download was still broken.

 By the way: One of the new examples (Dog and owner registration,
 with picture upload/download) doesn't use streamed download. It
 reads the whole file and sends it. This method doesn't work for
 big files, too.

 Massimo Di Pierro massimo.dipie...@gmail.com wrote:









  Can you make a list of combinations

  browser name, version, server os, web server
  FF, 4, Windows 7, Rocket
  ...

  for which you experienced the problem?

  can you also try the following:
  1) in the rocket.py code replace

    'HTTP/1.1 ' with 'HTTP/1.0 '

  and replace

    environ['SERVER_PROTOCOL'] = request['protocol']

  with

    environ['SERVER_PROTOCOL'] = 1.0

  Looks like acts as if the protocol of response is the same as the
  request but always declare the protocol of the response to be 1.1 even
  if the request is 1.0. This may result in keep-alive connections
  ignored by the browser. Perhaps this is part of the problem?

  On Jun 17, 1:35 pm, Stefan Scholl ste...@no-spoon.de wrote:
  To Massimo and the list/group:

  You asked on Reddit if the only constant is the browser. No it
  isn't. But it was the browser which had the problem first, with
  smaller files.

  For smaller files it was enough to raise the chunk_size. IE8 is
  slow, maybe this is the reason?

  Firefox 4 failed when I tried to download a 33 MiB file remotely.
  IE8 failed for anything above 64 KiB on localhost.

  It's almost as if Rocket is so fast because it sends without
  regard for any receiver. Direct (localhost) or behind a proxy
  (Apache 2.2 on the remote Linux server).
  Don't know how this could happen. HTTP isn't ZModem. ;-)

  Stefan Scholl ste...@no-spoon.de wrote:
   I have a parameters_XXX.py file from the normal web2py (with
   rocket) and used the same IP and port with anyserver.py+Tornado
   (and the other one stopped, of course).

   Tested with web2py 1.91.6. Were there any changes regarding this?

   (I'm still very reluctant to upgrade this project.)

   Massimo Di Pierro massimo.dipie...@gmail.com wrote:
   Try this:

   python
   from gluon.main import save_password
   save_password(raw_input('admin password: '),XXX)

   This will create a parameters_XXX.py file. It must be in the main
   web2py folder. Caveats, the admin interface is disabled if you are not
   form localhost and you are not using https.
   Hope this helps. Hope to have you back on the mailing list.

   On Jun 17, 8:43 am, Stefan Scholl ste...@no-spoon.de wrote:
   Now I can't access the admin interface, because the password
   isn't set. (It isn't reading the stored password.)

   Stefan Scholl ste...@no-spoon.de wrote:
OK, it was Rocket.

Tested it with the old web2py and Tornado 1.2.1 via anyserver.py
and the download is OK.

Stefan Scholl stefan.sch...@gmail.com wrote:
The higher value for chunk_size didn't work with a 33 MiB file. 
Even
in Firefox 4.
So I tried 1.96.4 (Rocket 1.2.2) on Windows XP.

Made a new and simple app (dtest). The download there uses
response.download(request,db) as well.

1 simple table: db.define_table('stuff', Field('file', 'upload'))

Upload of the 33 MiB file via db admin, content listed on
   http://127.0.0.1:8001/dtest/default/data/select/stuff(default
function data with return dict(form=crud()). Download with
Internet 

[web2py] Re: Download of big files broken

2011-06-20 Thread Stefan Scholl
Forget it. (If this would be a real newsgroup I would cancel the
article.)

Forgot about the problems on localhost.


Stefan Scholl ste...@no-spoon.de wrote:
 I had to do something perverted to save the project: I make a
 local redirect to a PHP script, which uses readfile
 http://de.php.net/manual/en/function.readfile.php. No problem
 there. (Retrieving the original file name and content-type in
 web2py.)
 
 It's only rocket. And it was reported by a co-worker and a
 customer.
 
 One silly idea: What if Rocket has problems with some
 proxies/firewalls? The customer has a broken proxy which caused
 different problems for other projects.
 
 I don't know about any proxy at work, but it could be that they
 reroute everything on port 80 through a proxy without me knowing.
 (Ignore the non-technical implications of this assumption.)
 
 
 Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 I just tried with chrome and osx and I cannot reproduce the problem (I
 tried with a 166MB file).
 
 TIm, who made rocket, also claims he tried this extensively on windows
 and cannot reproduce the problem.
 
 I do not doubt you experience this issue. In order to try isolate
 better what may be causing it... is there anybody else having this
 problem with large files download?
 
 Massimo
 
 On Jun 20, 2:53 am, Stefan Scholl ste...@no-spoon.de wrote:
 Sever OS: Linux (remote, behind Apache 2.2), Windows XP (local,
 direct)
 Client OS: Windows XP
 Browser: Firefox 4, Internet Explorer 8
 Rocket version: 1.2.2

 All combinations break the download for big files (33 MiB),
 regardless of chunk_size or server.

 Only Internet Explorer 8 (all servers) had problems with small
 files (160 KiB), before increasing chunk_size for the streamed
 download.

 Made the changes to rocket.py (1.2.2), restarted web2py, and the
 download was still broken.

 By the way: One of the new examples (Dog and owner registration,
 with picture upload/download) doesn't use streamed download. It
 reads the whole file and sends it. This method doesn't work for
 big files, too.

 Massimo Di Pierro massimo.dipie...@gmail.com wrote:









  Can you make a list of combinations

  browser name, version, server os, web server
  FF, 4, Windows 7, Rocket
  ...

  for which you experienced the problem?

  can you also try the following:
  1) in the rocket.py code replace

    'HTTP/1.1 ' with 'HTTP/1.0 '

  and replace

    environ['SERVER_PROTOCOL'] = request['protocol']

  with

    environ['SERVER_PROTOCOL'] = 1.0

  Looks like acts as if the protocol of response is the same as the
  request but always declare the protocol of the response to be 1.1 even
  if the request is 1.0. This may result in keep-alive connections
  ignored by the browser. Perhaps this is part of the problem?

  On Jun 17, 1:35 pm, Stefan Scholl ste...@no-spoon.de wrote:
  To Massimo and the list/group:

  You asked on Reddit if the only constant is the browser. No it
  isn't. But it was the browser which had the problem first, with
  smaller files.

  For smaller files it was enough to raise the chunk_size. IE8 is
  slow, maybe this is the reason?

  Firefox 4 failed when I tried to download a 33 MiB file remotely.
  IE8 failed for anything above 64 KiB on localhost.

  It's almost as if Rocket is so fast because it sends without
  regard for any receiver. Direct (localhost) or behind a proxy
  (Apache 2.2 on the remote Linux server).
  Don't know how this could happen. HTTP isn't ZModem. ;-)

  Stefan Scholl ste...@no-spoon.de wrote:
   I have a parameters_XXX.py file from the normal web2py (with
   rocket) and used the same IP and port with anyserver.py+Tornado
   (and the other one stopped, of course).

   Tested with web2py 1.91.6. Were there any changes regarding this?

   (I'm still very reluctant to upgrade this project.)

   Massimo Di Pierro massimo.dipie...@gmail.com wrote:
   Try this:

   python
   from gluon.main import save_password
   save_password(raw_input('admin password: '),XXX)

   This will create a parameters_XXX.py file. It must be in the main
   web2py folder. Caveats, the admin interface is disabled if you are not
   form localhost and you are not using https.
   Hope this helps. Hope to have you back on the mailing list.

   On Jun 17, 8:43 am, Stefan Scholl ste...@no-spoon.de wrote:
   Now I can't access the admin interface, because the password
   isn't set. (It isn't reading the stored password.)

   Stefan Scholl ste...@no-spoon.de wrote:
OK, it was Rocket.

Tested it with the old web2py and Tornado 1.2.1 via anyserver.py
and the download is OK.

Stefan Scholl stefan.sch...@gmail.com wrote:
The higher value for chunk_size didn't work with a 33 MiB file. 
Even
in Firefox 4.
So I tried 1.96.4 (Rocket 1.2.2) on Windows XP.

Made a new and simple app (dtest). The download there uses
response.download(request,db) as well.

1 simple table: db.define_table('stuff', Field('file', 'upload'))

Upload of the 33 MiB file 

[web2py] How to create web2py-based desktop app?

2011-06-20 Thread Vinhthuy
Hello everyone,

We have used web2py to create server-based application.  With minimal
change, e would like to make it so that it can be used as stand-alone
desktop applications on both Windows and Mac.   If possible, I would
it to contain everything, including Python so that users simply
download our app, click on it and run it on their personal computers.

At web2py.com, I noticed that web2py itself can be downloaded and used
as stand-alone applications for both Windows and Mac (web2py.exe and
web2py.app, respectively).

Any clues on how to do this is greatly appreciated.

Thanks,

Vinhthuy Phan


[web2py] Re: How to create web2py-based desktop app?

2011-06-20 Thread Massimo Di Pierro
My answer did not appear... retrying...

http://web2py.com/book/default/chapter/12#How-to-Distribute-your-Applications-as-Binaries

On Jun 20, 4:05 pm, Vinhthuy vinhthuyp...@gmail.com wrote:
 Hello everyone,

 We have used web2py to create server-based application.  With minimal
 change, e would like to make it so that it can be used as stand-alone
 desktop applications on both Windows and Mac.   If possible, I would
 it to contain everything, including Python so that users simply
 download our app, click on it and run it on their personal computers.

 At web2py.com, I noticed that web2py itself can be downloaded and used
 as stand-alone applications for both Windows and Mac (web2py.exe and
 web2py.app, respectively).

 Any clues on how to do this is greatly appreciated.

 Thanks,

 Vinhthuy Phan


[web2py] Re: How to create web2py-based desktop app?

2011-06-20 Thread Vinhthuy
Thank you we will try this.


On Jun 20, 4:54 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 My answer did not appear... retrying...

 http://web2py.com/book/default/chapter/12#How-to-Distribute-your-Appl...

 On Jun 20, 4:05 pm, Vinhthuy vinhthuyp...@gmail.com wrote:







  Hello everyone,

  We have used web2py to create server-based application.  With minimal
  change, e would like to make it so that it can be used as stand-alone
  desktop applications on both Windows and Mac.   If possible, I would
  it to contain everything, including Python so that users simply
  download our app, click on it and run it on their personal computers.

  At web2py.com, I noticed that web2py itself can be downloaded and used
  as stand-alone applications for both Windows and Mac (web2py.exe and
  web2py.app, respectively).

  Any clues on how to do this is greatly appreciated.

  Thanks,

  Vinhthuy Phan


[web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread weheh
Makes sense! And prettier, too. Thx.

On Jun 20, 1:36 pm, Pierre Thibault pierre.thibau...@gmail.com
wrote:
 2011/6/20 weheh richard_gor...@verizon.net

  @Anthony, Unfortunately, this code from the other thread does not work
  for my Eclipse installation:

  if 0:
     from gluon.dal import DAL
     from gluon.tools import Auth
     db = DAL()
     auth = Auth()

  The only thing that has worked so far is Pierre's implementation,
  which is (no offense) unbelievably ugly (but effective).

 To ease things, it is possible to make if fold-able: Window  Preferences 
 Pydev  Editor  Code folding  Fold if statements. Then you click in the
 gutter to reduce in only one line.

 --

 A+

 -
 Pierre
 My blog and profile
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: How to create web2py-based desktop app?

2011-06-20 Thread selecta
check out the plugin_release from pyMantis
it will automatically build win linux mac and w2p package releases of
your app
it also has an update mechanism that allows the download and
installation of updated versions
the plugin is not perfect yet and it would be cool to have more
testers/developers
ironically the download at pymantis.org is currently broken for some
clients (some weird server issue stalling the dl at 99%)
so if that does not work for you you can also get the code from
http://sourceforge.net/projects/tlc2/

On Jun 20, 11:05 pm, Vinhthuy vinhthuyp...@gmail.com wrote:
 Hello everyone,

 We have used web2py to create server-based application.  With minimal
 change, e would like to make it so that it can be used as stand-alone
 desktop applications on both Windows and Mac.   If possible, I would
 it to contain everything, including Python so that users simply
 download our app, click on it and run it on their personal computers.

 At web2py.com, I noticed that web2py itself can be downloaded and used
 as stand-alone applications for both Windows and Mac (web2py.exe and
 web2py.app, respectively).

 Any clues on how to do this is greatly appreciated.

 Thanks,

 Vinhthuy Phan


[web2py] Re: plugins

2011-06-20 Thread selecta
 If I find any bug, would you like me to send it to you
yes :D please post them here 
http://pymantis.org/pymantis_server/plugin_issue/index


[web2py] Re: Problem with models in subdirectories

2011-06-20 Thread pbreit
I'd say just prefix the filenames with their folder names and put them all 
in /models.

Re: [web2py] Re: email alert in cron

2011-06-20 Thread pbreit
Maybe show us the code?

[web2py] Re: Problem with models in subdirectories

2011-06-20 Thread Anthony
On Monday, June 20, 2011 8:08:44 PM UTC-4, pbreit wrote: 

 I'd say just prefix the filenames with their folder names and put them all 
 in /models.

 
I think we should have a solution within the next week (at least in trunk), 
and in the meantime, the hack in compileapp.py is easy, so I wouldn't 
necessarily restructure an entire app just yet.
 
Anthony


[web2py] Best way to re-use snippet of HTML

2011-06-20 Thread pbreit
What's the best way to re-use a snippet of HTML in different places? 
Components and LOAD()? Or is there some way to include a block? These can be 
lengthy snippets so I'd rather do it more in HTML than with tags.

Re: [web2py] Re: Strange behaviour with import.

2011-06-20 Thread Mike Veltman
 This is fixed in trunk.
 

Thanks :-)

I noticed that I never added version and stuff, sorry for that. 


 On Jun 20, 3:38 am, Mike Veltman mike.velt...@gmail.com wrote:
  When I dump a table from a SQLite3 db and import it in a mysql database
  some of the integers do not load.
  
  Interesting enough the .id do show up fine.
  
  With regards,
  Mike Veltman

With regards,
Mike Veltman




[web2py] Re: Best way to re-use snippet of HTML

2011-06-20 Thread Anthony
On Monday, June 20, 2011 8:32:30 PM UTC-4, pbreit wrote: 

 What's the best way to re-use a snippet of HTML in different places? 
 Components and LOAD()? Or is there some way to include a block? These can be 
 lengthy snippets so I'd rather do it more in HTML than with tags.

 
Have you tried just doing {{include 'path/to/view/file/with/HTML/snippet'}}, 
or do you need something more sophisticated?


Re: Re : Re: Re : Re: Re : Re: [web2py] Re: Email invitation

2011-06-20 Thread Dwayne
Dear Massimo,

Thank you very much. I'll send you the 30 dollars if it works :)

I have a problem. I cannot compile :

auth.settings.register_onvalidation.append(lambda form:
db.invitation(token=form.vars.email) or
form.errors.update({'email','not allowed'}))

Why do I need : form.errors.update({'email','not allowed'}) ?

Thank you very much !

Dwayne


On 20 juin, 02:09, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 OK try this:

 definvitation():
     form = SQLFORM.factory(Field('email',requires=IS_EMAIL()))
     if form.accepts(request):
         db.invitation.insert(token = form.vars.email)
         MESSAGE = 'click %s to register'
         url = URL('user/register',host=request.env.http_host)
         mail.send(to=form.vars.email, message=MESSAGE % url)
         redirect('success_invitation'))
     return dict(message=('Invitationto be sent'),
                 form=form,address=form.vars.email)

 auth.settings.register_onvalidation.append(lambda form:
 db.invitation(token=form.vars.email) or
 form.errors.update({'email','not allowed'}))
 auth.settings.register_onaccept.append(lambda form:
 db(db.invitation.token==form.vars.email).delete())

 On Jun 4, 9:28 am, Dwayne Blind dwaynebl...@gmail.com wrote:



  Can somebody please help me ? I would really want this to work.

  I customized db.auth_user, as described in the book, to add a 'token'
  field. I just added : Field('token', writable=False, readable=False,
  default='').

  Then, in the controllers, I modified default.py :

  def user():
      db.auth_user.insert(token=request.args(1))
      return dict(form=auth())

  Then in the models, I modified db.py :

  def my_auth_processing(form):
      if db(db.auth_user.token!='')
  (db.invitation.token==db.auth_user.token):
          return True
      else :
          return False

  auth.settings.register_onvalidation.append(lambda form:
  my_auth_processing(form))

  But unfortunately no one is prevented from registering... So this does
  not work.

  Dwayne

  On 2 juin, 02:31, pbreit pbreitenb...@gmail.com wrote:

   Oops. For registration, you use 
   this:http://web2py.com/book/default/chapter/08?search=register_onvalidation-
Masquer le texte des messages précédents -

 - Afficher le texte des messages précédents -


Re: [web2py] Best way to re-use snippet of HTML

2011-06-20 Thread Bruno Rocha
You can use block in views

##layout.html##
{{block header}}
  headera/header
{{end}}

then inherit it in the view..

or you can define functions in model or modules (see instamtpress source
code)

def myheader():
html = 
   html hradernjvnjnvjf/header/html

return XML(html)

then, all it in any place of the view

{{=myheader()}}

or you can include if thats static (no template parsing)

{{include 'pat/to/file'}}





--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]



On Mon, Jun 20, 2011 at 9:32 PM, pbreit pbreitenb...@gmail.com wrote:

 What's the best way to re-use a snippet of HTML in different places?
 Components and LOAD()? Or is there some way to include a block? These can be
 lengthy snippets so I'd rather do it more in HTML than with tags.


Re: [web2py] Best way to re-use snippet of HTML

2011-06-20 Thread Anthony
On Monday, June 20, 2011 9:25:31 PM UTC-4, rochacbruno wrote: 


 or you can include if thats static (no template parsing)

 {{include 'pat/to/file'}}

 Note, the template doesn't have to be purely static for the above to work. 
Look at web2py_ajax.html, for example -- it is included in layout.html but 
is not static.
 Anthony


Re: [web2py] Best way to re-use snippet of HTML

2011-06-20 Thread Bruno Rocha
On Mon, Jun 20, 2011 at 10:40 PM, Anthony abasta...@gmail.com wrote:

 {{include 'pat/to/file'}}

  Note, the template doesn't have to be purely static for the above to
 work. Look at web2py_ajax.html, for example -- it is included in layout.html
 but is not static.
  Anthony


Your're right, but. the parsing will be executed before the inclusion, the
destiny page will receive a formed html string to embed there, not a
template to be parsed. so to share values needs to use globals.


Re: [web2py] Best way to re-use snippet of HTML

2011-06-20 Thread Anthony
On Monday, June 20, 2011 9:54:16 PM UTC-4, rochacbruno wrote: 

 On Mon, Jun 20, 2011 at 10:40 PM, Anthony abas...@gmail.com wrote:
  
  {{include 'pat/to/file'}}

  Note, the template doesn't have to be purely static for the above to 
 work. Look at web2py_ajax.html, for example -- it is included in layout.html 
 but is not static.
  Anthony


 Your're right, but. the parsing will be executed before the inclusion, the 
 destiny page will receive a formed html string to embed there, not a 
 template to be parsed. so to share values needs to use globals.

 
I think the original template code is converted to pure Python before the 
inclusion, but the Python isn't executed (and therefore converted into the 
final parsed output) until all the extending and including is done. So, for 
a given view, the entire tree (of extended and included views) is built out 
before the Python is executed (the full tree is what is bytecode compiled). 
So, you can do:
 
def index():
return dict(message='Hello', othermessage='Goodbye')
 
In index.html:
 
{{=message}}
{{include 'otherview.html'}}
 
In otherview.html:
 
{{=othermessage}}
 
And the resulting page will say:
 
Hello
Goodbye
 
 
Anthony
 
 


Re: Re : Re: Re : Re: Re : Re: [web2py] Re: Email invitation

2011-06-20 Thread Massimo Di Pierro
My mistake, should have been

form.errors.update({'email':'not allowed'})

By adding the error message it prevent the user from registering
(because he does not have a valid token).

You do not need to pay me for help in this list but I will not refuse
a donation. ;-)

Massimo

On Jun 20, 8:16 pm, Dwayne dwaynebl...@gmail.com wrote:
 Dear Massimo,

 Thank you very much. I'll send you the 30 dollars if it works :)

 I have a problem. I cannot compile :

 auth.settings.register_onvalidation.append(lambda form:
 db.invitation(token=form.vars.email) or
 form.errors.update({'email','not allowed'}))

 Why do I need : form.errors.update({'email','not allowed'}) ?

 Thank you very much !

 Dwayne

 On 20 juin, 02:09, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  OK try this:

  definvitation():
      form = SQLFORM.factory(Field('email',requires=IS_EMAIL()))
      if form.accepts(request):
          db.invitation.insert(token = form.vars.email)
          MESSAGE = 'click %s to register'
          url = URL('user/register',host=request.env.http_host)
          mail.send(to=form.vars.email, message=MESSAGE % url)
          redirect('success_invitation'))
      return dict(message=('Invitationto be sent'),
                  form=form,address=form.vars.email)

  auth.settings.register_onvalidation.append(lambda form:
  db.invitation(token=form.vars.email) or
  form.errors.update({'email','not allowed'}))
  auth.settings.register_onaccept.append(lambda form:
  db(db.invitation.token==form.vars.email).delete())

  On Jun 4, 9:28 am, Dwayne Blind dwaynebl...@gmail.com wrote:

   Can somebody please help me ? I would really want this to work.

   I customized db.auth_user, as described in the book, to add a 'token'
   field. I just added : Field('token', writable=False, readable=False,
   default='').

   Then, in the controllers, I modified default.py :

   def user():
       db.auth_user.insert(token=request.args(1))
       return dict(form=auth())

   Then in the models, I modified db.py :

   def my_auth_processing(form):
       if db(db.auth_user.token!='')
   (db.invitation.token==db.auth_user.token):
           return True
       else :
           return False

   auth.settings.register_onvalidation.append(lambda form:
   my_auth_processing(form))

   But unfortunately no one is prevented from registering... So this does
   not work.

   Dwayne

   On 2 juin, 02:31, pbreit pbreitenb...@gmail.com wrote:

Oops. For registration, you use 
this:http://web2py.com/book/default/chapter/08?search=register_onvalidation-Masquer
 le texte des messages précédents -

  - Afficher le texte des messages précédents -