[web2py] Question about superfish menu and roles

2011-06-09 Thread salbefe
Hello,

I would like to use the superfish menu that is on the welcome
application but showing only some links depending the role the user
has. Is that possible??

Thanks in advance


[web2py] Problems using LOAD function

2011-06-01 Thread salbefe
Hello,

The following code before I updated web2py via mercurial worked well
for me. Now I get the following error if the ajax parameter is set to
False. If is set to True, there is no error but the place where the
view should be loaded is alway saying: loading... and nothing is
showed.

div class=unit
div class=container
div id=nav
{{=LOAD('default','menu',ajax=False)}}
/div
/div
/div

Traceback (most recent call last):
  File /var/web2py/gluon/restricted.py, line 184, in restricted
exec ccode in environment
  File /var/web2py/applications/init/views/default/ver_datos.html,
line 61, in module
td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td
  File /var/web2py/gluon/compileapp.py, line 135, in __call__
page = run_controller_in(c, f, other_environment)
  File /var/web2py/gluon/compileapp.py, line 429, in
run_controller_in
restricted(code, environment, filename)
  File /var/web2py/gluon/restricted.py, line 192, in restricted
raise RestrictedError(layer, code, '', environment)
RestrictedError

Any help, please??
Thanks in advance


[web2py] Re: Problems using LOAD function

2011-06-01 Thread salbefe
Massimo,

I have solved muy problem. My problem was that I had migrate=False in
the table 'menu' on db.py and I was using an older version of the
database where such table did not exist.

Sorry for the inconveniencie. When I have tried to visit
http:///init/default/menu is when I noticed myself.

Thanks for all


On 1 jun, 22:48, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 David and salbefe have different issues.

 @David

 web2py_component('quick_add_contact.load','contact_list')

 should be

 web2py_component('{{=URL('quick_add_contact.load'}}','contact_list')

 @salbefe

 what do you get if you visit this page?

 http:///init/default/menu

 My guess is you get a not-authorized error.

 On Jun 1, 3:16 pm, David J. da...@styleflare.com wrote:







  a
  href=javascript:web2py_component('quick_add_contact.load','contact_list')
  class=buttonQuick Add New Contacts/a

  On 6/1/11 4:02 PM, Massimo Di Pierro wrote:

   Please post the exact code you used

   {{=LOAD(.)}}

   the look at the source of the generated page and post that as well.

   On Jun 1, 2:58 pm, David J.da...@styleflare.com  wrote:
   I just upgraded the software to latest in trunk.

   I did explicitly use '.load'.

   It still happens.

   It loads the entire page into the target div.

   On 6/1/11 3:29 PM, Massimo Di Pierro wrote:

   I need more information here. Set ajax=True. What are the generated
   URLs (before and after the upgrade).
   I cannot reproduce the problem.
   LOAD('default','action') never appended the .load extension. You had
   to be explicit
   LOAD('default','action.load')
   Do you see the problem only with ajax=False?
   On Jun 1, 2:06 pm, David J.da...@styleflare.com    wrote:
   I also posted a message yesterday regarding the views and the load 
   function;
   It seems like if the URL has some additional 'args' LOAD returns the
   HTML view rather than the .load view.
   Thanks.
   On 6/1/11 2:23 PM, Massimo Di Pierro wrote:
   Please try
   LOAD('default','menu',ajax=True)
   you may get a ticket. Check what it says.
   On Jun 1, 12:34 pm, salbefesalb...@gmail.com      wrote:
   Hello,
   The following code before I updated web2py via mercurial worked well
   for me. Now I get the following error if the ajax parameter is set to
   False. If is set to True, there is no error but the place where the
   view should be loaded is alway saying: loading... and nothing is
   showed.
   div class=unit
                      div class=container
                              div id=nav
                                      
   {{=LOAD('default','menu',ajax=False)}}
                              /div
                      /div
   /div
   Traceback (most recent call last):
        File /var/web2py/gluon/restricted.py, line 184, in restricted
          exec ccode in environment
        File 
   /var/web2py/applications/init/views/default/ver_datos.html,
   line 61, inmodule
          td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td
        File /var/web2py/gluon/compileapp.py, line 135, in __call__
          page = run_controller_in(c, f, other_environment)
        File /var/web2py/gluon/compileapp.py, line 429, in
   run_controller_in
          restricted(code, environment, filename)
        File /var/web2py/gluon/restricted.py, line 192, in restricted
          raise RestrictedError(layer, code, '', environment)
   RestrictedError
   Any help, please??
   Thanks in advance


[web2py] Re: password encrypt during insert

2011-04-28 Thread salbefe
Hello,

Yo can do this:


db.auth_user.insert(first_name=...,last_name=...,email=...,password=db.auth_user.password.validate(myPassword))



On 28 abr, 08:36, 黄祥 steve.van.chris...@gmail.com wrote:
 hi,

 is there a way to input encrypted user password for the first time
 execution? i mean like
 e.g.
 db.auth_user.bulk_insert([{'first name' : 'a', 'last name' : 'a',
 'email' : 'a.a.com', 'password' : 'a'}, {'first name' : 'b', 'last
 name' : 'b', 'email' : 'b.b.com', 'password' : 'b'}])

 i can using this bulk insert but, the password didn't encryted. and
 the other is there alternative way to do that maybe something like :
 e.g.
 auth.add_user('first name', 'last_name', 'email', 'password')

 please give an advice or pointer about this,

 thank you very much before


[web2py] Re: password encrypt during insert

2011-04-28 Thread salbefe
I've been testing and I have the same problem as you. I tried with:

CRYPT()('yourpassword')[0] that I found in other posts but it does not
work too.

I think that we are missing something or that is a bug; perhaps Maximo
could help us.


On 28 abr, 13:42, Stifan Kristi steve.van.chris...@gmail.com wrote:
 hello,

 thank you so much for your pointer, salbefe. i can input the encrypted
 password but the result not like i've expected before. i mean there is an
 additional character on the field password.
 e.g.
     db.auth_user.bulk_insert([{'first_name' : 'a',
                                'last_name' : 'a',
                                'email' : 'a.a.com',
                                'password' :
 db.auth_user.password.validate('a')}])

 i created 1 user with password string '*a' (without quotes)*, and second 1
 register new password with the same password string '*a'** (without quotes)*,
 when i compare it on the db the result that i entered manual password
 string  '*a' (without quotes)* via register form is not match that i store
 on the database via python script. the differnetial on the password field is
 there is *|encrypted_password|None* when i put it via python script.

 maybe i've missed something, please give me a hints about this, thank you
 very much before.







 On Thu, Apr 28, 2011 at 3:19 PM, salbefe salb...@gmail.com wrote:
  Hello,

  Yo can do this:

  db.auth_user.insert(first_name=...,last_name=...,email=...,password=db.auth_user.password.validate(myPassword))

  On 28 abr, 08:36, 黄祥 steve.van.chris...@gmail.com wrote:
   hi,

   is there a way to input encrypted user password for the first time
   execution? i mean like
   e.g.
   db.auth_user.bulk_insert([{'first name' : 'a', 'last name' : 'a',
   'email' : 'a.a.com', 'password' : 'a'}, {'first name' : 'b', 'last
   name' : 'b', 'email' : 'b.b.com', 'password' : 'b'}])

   i can using this bulk insert but, the password didn't encryted. and
   the other is there alternative way to do that maybe something like :
   e.g.
   auth.add_user('first name', 'last_name', 'email', 'password')

   please give an advice or pointer about this,

   thank you very much before


[web2py] Re: password encrypt during insert

2011-04-28 Thread salbefe
it works for me !

Thanks a lot

On 28 abr, 17:02, Stifan Kristi steve.van.chris...@gmail.com wrote:
 thank you so much for your pointer, anthony, the encrypted password is
 without *|encrypted password|None.*
 i've compared with the manual that i put on the register form is same. (same
 password 'a' string)
 but, pardon there is strange behaviour during login, the user that i
 inserted via script couldn't login, but the manual one could login. is there
 anything i missed on my code?
 e.g.
     db.auth_user.bulk_insert([{'first_name' : 'a',
                                'last_name' : 'a',
                                'email' : 'a.a.com',
                                'password' :
 db.auth_user.password.validate('a')[0]}])

 thank you very much before.







 On Thu, Apr 28, 2011 at 9:46 PM, Anthony abasta...@gmail.com wrote:
  On Thursday, April 28, 2011 7:42:15 AM UTC-4, 黄祥 wrote:

  hello,

  thank you so much for your pointer, salbefe. i can input the encrypted
  password but the result not like i've expected before. i mean there is an
  additional character on the field password.
  e.g.
       db.auth_user.bulk_insert([{'first_name' : 'a',
                                 'last_name' : 'a',
                                 'email' : 'a.a.com',
                                 'password' :
  db.auth_user.password.validate('a')}])

  i created 1 user with password string '*a' (without quotes)*, and second
  1 register new password with the same password string '*a'** (without
  quotes)*, when i compare it on the db the result that i entered manual
  password string  '*a' (without quotes)* via register form is not match
  that i store on the database via python script. the differnetial on the
  password field is there is *|encrypted_password|None* when i put it via
  python script.

  the validate() method of the field runs the validator associated with the
  field, and the validator returns a (value, error) tuple (where error = None
  if the validation passed). So, when you run
  db.auth_user.password.validate('a'), you're getting back a tuple like
  (hashed_password, None). When you try to insert a list or tuple into a field
  via DAL, it converts the items in the list into a string separated by '|'
  characters, which is why you're getting |encrypted_password|None. So,
  instead, just insert the first item in the tuple returned by validate:
  db.auth_user.password.validate('a')[0]

  Anthony

  maybe i've missed something, please give me a hints about this, thank you
  very much before.

  On Thu, Apr 28, 2011 at 3:19 PM, salbefe sal...@gmail.com wrote:

  Hello,

  Yo can do this:

  db.auth_user.insert(first_name=...,last_name=...,email=...,password=db.auth_user.password.validate(myPassword))

  On 28 abr, 08:36, 黄祥 steve.van...@gmail.com wrote:
   hi,

   is there a way to input encrypted user password for the first time
   execution? i mean like
   e.g.
   db.auth_user.bulk_insert([{'first name' : 'a', 'last name' : 'a',
   'email' : 'a.a.com', 'password' : 'a'}, {'first name' : 'b', 'last
   name' : 'b', 'email' : 'b.b.com', 'password' : 'b'}])

   i can using this bulk insert but, the password didn't encryted. and
   the other is there alternative way to do that maybe something like :
   e.g.
   auth.add_user('first name', 'last_name', 'email', 'password')

   please give an advice or pointer about this,

   thank you very much before


[web2py] Question about custom registration form

2011-04-27 Thread salbefe
Hello,

In the application were are developing a user with the admin role has
to register the 'other users' that will have access to it.  We would
like to make a view that must have a form for registering users and a
list of the users that are currently registered (all in the same view)

For testing we did:

In the controlusers.py controller:

def index():

   form = auth.register()
   return dict(form=form)

In the view:

   {{if request.args(0)=='register':}}
 custom registration form
   {{pass}}

But this not work. When we try http://127.0.0.1/init/controlusers/ the
browser redirects to http://127.0.0.1/init/default/user/login

How could we make this kind of registration process??

Thanks in advance



[web2py] web2py last update from sources error: No module named simplejson.scanner

2011-03-01 Thread salbefe
I have downloaded last updates form
Hello,

I have downloaded last updates from the mercurial repository and when
I try to execute web2py :

 python web2py.py

I get the following error:

ImportError: No module named simplejson.scanner
File C:\web2py\web2py.py, line 16, in module
  import gluon.widget
File C:\web2py\gluon\widget.py, line 24, in module
  import main
File C:\web2py\gluon\main.py, line 68, in module
  from globals import Request, Response, Session
File C:\web2py\gluon\globals.py, line 25, in module
  from serializers import json, custom_json
File C:\web2py\gluon\serializers.py, line 9, in module
  import contrib.simplejson as simplejson
File C:\web2py\gluon\contrib\simplejson\__init__.py, line 111, in
module
  from decoder import JSONDecoder, JSONDecodeError
File C:\web2py\gluon\contrib\simplejson\decoder.py, line 7, in
module
  from simplejson.scanner import make_scanner


[web2py] Re: web2py last update from sources error: No module named simplejson.scanner

2011-03-01 Thread salbefe
Now is working,

Thanks !!

On 1 mar, 20:24, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Please check again.

 On Mar 1, 12:25 pm, salbefe salb...@gmail.com wrote:



  I have downloaded last updates form
  Hello,

  I have downloaded last updates from the mercurial repository and when
  I try to execute web2py :

   python web2py.py

  I get the following error:

  ImportError: No module named simplejson.scanner
  File C:\web2py\web2py.py, line 16, in module
    import gluon.widget
  File C:\web2py\gluon\widget.py, line 24, in module
    import main
  File C:\web2py\gluon\main.py, line 68, in module
    from globals import Request, Response, Session
  File C:\web2py\gluon\globals.py, line 25, in module
    from serializers import json, custom_json
  File C:\web2py\gluon\serializers.py, line 9, in module
    import contrib.simplejson as simplejson
  File C:\web2py\gluon\contrib\simplejson\__init__.py, line 111, in
  module
    from decoder import JSONDecoder, JSONDecodeError
  File C:\web2py\gluon\contrib\simplejson\decoder.py, line 7, in
  module
    from simplejson.scanner import make_scanner


[web2py] global name psycopg2 is not defined

2011-02-23 Thread salbefe
Hello,

I have read severals posts about this error before posting but no one
solves my problem.

I'm running web2py from sources on a windows xp machine with python
2.6.6. I have downloaded and installed the last binary stable psycopg2
3.2.1 driver for windows and last I have downloaded mod_wsgi-win32-
ap22py26-3.3.so - Apache 2.2 / Python 2.6 from cod.google.com. Apache
2.2 is running ok.

When I run web2py from command line, there is no problem and all works
ok. If I run web2py with apache 2.2 and mod_wsgi is when I get the
error: global name psycopg2 is not defined

I have tried to solve the problem uninstalling the psycopg2 binary
driver, and compiling the same from sources. The compilation process
is always ok and puts the .egg file on c:\Python26\Lib\site-packages;
the problem is with the compiled version of psycopg2 when I try to run
web2py from sources it not detects the psycopg2 driver and if I try to
import psycogp2 from the python command line I get an error saying
that some DLL's were not imported

I'm running a postgreSQL 9.0 server. Is it possible that I need some
devel postgres libraries??
¿¿Anyone knows how to solve this problem???

Thanks in advance.


[web2py] Re: global name psycopg2 is not defined

2011-02-23 Thread salbefe
Sorry, the psycopg2 binary driver is the 2.3.1 and the error I get
when I try to import psycopg2 on the compiled version is:

 import psycopg2
Traceback (most recent call last):
  File stdin, line 1 in module
  File build\bdist.win32\egg\psycopg2\__init__.py, line 69, in
module

  File build\bdist.win32\egg\psycopg2\_psycopg2.py, line 7, in
module
  File build\bdist.win32\egg\psycopg2\_psycopg2.py, line 6, in
__bootstrap__
ImportError: DLL load failed: No se puede encontrar el modulo
especificado.


On 23 feb, 12:21, salbefe salb...@gmail.com wrote:
 Hello,

 I have read severals posts about this error before posting but no one
 solves my problem.

 I'm running web2py from sources on a windows xp machine with python
 2.6.6. I have downloaded and installed the last binary stable psycopg2
 3.2.1 driver for windows and last I have downloaded mod_wsgi-win32-
 ap22py26-3.3.so - Apache 2.2 / Python 2.6 from cod.google.com. Apache
 2.2 is running ok.

 When I run web2py from command line, there is no problem and all works
 ok. If I run web2py with apache 2.2 and mod_wsgi is when I get the
 error: global name psycopg2 is not defined

 I have tried to solve the problem uninstalling the psycopg2 binary
 driver, and compiling the same from sources. The compilation process
 is always ok and puts the .egg file on c:\Python26\Lib\site-packages;
 the problem is with the compiled version of psycopg2 when I try to run
 web2py from sources it not detects the psycopg2 driver and if I try to
 import psycogp2 from the python command line I get an error saying
 that some DLL's were not imported

 I'm running a postgreSQL 9.0 server. Is it possible that I need some
 devel postgres libraries??
 ¿¿Anyone knows how to solve this problem???

 Thanks in advance.


[web2py] downloading a file

2011-02-20 Thread salbefe
Hello,

I have a controller that gets same data from a database and creates a
new file in excel format. These controller needs some time to write
out the content of the database.

In the view there is a form that when is submited calls this
controller. I need to download the file once this has been created but
I do not know how can I do this.

Anyone could help me , please?

Thanks in advance


[web2py] Orbited with web2py

2010-11-29 Thread salbefe
Hello,

I need to push some content in my website in 'real time'. I'm asking
if someone had tried orbited (http://orbited.org/). After reading this
post: Integrating Orbited with Web App Frameworks (http://orbited.org/
blog/2008/09/integrating-orbited-with-web-app-frameworks/) it seems
that it should not be any problem of integration with web2py (using
STOMP and RabbitMQ).

Anyway, I would like to known if someone had used it and if it could
post an example.


Thank you in advance


[web2py] Re: Orbited with web2py

2010-11-29 Thread salbefe
Thanks Candid !

It's a really good post to get started.


On 29 nov, 22:27, Candid roman.bat...@gmail.com wrote:
 I use orbited in one of my company's in-house web2py applications. It
 works great. I did not have to integrate it with web2py though - I use
 it as a completely independent message broker. There are some python
 scripts that run in background and process some stuff and send
 notifications to browser through orbited built-in stomp server. I
 think I used this tutorial to get 
 started:http://cometdaily.com/2008/10/10/scalable-real-time-web-architecture-...

 On Nov 29, 11:16 am, salbefe salb...@gmail.com wrote:







  Hello,

  I need to push some content in my website in 'real time'. I'm asking
  if someone had tried orbited (http://orbited.org/). After reading this
  post: Integrating Orbited with Web App Frameworks (http://orbited.org/
  blog/2008/09/integrating-orbited-with-web-app-frameworks/) it seems
  that it should not be any problem of integration with web2py (using
  STOMP and RabbitMQ).

  Anyway, I would like to known if someone had used it and if it could
  post an example.

  Thank you in advance


[web2py] number of logged users

2010-11-09 Thread salbefe
Hello,

I would like to know how can I obtain the number of the current users
that are logged on.


Thanks in advance!


[web2py] Re: cherokee problem with fastcgi and uWSGI

2010-09-10 Thread salbefe
Roberto, thank you for all your responses by I can't make this thing
working.

As you told me I did the following:

In a new terminal and as root I did :uwsgi --pythonpath /var/web2py --
module wsgihandler -s /tmp/
we2bpy.sock  --socket :9092 and this one too:

uwsgi --pythonpath /var/web2py --module wsgihandler --socket :9092

Then in cherokee-admin I created a new source as follows:


Type: remote host.
Nick: web2py
Connection : 127.0.0.1:9092

And then I have Virtual Sever - default and rule - Directory /

with all this config when I point to localhos I get: uWSGI Error, wsgi
application not found.


On 10 sep, 01:31, Roberto De Ioris robe...@unbit.it wrote:
  looking at /var/log/cherokee/error_log that is what I get:

  [uWSGI] parsing config file /var/web2py/config.xml
  *** Starting uWSGI 0.9.6 (32bit) on [Thu Sep  9 23:37:45 2010] ***
  compiled with version: 4.4.4 20100630 (Red Hat 4.4.4-10)
  Python version: 2.6.4 (r264:75706, Jun  4 2010, 18:20:16)
  [GCC 4.4.4 20100503 (Red Hat 4.4.4-2)]
  uWSGI running as root, you can use --uid/--gid/--chroot options
   *** WARNING: you are running uWSGI as root !!! (use the --uid flag)
  ***
  your memory page size is 4096 bytes
   *** WARNING: you have enabled harakiri without post buffering. Slow
  upload could be rejected on post-unbuffered webservers ***
  allocated 404 bytes (0 KB) for 1 request's buffer.
  Setting PythonHome to /var...
  'import site' failed; use -v for traceback
  binding on TCP port: 36986
  your server socket listen backlog is limited to 64 connections
  initializing hooks...done.
  'import site' failed; use -v for traceback
  added /var/web2py/ to pythonpath.
  interpreter for app 0 initialized.
  Traceback (most recent call last):
    File /var/web2py/wsgihandler.py, line 20, in module
      import os
  ImportError: No module named os
  *** uWSGI is running in multiple interpreter mode ***
  spawned uWSGI master process (pid: 3360)
  spawned uWSGI worker 1 (pid: 3361)
  'import site' failed; use -v for traceback
  added /var/web2py/ to pythonpath.
  interpreter for app 0 initialized.
  ImportError: No module named O ^H^P^G ^H^P
  [pid: 3361|app: -1|req: -1/1] 127.0.0.1 () {54 vars in 879 bytes} [Thu
  Sep  9 23:37:46 2010] GET / = generated 46 bytes in 2 msecs (HTTP/1.1
  500) 2 headers in 63 bytes (0 async switches on async core 0)

 Please run uWSGI independently from cherokee (its wizard is broken) with
 one of the configuration you find on the official uWSGI site.

 Then simply add a 'remote source' that point to the socket you have
 choosen and map it to the directory /

 All of your pythonpath and virtualenv are wrong.

 In one of the previous post you managed to run flawlessly with the
 embedded http server. Simply substitute --http with --socket

 --
 Roberto De Iorishttp://unbit.it


[web2py] Re: cherokee problem with fastcgi and uWSGI

2010-09-10 Thread salbefe
After downloading the current mercurial tip and after trying to
compile I get the following error:

[r...@tango uwsgi]# make -f Makefile.Py26
python2.6 uwsgiconfig.py --build
Traceback (most recent call last):
  File uwsgiconfig.py, line 83, in module
gcc_version = str(spcall2(%s -v % GCC)).split('\n')[-1].split()
[2]
  File uwsgiconfig.py, line 79, in spcall2
return p.stderr.read().rstrip().decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
787: ordinal not in range(128)
make: *** [all] Error 1


:((



On 10 sep, 10:49, Roberto De Ioris robe...@unbit.it wrote:
 Il giorno 10/set/2010, alle ore 10.36, salbefe ha scritto:





  Roberto, thank you for all your responses by I can't make this thing
  working.

  As you told me I did the following:

  In a new terminal and as root I did :uwsgi --pythonpath /var/web2py --
  module wsgihandler -s /tmp/
  we2bpy.sock  --socket :9092 and this one too:

  uwsgi --pythonpath /var/web2py --module wsgihandler --socket :9092

  Then in cherokee-admin I created a new source as follows:

  Type: remote host.
  Nick: web2py
  Connection : 127.0.0.1:9092

  And then I have Virtual Sever - default and rule - Directory /

  with all this config when I point to localhos I get: uWSGI Error, wsgi
  application not found.

 That is a step forward :)

 You should fix the SCRIPT_NAME, but it is an annoying task.

 Download the current mercurial tip (it is stable as it will be the 0.9.6.1) 
 and it will
 automagically manage the SCRIPT_NAME issue.

 In the mean time i have written an updated cherokee wizard that supports 
 xml,python,wsgi and ini files.
 --
 Roberto De Iorishttp://unbit.it
 JID: robe...@jabber.unbit.it


[web2py] Re: cherokee problem with fastcgi and uWSGI

2010-09-10 Thread salbefe
gcc -v

Usando especificaciones internas.
Objetivo: i686-redhat-linux
Configurado con: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/
bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --
enable-checking=release --with-system-zlib --enable-__cxa_atexit --
disable-libunwind-exceptions --enable-gnu-unique-object --enable-
languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --
disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-
jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-
ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-
redhat-linux
Modelo de hilos: posix
gcc versión 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)



On 10 sep, 11:32, Roberto De Ioris robe...@unbit.it wrote:
 Il giorno 10/set/2010, alle ore 11.17, salbefe ha scritto:





  After downloading the current mercurial tip and after trying to
  compile I get the following error:

  [r...@tango uwsgi]# make -f Makefile.Py26
  python2.6 uwsgiconfig.py --build
  Traceback (most recent call last):
   File uwsgiconfig.py, line 83, in module
     gcc_version = str(spcall2(%s -v % GCC)).split('\n')[-1].split()
  [2]
   File uwsgiconfig.py, line 79, in spcall2
     return p.stderr.read().rstrip().decode()
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
  787: ordinal not in range(128)
  make: *** [all] Error 1

  :((

 Can you post the output of

 gcc -v

 ?

 --
 Roberto De Iorishttp://unbit.it
 JID: robe...@jabber.unbit.it


[web2py] Re: cherokee problem with fastcgi and uWSGI

2010-09-10 Thread salbefe
Yes !! It's working now ! Thank you very much :)

Only one question more: because I'm running uWSGI independently from
cherokee, how can I do to start uWSGI at system startup?

Thanks a lot!

On 10 sep, 12:15, Roberto De Ioris robe...@unbit.it wrote:
 Il giorno 10/set/2010, alle ore 12.07, salbefe ha scritto:





  gcc -v

  Usando especificaciones internas.
  Objetivo: i686-redhat-linux
  Configurado con: ../configure --prefix=/usr --mandir=/usr/share/man --
  infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/
  bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --
  enable-checking=release --with-system-zlib --enable-__cxa_atexit --
  disable-libunwind-exceptions --enable-gnu-unique-object --enable-
  languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --
  disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
  --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-
  jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-
  ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-
  redhat-linux
  Modelo de hilos: posix
  gcc versión 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)

 Ok, retry with the latest tip (it was a problem with python3.k compatibility)

 --
 Roberto De Iorishttp://unbit.it
 JID: robe...@jabber.unbit.it


[web2py] cherokee problem with fastcgi and uWSGI

2010-09-09 Thread salbefe
Hello,

I'm trying to deploy web2py with cherokee on a fedora core 13 distro
but I have several problems on it. I have read  the slice web2py with
Cherokee via uWSGI: a simple, easy guide that it could be found in
web2pyslices but this guide is outdated because it seems to be done
for an older cherokee version than 1.X.X. Current cherokee version is
1.0.8

Some things are not clear to me:

1.- For example where should be web2py: on /var/web2py or /var/www/
web2py. After reading the slice it seems that it should be on /var/
web2py.
2.- www-data user does not exist on fedora distro so where it says
sudo chown -hR www-data\: /var/web2py I did sudo chown -hR root\: /
var/web2py
3.- Its impossible to follow steps E throught G because options
described there does not exists anymore in cherokee admin interface
and I could not find other places where they could be.

After trying to setup following more or less these steps when I point
to http://localhost I always get the cherokee test page.


The same problem with the steps that are on the online book to setup
cherokee with fastcgi interface. The steps described there should be
now a bit different to setup web2py with cherokee.


I need some help, please.
Thanks in advance!





[web2py] Re: cherokee problem with fastcgi and uWSGI

2010-09-09 Thread salbefe
Hello,

This works fine:

uwsgi --pythonpath /var/web2py --module wsgihandler -s /tmp/
we2py.sock  --http :9090

If I point to localhost:9090 works ok and I see the welcome
application.

After that:

If I make a config.xml file as is described on 
http://projects.unbit.it/uwsgi/wiki/Example
and I try with the virtualserver wizard to creat a uWSGI server I get
the following error:

/var/web2py/config.xml seems not to be a valid uWSGI xml configuration
file.

To get these step ok my config.xml file has to be the same as this:

uwsgi

pythonpath/var/web2py//pythonpath

app mountpoint=/

scriptwsgihandler/script

/app

/uwsgi


With this I unterstand that the new virtual server (called web2py)
is working because it's active and there is a green circle near the
name of the virtual server.

On the sources section, cherokee has created a new source with nick is
uWSGI 1
On the interpreter box the following: /usr/local/bin/uwsgi -s
127.0.0.1:57527 -t 10 -M -p 1 -C  -x /var/web2py/config.xml -H /var
On connection box: 127.0.0.1:57527
and Inherit Environment is enabled.


With all of this if I point to localhost...I get the cherokee test
page and not the welcome application.

Anyone has any idea?

Thanks in advance



On 9 sep, 15:30, Jose jjac...@gmail.com wrote:
 On 9 sep, 07:42, salbefe salb...@gmail.com wrote:

  Hello,

  I'm trying to deploy web2py with cherokee on a fedora core 13 distro
  but I have several problems on it. I have read  the slice web2py with
  Cherokee via uWSGI: a simple, easy guide that it could be found in
  web2pyslices but this guide is outdated because it seems to be done
  for an older cherokee version than 1.X.X. Current cherokee version is
  1.0.8

  Some things are not clear to me:

  1.- For example where should be web2py: on /var/web2py or /var/www/
  web2py. After reading the slice it seems that it should be on /var/
  web2py.

 This should not be important, I have it in /home/web2py

  2.- www-data user does not exist on fedora distro so where it says
  sudo chown -hR www-data\: /var/web2py I did sudo chown -hR root\: /
  var/web2py

 in my case (freebsd), user=www and group=www

  3.- Its impossible to follow steps E throught G because options
  described there does not exists anymore in cherokee admin interface
  and I could not find other places where they could be.

 GUI has changed but little, are looking to see that things are in the
 new user interface.

  The same problem with the steps that are on the online book to setup
  cherokee with fastcgi interface. The steps described there should be
  now a bit different to setup web2py with cherokee.

 FastCGI is similar to uwsgi. But I think the problem is that the GUI
 was changed in Cherokee.

  I need some help, please.

 In a few days I can write as I have configured my server, including
 screenshots of the new GUI Cherokee

 Regards,
 Jose


[web2py] Re: cherokee problem with fastcgi and uWSGI

2010-09-09 Thread salbefe
looking at /var/log/cherokee/error_log that is what I get:


[uWSGI] parsing config file /var/web2py/config.xml
*** Starting uWSGI 0.9.6 (32bit) on [Thu Sep  9 23:37:45 2010] ***
compiled with version: 4.4.4 20100630 (Red Hat 4.4.4-10)
Python version: 2.6.4 (r264:75706, Jun  4 2010, 18:20:16)
[GCC 4.4.4 20100503 (Red Hat 4.4.4-2)]
uWSGI running as root, you can use --uid/--gid/--chroot options
 *** WARNING: you are running uWSGI as root !!! (use the --uid flag)
***
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow
upload could be rejected on post-unbuffered webservers ***
allocated 404 bytes (0 KB) for 1 request's buffer.
Setting PythonHome to /var...
'import site' failed; use -v for traceback
binding on TCP port: 36986
your server socket listen backlog is limited to 64 connections
initializing hooks...done.
'import site' failed; use -v for traceback
added /var/web2py/ to pythonpath.
interpreter for app 0 initialized.
Traceback (most recent call last):
  File /var/web2py/wsgihandler.py, line 20, in module
import os
ImportError: No module named os
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 3360)
spawned uWSGI worker 1 (pid: 3361)
'import site' failed; use -v for traceback
added /var/web2py/ to pythonpath.
interpreter for app 0 initialized.
ImportError: No module named �O�^H^P^G�^H^P
[pid: 3361|app: -1|req: -1/1] 127.0.0.1 () {54 vars in 879 bytes} [Thu
Sep  9 23:37:46 2010] GET / = generated 46 bytes in 2 msecs (HTTP/1.1
500) 2 headers in 63 bytes (0 async switches on async core 0)


Perhaps this could help.
Thanks

On 9 sep, 19:44, Roberto De Ioris robe...@unbit.it wrote:
  Hello,

  This works fine:

  uwsgi --pythonpath /var/web2py --module wsgihandler -s /tmp/
  we2py.sock  --http :9090

  If I point to localhost:9090 works ok and I see the welcome
  application.

  After that:

  If I make a config.xml file as is described on
 http://projects.unbit.it/uwsgi/wiki/Example
  and I try with the virtualserver wizard to creat a uWSGI server I get
  the following error:

  /var/web2py/config.xml seems not to be a valid uWSGI xml configuration
  file.

  To get these step ok my config.xml file has to be the same as this:

  uwsgi

      pythonpath/var/web2py//pythonpath

      app mountpoint=/

      scriptwsgihandler/script

      /app

  /uwsgi

 I fear that Cherokee has an outdated wizard, you should be able
 to load every valid uWSGI xml file in it.

 I will try to send a patch to the Cherokee team ASAP.

 In the mean time do not use its wizard but simply add a remote source
 specifying the address of the uWSGI server

 --
 Roberto De Iorishttp://unbit.it


[web2py] Re: web2py 1.78.2

2010-05-18 Thread salbefe
Hello,

I'm getting this error when I try to star any of the app:

Ticket issued: admin/127.0.0.1.2010-05-18.10-39-45.4c56ac32-
d0db-4f64-98f0-9e3c1c93518b

Traceback (most recent call last):\n  File C:\\web2py\\gluon\
\main.py, line 381, in wsgibase\nserve_controller(request,
response, session)\n  File C:\\web2py\\gluon\\main.py, line 159, in
serve_controller\nrun_view_in(response._view_environment)\n  File
C:\\web2py\\gluon\\compileapp.py, line 456, in run_view_in\n
os.path.join(folder, \'views\'), context=environment)\n  File C:\
\web2py\\gluon\\template.py, line 625, in parse_template\n
lexers=lexers).to_string()\n  File C:\\web2py\\gluon\\template.py,
line 272, in __init__\nself.parse(text)\n  File C:\\web2py\\gluon\
\template.py, line 569, in parse\npre_extend_statements = len(top)
\nTypeError: object of type \'Content\' has no len()\n'

I have this error since I updated this morning via mercurial and
nothing is working. I can't see the ticket and the admin interface is
not working too.





On 18 mayo, 08:03, szimszon szims...@gmail.com wrote:
 1.78.3 seems to work correctly TNX.

 There is one thing left with web2py and squeeze, the simplejson
 thing... :-o

 On máj. 17, 19:25, mdipierro mdipie...@cs.depaul.edu wrote:

  You are right. It is possible it is not documented in the book and it
  is not your fault that it is not in the new template.py. Yet, this was
  discussed some time ago on this list and a lot of people rely on it. I
  think I added it to trunk. One problem remains with multiline comments
  but I think I can fix it easily since your code is very modular and
  readable. Anyway, let me know when you will have access to a computer
  with the code so you can check it too.

  Massimo

  On May 17, 11:59 am, Thadeus Burgess thade...@thadeusb.com wrote:

   Well, we only caught the bugs because a new version of web2py is released 
   :)

   Honestly, I don't see documentation for the

   {{if True:
      =i
   pass}}

   syntax anywhere, nor have I seen an example of this until now.

   --
   Thadeus

   On Mon, May 17, 2010 at 11:13 AM, mdipierro mdipie...@cs.depaul.edu 
   wrote:
The fact that it does not work with new engine has to be considered a
bug. I should have caught it before. I am now working to fix it. The
new engine will be 100% backard compatible.

I think I have already fixed this problem in trunk (please check it)
but there are still some issues with multiline strings like.

I think it is safe to safe to say we will have 1.78.3 by tomorrow with
all these problems fixed.

Please continue to report any probleme with this so they can be
addressed.
I apologize for not checking this before. We definitively more tests
for template.py

massimo

On May 17, 10:15 am, szimszon szims...@gmail.com wrote:
There is odd because I have a lot of code with
{{                 =some.var}}

and

{{if something:
    =T('something')
  pass}}

If it doesn't work with the new engine I have to do a lot of work :(

On máj. 17, 16:53, Thadeus Burgess thade...@thadeusb.com wrote:

 You cannot have random = signs in your view.

 The syntax is

 {{python code here}}

 {{=python variable here}}

 You MUST declare {{= with no space in between. the bracket and equal 
 sign.
 --
 Thadeus

 On Mon, May 17, 2010 at 2:23 AM, szimszon szims...@gmail.com wrote:
  default/index.html:
  --- cut -
  {{extend 'layout.html'}}

  {{try:}}{{=H2(message)}}{{except:}}{{=BEAUTIFY(response._vars)}}
  {{pass}}

  h3{{=T('Changes not in use:')}}/h3
  {{changes=db(db.web.modified==True).select(db.web.id,db.web.name,db.web.con
   troller)
   if len(changes)0:
     for douse in changes:
             =XML('[%s]br/'%A(T('Modified %(name)s config, use
  it!',dict(name=douse.name)),_href=URL(r=request,c=douse.controller,f='webdo
   use',args=douse.id)))
     pass
   else:
     =T('Web Nothing')
   pass}}
  br /
  {{changes=db(db.dns.modified==True).select(db.dns.id,db.dns.name,db.dns.con
   troller)
   if len(changes)0:
     for douse in changes:
             =XML('[%s]br/'%A(T('Modified %(name)s config, use
  it!',dict(name=douse.name)),_href=URL(r=request,c=douse.controller,f='dnsdo
   use',args=douse.id)))
     pass
   else:
     =T('DNS Nothing')
   pass}}

  --- cut -
  Ticket 127.0.0.1.2010-05-17.09-20-49.56d45b51-05f0-49b5-9b10-
  cd7e9a3212a6
  missing pass in view

  Error traceback

  Traceback (most recent call last):
   File /home/szimszon/fejlesztes/sajat/web2py/gluon/rocket.py, 
  line
  769, in run
     self.run_app(conn)
   File /home/szimszon/fejlesztes/sajat/web2py/gluon/rocket.py, 
  line
  1172, in run_app
     self.environ 

[web2py] Re: left outer join problem on db2

2010-05-13 Thread salbefe
Hello,

Only a question, at http://pypi.python.org/pypi/ibm_db/ there is a
Python DBI driver for DB2. Why web2py is still using ODBC?? Will not
be better to use this one instead of pyodbc??

Thanks

On 11 mayo, 16:27, mdipierro mdipie...@cs.depaul.edu wrote:
 Thank you. will look into it.

 Massimo

 On May 11, 6:31 am, Alexey Nezhdanov snak...@gmail.com wrote:

  Hi.
  I've come across another subtle problem with web2py's DAL running over IBM
 DB2database.
 DB2requires the left table to immidiatedly preceed the 'left outer join'
  keyword.
  IOW:
  select * from a, b left outer join c on c.a_id=a.id
  is incorrect. Correct form is:
  select * from b, a left outer join c on c.a_id=a.id
  it looks moronish enough, but alas, we have to live with it.

  I have modified my local copy of web2py to satisfy this requirement.
  Please note that this sample can not be copypasted into web2py's sql.py as
  is because of full_table_name wrapper that I added to solve another problem
  - schemas support. But replacing 'full_table_name(db, t)' with just 't'
  should work just fine.

              join = attributes['left']
              command = self._db._translator['left join']
              if not isinstance(join, (tuple, list)):
                  join = [join]
              joint = [t._tablename for t in join if not isinstance(t,
                       SQLJoin)]
              joinon = [t for t in join if isinstance(t, SQLJoin)]
              tables_to_merge={}

  [tables_to_merge.update(dict.fromkeys(parse_tablenames(str(t.query for t
  in joinon]
              joinont = [t.table._tablename for t in joinon]
              [tables_to_merge.pop(t) for t in joinont if t in
  tables_to_merge]
              important_tablenames = joint + joinont + tables_to_merge.keys()
              excluded = [t for t in tablenames if not t in
  important_tablenames ]
              sql_t = ', '.join([full_table_name(self._db, t) for t in
  excluded + tables_to_merge.keys()])
              if joint:
                  sql_t += ' %s %s' % (command, ',
  '.join([full_table_name(self._db, t) for t in joint]))
              for t in joinon:
                  sql_t += ' %s %s' % (command, str(t))

  Regards
  Alexey


[web2py] Re: jquery click function problem

2010-05-08 Thread salbefe
Thank you Massimo !!

Regards

On 7 mayo, 23:22, mdipierro mdipie...@cs.depaul.edu wrote:
 Because scripts are not executed in ajax loaded content. It is a
 browser thing. It is not in the specs. You can do

 div class=one id=a onclick=jQuery('.two').slideToggle()Hello/
 div
 div class=two id=bWorld/div

 this will work because the code is executed onclick and not on ajax
 load.

 Massimo

 On May 7, 12:22 pm, salbefe salb...@gmail.com wrote:

  Hello,

  First of all, I think I should say sorry because probably this is not
  the correct place to post the following problem but I'm getting crazy.

  My problem with jquery is as follows:

  On a view I have a form that is submited via web2py ajax method.
  Something like this

  []
  form id=do_busqueda

  .
      div
           input type=submit name=btnSubmit id=btnSubmit
  value=Buscar class=btn /
       /div
  /form
  div id=empleados_list/div

  This form is submited like this:

  script
      jQuery('#do_busqueda').submit(function(){
      
      ...
      ajax({{=URL(r=request, c='presencia',
  f='do_busqueda')}},id_list, 'empleados_list');
          return false;
      });
  /script

  And this works fine. On div id=empleados_list/div appears a
  table filled with an employees list that is the view that the function
  do_busqueda builds. To try to explain better I have changed my view
  and I have replaced it  by the code that is on the  web2py book (2nd
  ed.) on pag 268.

  Now the fucntion do_busqueda renders this view:

  div class=one id=aHello/div
  div class=two id=bWorld/div
  script
      jQuery('.one').click(function(){jQuery('.two').slideToggle()});
  /script

  And...when is rendered does not work. In my case, the table that is
  rendered by the view do_busqueda.html has a checkbox and what I'm
  trying to do is that when the user clicks on a checkbox an alert
  message box should be displayed. I do not understand why this code
  does not work. Why is not executed??  Any ideas???

  Thanks in advance


[web2py] jquery click function problem

2010-05-07 Thread salbefe
Hello,

First of all, I think I should say sorry because probably this is not
the correct place to post the following problem but I'm getting crazy.

My problem with jquery is as follows:

On a view I have a form that is submited via web2py ajax method.
Something like this


[]
form id=do_busqueda

.
div
 input type=submit name=btnSubmit id=btnSubmit
value=Buscar class=btn /
 /div
/form
div id=empleados_list/div

This form is submited like this:

script
jQuery('#do_busqueda').submit(function(){

...
ajax({{=URL(r=request, c='presencia',
f='do_busqueda')}},id_list, 'empleados_list');
return false;
});
/script

And this works fine. On div id=empleados_list/div appears a
table filled with an employees list that is the view that the function
do_busqueda builds. To try to explain better I have changed my view
and I have replaced it  by the code that is on the  web2py book (2nd
ed.) on pag 268.

Now the fucntion do_busqueda renders this view:

div class=one id=aHello/div
div class=two id=bWorld/div
script
jQuery('.one').click(function(){jQuery('.two').slideToggle()});
/script

And...when is rendered does not work. In my case, the table that is
rendered by the view do_busqueda.html has a checkbox and what I'm
trying to do is that when the user clicks on a checkbox an alert
message box should be displayed. I do not understand why this code
does not work. Why is not executed??  Any ideas???

Thanks in advance


[web2py] prepolutating a SQLFORM.factory form

2010-04-16 Thread salbefe
Hello,

I have a SQLFORM.factory form that I need to prepopulate with some
data from a database.

id_nodo = request.args(0)

## I get the data from the database
nodo = db(db.node.id==id_nodo).select().first()
detalle = db(db.node_details.node_id==id_nodo).select().first()

 ##Now I need to prepolutate the fields title and body that I get from
the database
 ## title = nodo.title, body = detalle.body
 form = SQLFORM.factory(db.node.title,db.node_details.body)
if form.accepts(request.vars,session):

response.flash='Form accepted'

return dict(form=form)


As I read on this thread
http://groups.google.es/group/web2py/browse_thread/thread/e2301b5cc3acd8dc/2a8ea5a2fba49bed?hl=eslnk=gstq=SQLForm+with+two+tables#2a8ea5a2fba49bed
somebody with the same problem as me did the following:

user = db((db.user.id == req_user_id)  (db.addr.user ==
req_user_id)).select()[0]

db.user.id.default = user.user.id
db.user.name.default = user.user.name
db.user.email.default = user.user.email
db.addr.city.default = user.addr.city

form =
SQLFORM.factory(db.user.name,db.user.rname,db.addr.city)

if form.accepts(request.vars, session):

   # change the user data
   if change_user_data(user):
  user.user.update_record(name=form.vars.name) # 
  user.addr.update_record(city=form.vars.city) # 
  response.flash = 'form accepted'
   else:
  response.flash = 'form not accepted'
  redirect(URL(r=request,f='index'))

I do not understand  if change_user_data(user):

I have tried :

   db.node.title.default = nodo.title
   db.node_details.body = detalle.body
   form = SQLFORM.factory(db.node.title,db.node_details.body)
if form.accepts(request.vars,session):
   if change_node_data(node):
   ...
   ..

but I get an execption ('global name change_node_data is not defined'.
Could anyone tell me how can I prepolutate the SQLFORM.factory form???

Why is the function change_user_data used in that example if is not
defined 

Thanks in advance



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread salbefe
Thank you Massimo,

But

db.user.id.default = user.user.id
db.user.name.default = user.user.name
db.user.email.default = user.user.email
db.addr.city.default = user.addr.city

is the rigth way to preopulate a SQLFORM.factory form?

Why not once the form is defined, can I do form.vars.title =
'something' for example

Thanks

On 16 abr, 15:35, mdipierro mdipie...@cs.depaul.edu wrote:
 There is not such function.

 I think by

            if change_user_data(user):

 he actually means

            if user is allowed change do what he is trying to do:

 depending on the logicl you may not need this if statement at all.

 Massimo

 On Apr 16, 6:55 am, salbefe salb...@gmail.com wrote:

  Hello,

  I have a SQLFORM.factory form that I need to prepopulate with some
  data from a database.

  id_nodo = request.args(0)

  ## I get the data from the database
  nodo = db(db.node.id==id_nodo).select().first()
  detalle = db(db.node_details.node_id==id_nodo).select().first()

   ##Now I need to prepolutate the fields title and body that I get from
  the database
   ## title = nodo.title, body = detalle.body
   form = SQLFORM.factory(db.node.title,db.node_details.body)
      if form.accepts(request.vars,session):

          response.flash='Form accepted'

      return dict(form=form)

  As I read on this 
  threadhttp://groups.google.es/group/web2py/browse_thread/thread/e2301b5cc3a...
  somebody with the same problem as me did the following:

  user = db((db.user.id == req_user_id)  (db.addr.user ==
  req_user_id)).select()[0]

          db.user.id.default = user.user.id
          db.user.name.default = user.user.name
          db.user.email.default = user.user.email
          db.addr.city.default = user.addr.city

          form =
  SQLFORM.factory(db.user.name,db.user.rname,db.addr.city)

          if form.accepts(request.vars, session):

             # change the user data
             if change_user_data(user):
                user.user.update_record(name=form.vars.name) # 
                user.addr.update_record(city=form.vars.city) # 
                response.flash = 'form accepted'
             else:
                response.flash = 'form not accepted'
            redirect(URL(r=request,f='index'))

  I do not understand  if change_user_data(user):

  I have tried :

     db.node.title.default = nodo.title
     db.node_details.body = detalle.body
     form = SQLFORM.factory(db.node.title,db.node_details.body)
      if form.accepts(request.vars,session):
         if change_node_data(node):
         ...
         ..

  but I get an execption ('global name change_node_data is not defined'.
  Could anyone tell me how can I prepolutate the SQLFORM.factory form???

  Why is the function change_user_data used in that example if is not
  defined 

  Thanks in advance

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread salbefe
Thanks all,

Now is more clear to me.

-Salva

On 16 abr, 19:23, mdipierro mdipie...@cs.depaul.edu wrote:
 I would recommend

     db.data.field.default='value'
     form = crud.create(db.data, onaccept=give_update_permission)

 Massimo

 On Apr 16, 11:20 am, Mathieu Clabaut mathieu.clab...@gmail.com
 wrote:

  I have used form.element to prepopulate a form :

      form = crud.create(db.data, onaccept=give_update_permission)

      # add current date as default form

      form.element('input', _name=date)['_value'] =

   time.strftime(%Y-%m-%d)

  At this point, form is still not a string but an HTML Helper which provides
  DOM access (Correct me if I'm wrong).
  Are there some cons for this method (I prefer it as it does not alter the
  model defaults).

  -Mathieu

  On Fri, Apr 16, 2010 at 17:34, Thadeus Burgess thade...@thadeusb.comwrote:

   Because SQLFORM builds the HTML as soon as you instantiate the class.
   So you cannot edit anything after you create your form, since all of
   the html is already built, in strings.

   Specifying the default is the way to go here (annoying... I know).

   I usually perform the following

   if record_id:
     record = db.user[record_id]
     db.user.id.default = record.id
     db.user.name.default = record.name
     ... etc etc

   form = SQLFORM.factory(
    db.user.name, db.user.email, Field('CustomField', default='hi')
   )

   --
   Thadeus

   On Fri, Apr 16, 2010 at 9:57 AM, salbefe salb...@gmail.com wrote:
Thank you Massimo,

But

       db.user.id.default = user.user.id
       db.user.name.default = user.user.name
       db.user.email.default = user.user.email
       db.addr.city.default = user.addr.city

is the rigth way to preopulate a SQLFORM.factory form?

Why not once the form is defined, can I do form.vars.title =
'something' for example

Thanks

On 16 abr, 15:35, mdipierro mdipie...@cs.depaul.edu wrote:
There is not such function.

I think by

           if change_user_data(user):

he actually means

           if user is allowed change do what he is trying to do:

depending on the logicl you may not need this if statement at all.

Massimo

On Apr 16, 6:55 am, salbefe salb...@gmail.com wrote:

 Hello,

 I have a SQLFORM.factory form that I need to prepopulate with some
 data from a database.

 id_nodo = request.args(0)

 ## I get the data from the database
 nodo = db(db.node.id==id_nodo).select().first()
 detalle = db(db.node_details.node_id==id_nodo).select().first()

  ##Now I need to prepolutate the fields title and body that I get 
 from
 the database
  ## title = nodo.title, body = detalle.body
  form = SQLFORM.factory(db.node.title,db.node_details.body)
     if form.accepts(request.vars,session):

         response.flash='Form accepted'

     return dict(form=form)

 As I read on this threadhttp://
   groups.google.es/group/web2py/browse_thread/thread/e2301b5cc3a...
 somebody with the same problem as me did the following:

 user = db((db.user.id == req_user_id)  (db.addr.user ==
 req_user_id)).select()[0]

         db.user.id.default = user.user.id
         db.user.name.default = user.user.name
         db.user.email.default = user.user.email
         db.addr.city.default = user.addr.city

         form =
 SQLFORM.factory(db.user.name,db.user.rname,db.addr.city)

         if form.accepts(request.vars, session):

            # change the user data
            if change_user_data(user):
               user.user.update_record(name=form.vars.name) # 
               user.addr.update_record(city=form.vars.city) # 
               response.flash = 'form accepted'
            else:
               response.flash = 'form not accepted'
           redirect(URL(r=request,f='index'))

 I do not understand  if change_user_data(user):

 I have tried :

    db.node.title.default = nodo.title
    db.node_details.body = detalle.body
    form = SQLFORM.factory(db.node.title,db.node_details.body)
     if form.accepts(request.vars,session):
        if change_node_data(node):
        ...
        ..

 but I get an execption ('global name change_node_data is not 
 defined'.
 Could anyone tell me how can I prepolutate the SQLFORM.factory 
 form???

 Why is the function change_user_data used in that example if is not
 defined 

 Thanks in advance

 --
 Subscription settings:
  http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] custom registration form problem

2010-04-06 Thread salbefe
Hello,

I'm trying to do my custom registration form. I have some problems
with the password_two field.In my custom registration form
form.custom.widget.password_two does not work (when it renders I get a
None value) and as I could read on other thread (on august 2009) it is
said that  password_two is implemented without a widget
therefore this syntax does not work and that one solution to
customize the form is using:

input type=password name=password_two /
{{if regform.errors.password_two:}}div class=error
{{=regform.errors.password_two}}/div{{pass}}

Well, im my case, if I use the code above, it renders well, but the
form does not work as is expected.
For example,

{{=form.custom.begin}}

  {{=form.custom.widget.first_name}}
  {{=form.custom.widget.last_name}}
  {{=form.custom.widget.email}}
  {{=form.custom.widget.password}}
input type=password name=password_two /
{{if form.errors.password_two:}}div class=error
{{=form.errors.password_two}}/div{{pass}}
{{=form.custom.end}}

If I put a password on the password field (12345) and the following on
the password_two field (123456), web2py says Password fields don't
match and then redirects to the same registration form leaving the
fields password and password_two in blank and remaining the original
values on the other fields. If after this redirecion I press the
submit button (leaving the password field and the password_two field
in blank) web2py registers the user with the password field
value(12345) that was at the beginning.

What am I doing wrong???
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] Re: custom registration form problem

2010-04-06 Thread salbefe
I have notice that the welcome application has the same problem.

-- 
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] Re: problems using web2py ajax function

2010-03-28 Thread salbefe
Thanks,

Now is clear to me.

-- 
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] problems using web2py ajax function

2010-03-27 Thread salbefe
Hello,

With the following code:

div class=container style=color:#ff;text-align:center;
 span onclick=ajax('show_month',[3],'test'){{=month_str}}/
span
div id=test/div
/div

I get the following javascript error message:

document.getElementById(s[i]) is null

I do not why I'm getting that error. I think this code is very similar
to the same on page 274 of the web2py book.

-- 
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] register action redirects to profile view

2010-03-24 Thread salbefe
Hello,

I do not know why but on the default login form that I have on my
application, If I click on the register link web2py redirects to the
profile view.

The default/user controller is the same as the welcome application and
the default/user.html view the same.
That happens only on my app. The welcome app works fine.

Where can I have the problem???
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] Re: register action redirects to profile view

2010-03-24 Thread salbefe
... And the register link, links correctly to /init/dafult/user/
register

-- 
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] Re: register action redirects to profile view

2010-03-24 Thread salbefe
SOLVED. Something was happened with firefox
Sorry

-- 
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] custom login form doesn't return an errorm msg

2010-03-22 Thread salbefe
Hello,

I made a custom login form with the following code.

{{if request.args(0)=='login':}}
{{=form.custom.begin}}
Email:{{=form.custom.widget.email}}
Password:{{=form.custom.widget.password}}
{{=form.custom.submit}}
{{=form.custom.end}}


Now, when the user inputs an incorrect email or password I get
redirected to the same login form. I do not know how I can I get an
error message when the user inputs an incorrect email or password.

Thanks in advance

-- 
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] Re: custom login form doesn't return an errorm msg

2010-03-22 Thread salbefe
Hello Massimo,

I'm using a custom layout and I don't get any other flash messages.


On 22 mar, 15:08, mdipierro mdipie...@cs.depaul.edu wrote:
 Do you get other flash messages? do you have a custom layout?

 On Mar 22, 5:47 am, salbefe salb...@gmail.com wrote:



  Hello,

  I made a custom login form with the following code.

  {{if request.args(0)=='login':}}
  {{=form.custom.begin}}
  Email:{{=form.custom.widget.email}}
  Password:{{=form.custom.widget.password}}
  {{=form.custom.submit}}
  {{=form.custom.end}}

  Now, when the user inputs an incorrect email or password I get
  redirected to the same login form. I do not know how I can I get an
  error message when the user inputs an incorrect email or password.

  Thanks in advance

-- 
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] Re: DAL problems on Firebird 2.1 (DROP COLUMN DOES NOT WORK)

2010-03-08 Thread salbefe
It's working fine now.
Thanks.

On 8 mar, 05:03, mdipierro mdipie...@cs.depaul.edu wrote:
 Please check it. It is in.

 On Mar 6, 12:17 pm, Jose jjac...@gmail.com wrote:



  On 6 mar, 15:36, salbefe salb...@gmail.com wrote:

   I'm using the latest version from mercurial repository.

  I sent a patch to Massimo.

  Jose

-- 
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] DAL problems on Firebird 2.1 (DROP COLUMN DOES NOT WORK)

2010-03-06 Thread salbefe
Hello,

After successfully connecting to the database I tried altering the
definition of a table from this:

db.define_table('node_details',
Field('uid', 'integer', notnull=True),
Field('title', length='255'),
Field('body', 'text'),
Field('teaser', 'text'),
Field('node_id', db.node))
to this:

db.define_table('node_details',
Field('uid', 'integer', notnull=True),
Field('title', length='255'),
Field('body', 'text'),
Field('node_id', db.node))

I have drop the teaser field.

Then I refreshed the page, and I got this error:

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 173, in restricted
exec ccode in environment
  File C:/web2py/applications/init/models/db.py, line 77, in
module
Field('node_id', db.node))
  File C:\web2py\gluon\sql.py, line 1275, in define_table
t._create(migrate=migrate, fake_migrate=fake_migrate)
  File C:\web2py\gluon\sql.py, line 1734, in _create
fake_migrate=fake_migrate)
  File C:\web2py\gluon\sql.py, line 1788, in _migrate
self._db._execute(sub_query)
  File C:\web2py\gluon\sql.py, line 1067, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: (-104, 'isc_dsql_prepare: \n  Dynamic SQL Error\n
SQL error code = -104\n  Token unknown - line 1, column 31\n  COLUMN')

The output from sql.log is as follows:

ALTER TABLE node_details DROP COLUMN teaser;

The problems is that for dropping a column, firebird and interbase
doesn't accept the COLUMN  keywork, you should write ALTER TABLE tbl
DROP col instead of  ALTER TABLE tbl DROP COLUMN col

Regards
Salva

-- 
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] Re: DAL problems on Firebird 2.1 (DROP COLUMN DOES NOT WORK)

2010-03-06 Thread salbefe
I'm using the latest version from mercurial repository.

On 6 mar, 13:53, Jose jjac...@gmail.com wrote:
 On 6 mar, 09:14, salbefe salb...@gmail.com wrote:

  The output from sql.log is as follows:
  
  ALTER TABLE node_details DROP COLUMN teaser;

  The problems is that for dropping a column, firebird and interbase
  doesn't accept the COLUMN  keywork, you should write ALTER TABLE tbl
  DROP col instead of  ALTER TABLE tbl DROP COLUMN col

 this worked well. Perhaps in an update error was introduced.

 Jose

-- 
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] Re: DAL problems on Firebird 2.1 (DROP COLUMN DOES NOT WORK)

2010-03-06 Thread salbefe
Thank you.

Regards
Salva

On 6 mar, 19:17, Jose jjac...@gmail.com wrote:
 On 6 mar, 15:36, salbefe salb...@gmail.com wrote:

  I'm using the latest version from mercurial repository.

 I sent a patch to Massimo.

 Jose

-- 
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] Re: firebird error when tries to execute auth.defines_tables()

2010-03-05 Thread salbefe
Thank you,

I did as Villas said and is working fine but I do not understand the
DAL for checking reserved SQL keywords.

If put the following connection string : db = DAL('firebird://
SYSDBA:master...@localhost/c:\programas\ctodb.fdb',
check_reserved=['firebird']) I get the same error as if I didn't put
it.

What should happens when in the connection string appears
check_reserved=['firebird'] 

Regars

On 5 mar, 05:08, Thadeus Burgess thade...@thadeusb.com wrote:
 Also I added support so the DAL can check reserved SQL keywords.

 http://web2py.com/book/default/section/6/2

 -Thadeus



 On Thu, Mar 4, 2010 at 7:35 PM, villas villa...@gmail.com wrote:
  'Password' is a reserved word and causes a problem in Firebird.  Try
  this:

  auth=Auth(globals(),db)
  auth.settings.password_field='password2'   # Insert this line here.
  auth.define_tables(migrate=False)

  You can then work with a 'password2' field instead  :-)

  Regards,
  --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 
  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.



[web2py] firebird error when tries to execute auth.defines_tables()

2010-03-04 Thread salbefe
Hello,

I'm testing web2py with firebird 2.1 and I get the following error
when I try to connect:

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 173, in restricted
exec ccode in environment
  File C:/web2py/applications/init/models/db.py, line 34, in
module
auth.define_tables() # creates all needed
tables
  File C:\web2py\gluon\tools.py, line 797, in define_tables
format='%(first_name)s %(last_name)s (%(id)s)')
  File C:\web2py\gluon\sql.py, line 1275, in define_table
t._create(migrate=migrate, fake_migrate=fake_migrate)
  File C:\web2py\gluon\sql.py, line 1694, in _create
self._db._execute(query)
  File C:\web2py\gluon\sql.py, line 1067, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: (-104, 'isc_dsql_prepare: \n  Dynamic SQL Error\n
SQL error code = -104\n  Token unknown - line 6, column 5\n
password')

The problem comes with auth.define_tables(). If I comment this line,
web2py connects fine to firebird but it do not creates the necessary
tables to perform auth control.

In my case, the connection string is as follows: db = DAL('firebird://
SYSDBA:master...@localhost/c:\programas\ctodb.fdb')

I'm using web2py 1.76.3 on windows and kinterbasdb 3.3.0-win32-py2.6.
I do not if its a bug or if I'm doing something wrong.

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] modular layout

2010-02-14 Thread salbefe
Hello,

I need to built a left sidebar from a database. In the main layout
file I have the following code:


div class=unit
 div class=container
{{include 'default/leftsidebar.html'}}
/div
/div


The problem is how I can built the leftsidebar. After reading chapter
5 in the web2py book is not clear to me.
It is possible to make a controller, reading the database inside that
controller and pass the result to the leftsidebar.html view???

Thanks in advance

-- 
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] Re: modular layout

2010-02-14 Thread salbefe
Another question

I would like a put a calendar on my website.


div class=unit
 div class=container
{{include 'default/calendar.html'}}
/div
/div

I know how to generate a calendar in python with html but is not clear
to me if I need a controller and then I should pass the variables that
I need to the calendar.html view or
I have to put all the python code inside the calendar.html view like
in chapter 5 of the web2py book.

When people put http://mysite.com web2py should render the layout with
all the view modules that are inside the main layout file. If I need
to render, the current month, what I think is that I need a contoller
to get the current month, the days that month have and then pass all
that information to the view, in this case calendar.html. That view
will be rendered within the main layout.

I don't know how can I do that.
Thanks in advance
On 14 feb, 11:08, salbefe salb...@gmail.com wrote:
 Hello,

 I need to built a left sidebar from a database. In the main layout
 file I have the following code:
 
 
 div class=unit
      div class=container
             {{include 'default/leftsidebar.html'}}
     /div
 /div

 The problem is how I can built the leftsidebar. After reading chapter
 5 in the web2py book is not clear to me.
 It is possible to make a controller, reading the database inside that
 controller and pass the result to the leftsidebar.html view???

 Thanks in advance

-- 
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] Re: modular layout

2010-02-14 Thread salbefe
Thank you Massimo,  {{=LOAD('default','sidebar',ajax=True)}} has
solved my problem.

Thanks a lot

On 14 feb, 16:01, mdipierro mdipie...@cs.depaul.edu wrote:
 If you are not loading a page subset via ajax.
 Then your view includes another view, your one and only controller
 must generate all the variables needed by both views.

 On Feb 14, 5:54 am, salbefe salb...@gmail.com wrote:

  Another question

  I would like a put a calendar on my website.

  div class=unit
       div class=container
              {{include 'default/calendar.html'}}
      /div
  /div

  I know how to generate a calendar in python with html but is not clear
  to me if I need a controller and then I should pass the variables that
  I need to the calendar.html view or
  I have to put all the python code inside the calendar.html view like
  in chapter 5 of the web2py book.

  When people puthttp://mysite.comweb2pyshould render the layout with
  all the view modules that are inside the main layout file. If I need
  to render, the current month, what I think is that I need a contoller
  to get the current month, the days that month have and then pass all
  that information to the view, in this case calendar.html. That view
  will be rendered within the main layout.

  I don't know how can I do that.
  Thanks in advance
  On 14 feb, 11:08, salbefe salb...@gmail.com wrote:

   Hello,

   I need to built a left sidebar from a database. In the main layout
   file I have the following code:
   
   
   div class=unit
        div class=container
               {{include 'default/leftsidebar.html'}}
       /div
   /div

   The problem is how I can built the leftsidebar. After reading chapter
   5 in the web2py book is not clear to me.
   It is possible to make a controller, reading the database inside that
   controller and pass the result to the leftsidebar.html view???

   Thanks in advance

-- 
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:37948] Let Eclipse know about variables being passed into the controller at runtime

2009-12-28 Thread salbefe
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:36903] DB2 python driver

2009-12-09 Thread salbefe
Hello,

I would like to know which is the best way to connect to a DB2
database. Could I use for example, the PyDB2 module or have I to
connect through ODBC??


Thanks in advance.

--

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:23176] Re: should login redirect to index function after login?

2009-06-03 Thread salbefe

Thank you Massimo,

I will do in that way.

Kind Regards
Salva

On 3 jun, 06:28, mdipierro mdipie...@cs.depaul.edu wrote:
 This is a problem only if login is the entry point of your app and it
 should not be. If you always get to login from a redirection you
 should not have this problem.

 Massimo

 On Jun 2, 6:04 pm, salbefe salb...@gmail.com wrote:

  Annet,

  I found the problem but not the solution

  The login form that exposes  http:///[app]/default/user/login  has
  a hidden field called _next. This field at the beginning is empty.
  Because is empty web2py should redirect to auth.settings.login_next=URL
  (r=request, c='default', f='index').

  After a successfully login  the _next field has the following value:
  http://127.0.0.1:8000/prueba/default/user/login; I can't understand
  why it has that value if I didn't set it and why I'm not get
  redirected to URL(r=request, c='default', f='index') the first time
  that _next was empty.

  I'm still thinking that is a bug on the last version

  Kind regards
  Salva
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23104] Question related to models

2009-06-02 Thread salbefe

Hello,

To explain what I'm trying to say I will put an example.

For people that come from PHP frameworks like Zend or Code Igniter we
use the models on the following way:

First, we write each model on a file (like web2py) for example:


?php
class Usermodel extends Model {

function Usermodel()
{
// Call the Model constructor
parent::Model();

$this-load-database();

}

   function findUser($login)
   {
$sql = select * from users where login_name='$login';
$query = $this-db-query($sql);

$result = $query-result_array();
return $result;
   }
}
?

And second, we use that model on the controller like this:

?php
class Login_user extends Controller
{
function Login_user()
{
parent::Controller();

$this-load-model('Usermodel');
}

function index()
{
  ...
  $id_user = $this-Usermodel-findUser($login);

}
}
?

What I'm trying to say is that on these frameworks we use the models
to put all the related stuff with the sql queries. We call from the
controllers functions that are implemented on the models avoiding to
write sql queries on the controllers.

I said that because on web2py documentation I have seen models that
only describe the tables, fields, and other things related to the
database and in some examples I have seen on the controllers code
related to queries that in my opinion it should be on a model.

I do not if it's clear what I'm saying but could some one put an
example of how could I use the models in web2py on the same way that
for example in codeIgniter.

Thanks a lot



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23124] Re: Question related to models

2009-06-02 Thread salbefe

Thank you!!

On 2 jun, 16:23, SergeyPo ser...@zarealye.com wrote:
 This also looks like Ruby on Rails approach, however you can write
 your own classes in web2py, put them to models dir and use them as you
 have used to. E.g. you have an sql table 'users' in DAL, and you can
 write a class
 class Users:
     def findUser(login):
         u = db(db.users.login==login).select()
         return u[0] or None

 Your model definitions will  be automatically loaded if your class
 file name is alphabetically 'lower' than 'db' (you can always use
 underscores etc. tricks to achieve that).

 On Jun 2, 6:03 pm, JohnMc maruadventu...@gmail.com wrote:

  salbefe,

  I understand your point coming from a CakePHP utilization. But most of
  the PHP based frameworks naturally gravitate to using a lower level of
  abstraction when operating on the DB with a global namespace. What you
  will find with many Python based frameworks that they use an ORM (DAL,
  SQLAlchemy) the definitions are in the ORM. The actions on the dataset
  are in the controllers. The namespace is limited to the controller (ie
  python module)

  You could approximate your previous experience with PHP frameworks by
  construction of SQLQuery stored in vars in the models page itself.
  Then use those vars in the controllers/DAL to get your results. I have
  done that once as I knew the basis of the query was common and only
  the select differed across several controllers. You could probably go
  as far as writing a series of def's in the model py page to mimic the
  PHP style. But I have never tried it.

  But all that manipulation tends to fly in the face of good practice.
  One of which is to contain the actions in as small a namespace as is
  practical to get the job done.

  JohnMc

  On Jun 2, 6:14 am, salbefe salb...@gmail.com wrote:

   Hello,

   To explain what I'm trying to say I will put an example.

   For people that come from PHP frameworks like Zend or Code Igniter we
   use the models on the following way:

   First, we write each model on a file (like web2py) for example:

   ?php
   class Usermodel extends Model {

       function Usermodel()
       {
           // Call the Model constructor
           parent::Model();

           $this-load-database();

       }

      function findUser($login)
      {
           $sql = select * from users where login_name='$login';
           $query = $this-db-query($sql);

           $result = $query-result_array();
           return $result;
      }}

   ?

   And second, we use that model on the controller like this:

   ?php
   class Login_user extends Controller
   {
       function Login_user()
       {
           parent::Controller();

           $this-load-model('Usermodel');
       }

       function index()
       {
         ...
         $id_user = $this-Usermodel-findUser($login);

       }}

   ?

   What I'm trying to say is that on these frameworks we use the models
   to put all the related stuff with the sql queries. We call from the
   controllers functions that are implemented on the models avoiding to
   write sql queries on the controllers.

   I said that because on web2py documentation I have seen models that
   only describe the tables, fields, and other things related to the
   database and in some examples I have seen on the controllers code
   related to queries that in my opinion it should be on a model.

   I do not if it's clear what I'm saying but could some one put an
   example of how could I use the models in web2py on the same way that
   for example in codeIgniter.

   Thanks a lot
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23126] should login redirect to index function after login?

2009-06-02 Thread salbefe

Hello,

I don't know If I doing something wrong but I thought that after login
using @auth.requires_login() I should be redirected  to the index
function.

With this code, after login I remain on the loging screen: http://
127.0.0.1:8000/test/default/user/login


def index():

example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html

return dict(mensaje=Hello)



def user():

exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/register
http:///[app]/default/user/profile
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control

return dict(form=auth())

@auth.requires_login()
def test():

return dict()


Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23130] Re: should login redirect to index function after login?

2009-06-02 Thread salbefe

Thank you Annet

I have tried your code but I does not work :( . Inside the Auth class
source code I found this line of code inside the __init__ function :
self.settings.login_next = self.url('index'). I think that means that
after login it should be redirected to the index funtion.
Tht's what happens in this video tutorial http://www.vimeo.com/3703345;
after login it redirects to the index by default without any
particular settings. Perhaps is a bug?

Best regards,
Salva

On 2 jun, 17:56, annet.verm...@gmail.com wrote:
 I think this is what you're looking for:

 auth.settings.login_url=URL
 (r=request,c='authentication',f='user',args='login')
 auth.settings.login_next=URL(r=request,c='default',f='index')
 auth.settings.logout_next=URL(r=request,c='default',f='index')

 Kind regards,

 Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23146] Re: should login redirect to index function after login?

2009-06-02 Thread salbefe

Hello Annet,

I have set the URLs as you did in db.py, in my case:

auth.settings.login_url=URL(r=request, c='default', f='user/login')
auth.settings.login_next=URL(r=request, c='default', f='index')
auth.settings.logout_next=URL(r=request,c='default',f='index')

I think I do not need the first line because @auth.requires_login
exposes that url (user/login). The only diference with your code is
the first line.


In default.py I have the following functions

def index():

return dict(mensaje=Hola)

@auth.requires_login()
def test():

   return dict(mensaje=test)

def user():
return dict(form=auth())


when I try to go to http://127.0.0.1:8000/example/default/test web2py
redirects me to http://127.0.0.1:8000/example/default/user/login.
After a successful login web2py does not redirect to
http://127.0.0.1:8000/example/default/index

I have changed auth.settings.login_next=URL(r=request, c='core',
f='index') several times to other controllers but redirection does not
work. I can't understand what I'm doing wrong.

Thank you for your patience!

Salva
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23151] Re: should login redirect to index function after login?

2009-06-02 Thread salbefe

Annet,

Which version are you using??

Best regards
Salva


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23155] Re: should login redirect to index function after login?

2009-06-02 Thread salbefe

Annet,

I found the problem but not the solution

The login form that exposes  http:///[app]/default/user/login  has
a hidden field called _next. This field at the beginning is empty.
Because is empty web2py should redirect to auth.settings.login_next=URL
(r=request, c='default', f='index').

After a successfully login  the _next field has the following value:
http://127.0.0.1:8000/prueba/default/user/login; I can't understand
why it has that value if I didn't set it and why I'm not get
redirected to URL(r=request, c='default', f='index') the first time
that _next was empty.

I'm still thinking that is a bug on the last version

Kind regards
Salva
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23035] Re: web2y 1.63.1 posted

2009-06-01 Thread salbefe

Hello Massimo,

Only one question: what's new on this version??? It's possible to
known the changes between versions??

Thanks a lot.!!

On 1 jun, 17:17, mdipierro mdipie...@cs.depaul.edu wrote:
 web2y 1.63.1 posted
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:23036] Re: web2y 1.63.1 posted

2009-06-01 Thread salbefe

Sorry I found it

On 1 jun, 17:44, salbefe salb...@gmail.com wrote:
 Hello Massimo,

 Only one question: what's new on this version??? It's possible to
 known the changes between versions??

 Thanks a lot.!!

 On 1 jun, 17:17, mdipierro mdipie...@cs.depaul.edu wrote:

  web2y 1.63.1 posted
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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:22605] Re: Version reports a 1.62.3 (2009-05-19 23:25:03) as newest version

2009-05-25 Thread salbefe

Massimo, It happens on the mac version too.

Regards

On 25 mayo, 04:54, mdipierro mdipie...@cs.depaul.edu wrote:
 Yes, this is a known problem with the windows version. I will fix it
 asap.

 Massimo

 On May 24, 9:40 pm, Yannick ytchatch...@gmail.com wrote:



  Sorry maybe I don't understand but did you downloaded it from
  web2py.com ? Because from the website the latest version is still set
  as 1.62.3

  Thanks,
  Yannick P.

  On May 24, 10:11 pm, mikech mp.ch...@gmail.com wrote:

   But the windows version installs as (2009-05-19 23:24:39).  I've
   downloaded the newest zip from the site and deleted the root
   directory.  The version still shows as needing an update, how do I fix
   this?

   Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@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
-~--~~~~--~~--~--~---