[web2py] generating style attribute dinamically
Hello, I need to generate inside a div tag the style attribute dinamically, something like: 2 for some situations the following code works well: [...] elif day == current_day: stilo = 'style=\"font-weight:bold;\"' pass [...] {{=XML(day)}} The problem comes when I try to do the following [...] elif day == current_day: stilo1 = 'style=\"background-image:url("/init/static/li_dash.gif"); \"' pass [...] {{=XML(day)}} I have try to put "\" before each "/" too and does not work. Is not rendered well. Anyone knows the right way to insert this kind of code in python?? I come from the PHP world :( Thanks!
[web2py] jquery click function problem
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 [] . This form is submited like this: jQuery('#do_busqueda').submit(function(){ ... ajax("{{=URL(r=request, c='presencia', f='do_busqueda')}}",id_list, 'empleados_list'); return false; }); And this works fine. On 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: Hello World jQuery('.one').click(function(){jQuery('.two').slideToggle()}); 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] Re: jquery click function problem
Thank you Massimo !! Regards On 7 mayo, 23:22, mdipierro wrote: > Because s 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="b">World</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; > > }); > > > > > And this works fine. On 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: > > > Hello > > World > > > > jQuery('.one').click(function(){jQuery('.two').slideToggle()}); > > > > > 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] Re: left outer join problem on db2
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 wrote: > Thank you. will look into it. > > Massimo > > On May 11, 6:31 am, Alexey Nezhdanov 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: web2py 1.78.2
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 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 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 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 > > > 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 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 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 wrote: > > > >> > > default/index.html: > > > >> > > --- cut - > > > >> > > {{extend 'layout.html'}} > > > > >> > > {{try:}}{{=H2(message)}}{{except:}}{{=BEAUTIFY(response._vars)}} > > > >> > > {{pass}} > > > > >> > > {{=T('Changes not in use:')}} > > > >> > > {{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]'%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}} > > > >> > > > > > >> > > {{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]'%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 v
[web2py] Re: Problem after upgrading to 1.79.1
I have problems too after upgrading via mercurial (changeset 546) this moorning. I get the following errors: Traceback (most recent call last): File "C:\eclipse\plugins \org.python.pydev.debug_1.5.7.2010050621\pysrc\pydevd.py", line 978, in debugger.run(setup['file'], None, None) File "C:\eclipse\plugins \org.python.pydev.debug_1.5.7.2010050621\pysrc\pydevd.py", line 780, in run execfile(file, globals, locals) #execute the script File "C:\Documents and Settings\salbefe\workspace\web2py\web2py.py", line 17, in import gluon.widget File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \widget.py", line 28, in import main File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \main.py", line 34, in from globals import Request, Response, Session File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \globals.py", line 18, in from compileapp import run_view_in File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \compileapp.py", line 28, in from sql import SQLDB, SQLField, DAL, Field File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \sql.py", line 44, in from serializers import json File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \serializers.py", line 8, in from html import * File "C:\Documents and Settings\salbefe\workspace\web2py\gluon \html.py", line 20, in import decoder ImportError: No module named decoder On 8 jun, 10:24, Sverre wrote: > Solved according to this thread: > > http://groups.google.no/group/web2py/browse_thread/thread/43e46716642... > > On 8 Jun, 08:44, Sverre wrote: > > > Ok, I installed 1.77.3 and all is working. But with the current > > version I get communication errors. My python version is 2.6.4 on > > Ubuntu 10.04. How can I debug such a problem? > > > On 7 Jun, 20:16, mdipierro wrote: > > > > you upgraded from what? > > > > On Jun 7, 8:21 am, Sverre wrote: > > > > > After upgrading to 1.79.1 I can't change any sources with the admin > > > > interface because of a communication error.
[web2py] modular layout
Hello, I need to built a left sidebar from a database. In the main layout file I have the following code: {{include 'default/leftsidebar.html'}} 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
Another question I would like a put a calendar on my website. {{include 'default/calendar.html'}} 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 wrote: > Hello, > > I need to built a left sidebar from a database. In the main layout > file I have the following code: > > > > > {{include 'default/leftsidebar.html'}} > > > > 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
Thank you Massimo, {{=LOAD('default','sidebar',ajax=True)}} has solved my problem. Thanks a lot On 14 feb, 16:01, mdipierro 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 wrote: > > > Another question > > > I would like a put a calendar on my website. > > > > > > > {{include 'default/calendar.html'}} > > > > > > > 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 wrote: > > > > Hello, > > > > I need to built a left sidebar from a database. In the main layout > > > file I have the following code: > > > > > > > > > > > > > > > {{include 'default/leftsidebar.html'}} > > > > > > > > > > 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] firebird error when tries to execute auth.defines_tables()
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 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 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] Re: firebird error when tries to execute auth.defines_tables()
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 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 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] DAL problems on Firebird 2.1 (DROP COLUMN DOES NOT WORK)
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 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 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)
I'm using the latest version from mercurial repository. On 6 mar, 13:53, Jose wrote: > On 6 mar, 09:14, salbefe 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)
Thank you. Regards Salva On 6 mar, 19:17, Jose wrote: > On 6 mar, 15:36, salbefe 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: DAL problems on Firebird 2.1 (DROP COLUMN DOES NOT WORK)
It's working fine now. Thanks. On 8 mar, 05:03, mdipierro wrote: > Please check it. It is in. > > On Mar 6, 12:17 pm, Jose wrote: > > > > > On 6 mar, 15:36, salbefe 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] custom login form doesn't return an errorm msg
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
Hello Massimo, I'm using a custom layout and I don't get any other flash messages. On 22 mar, 15:08, mdipierro wrote: > Do you get other flash messages? do you have a custom layout? > > On Mar 22, 5:47 am, salbefe 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] register action redirects to profile view
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
... 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
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] problems using web2py ajax function
Hello, With the following code: {{=month_str}} 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] Re: problems using web2py ajax function
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] custom registration form problem
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: {{if regform.errors.password_two:}} {{=regform.errors.password_two}}{{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}} {{if form.errors.password_two:}} {{=form.errors.password_two}}{{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
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] prepolutating a SQLFORM.factory form
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=es&lnk=gst&q=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
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 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 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
Thanks all, Now is more clear to me. -Salva On 16 abr, 19:23, mdipierro 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 > 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 wrote: > > > > 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 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 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 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): > > > > >> >
[web2py] cherokee problem with fastcgi and uWSGI
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
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: /var/web2py/ wsgihandler 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 wrote: > On 9 sep, 07:42, salbefe 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
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 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" 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: > > > > > > /var/web2py/ > > > > > > wsgihandler > > > > > > > > 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: cherokee problem with fastcgi and uWSGI
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" 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 > > 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
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 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 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
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 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 > > 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
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 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] number of logged users
Hello, I would like to know how can I obtain the number of the current users that are logged on. Thanks in advance!
[web2py:23151] Re: should login redirect to index function after login?
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?
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:23176] Re: should login redirect to index function after login?
Thank you Massimo, I will do in that way. Kind Regards Salva On 3 jun, 06:28, mdipierro 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 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:36903] DB2 python driver
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:37948] Let Eclipse know about variables being passed into the controller at runtime
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:22365] Custom authentication form
Hello, I have the following question . It's possible to customize the forms that comes by default when web2py exposes then following urls? I mean, if in the controller I have the following function 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 """ return dict(form=auth()) and in the view the following code {{extend 'layout.html'}} {{=request.args[0].replace('_',' ').capitalize()}} {{=form}} I would like to customize the forms registrer, profile, etc, on the view but I do not know how. Could anyone help me, please!! Thanks in advance --~--~-~--~~~---~--~~ 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
Massimo, It happens on the mac version too. Regards On 25 mayo, 04:54, mdipierro wrote: > Yes, this is a known problem with the windows version. I will fix it > asap. > > Massimo > > On May 24, 9:40 pm, Yannick 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 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 -~--~~~~--~~--~--~---
[web2py:23035] Re: web2y 1.63.1 posted
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 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
Sorry I found it On 1 jun, 17:44, salbefe 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 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:23104] Question related to models
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: 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: 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
Thank you!! On 2 jun, 16:23, SergeyPo 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 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 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: > > > > > > 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: > > > > > > 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?
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?
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?
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] Orbited with web2py
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
Thanks Candid ! It's a really good post to get started. On 29 nov, 22:27, Candid 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 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] downloading a file
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] global name psycopg2 is not defined
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
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 "", line 1 in File "build\bdist.win32\egg\psycopg2\__init__.py", line 69, in File "build\bdist.win32\egg\psycopg2\_psycopg2.py", line 7, in 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 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] Re: global name psycopg2 is not defined
yes, with these binary version wsgi does not work. I read a post where someone post a solution: ImportError: DLL load failed - How to compile psycopg2 to make it cooperate with mod_wsgi. 1. install mingw 2. download psycopg2 3. setup.py build -c mingw32 4. replace "-lmsvcr90" with "-lmsvcrt" in build link step 5. execute link step again manually 6. setup.py install --skip-build 7. works for me ;-) The problem for me is how to execute link step again manually or how to tell distutils to change the msvc runtime library On 24 feb, 11:12, Oleg wrote: > have you triedhttp://www.stickpeople.com/projects/python/win-psycopg/?
[web2py] problems with web2py as service
Hello, I have a "strange" problem with web2py when running as service alone. When someone wants to see the website from internet, javascrit files and css files are not "served" correctly. It seems as if web2py embedded server "cuts" this type of files. When running from the command line I do not have any problems and the website works ok. I'm running web2py from sources. Tried on a windows xp and windows 7 machine with the same results. I have solved the problem using apache and mod_wsgi (on a windows machine)
[web2py] Re: global name psycopg2 is not defined
Thank you Oleg, But it does not work for me. I get always the same error. I have tried moving the wsgi directory to several places outside the htdocs and does not work. I get always "global name psycopg2 is not defined".I'm using the last binary driver from http://www.stickpeople.com. There is a comment on the link you have posted that says: "That should have problems as well as when mapping to a directory the trailing slash on URL where it mounts in WSGIScriptAlias line is important." Perhaps that is the key to get it working but I don't unterdand what it means. On 24 feb, 19:39, Oleg wrote: > You dont need to compile psycopg2 yourself. The problem you have, most > probable, you can not solve in this way. Take a look here, for > example:http://stackoverflow.com/questions/2160256/problem-install-and-run-ps...
[web2py] Re: global name psycopg2 is not defined
I have SOLVED IT !! I have to compile pyscopg2 but now it works !! 1. I added to the windows path variable ...\PostgrSQL\9.0\bin and ... \PostgrSQL\9.0\lib 2. install mingw 3. download psycopg2 4. setup.py build -c mingw32 5. setup.py install and now is working without problems. If ...\PostgrSQL\9.0\bin and ... \PostgrSQL\9.0\lib are not added to the path is were I have the problem with the "ImportError: DLL load failed2" when I try to import psycopg2. On 25 feb, 08:36, salbefe wrote: > Thank you Oleg, > > But it does not work for me. I get always the same error. I have tried > moving the wsgi directory to several places outside the htdocs and > does not work. I get always "global name psycopg2 is not defined".I'm > using the last binary driver fromhttp://www.stickpeople.com. There is > a comment on the link you have posted that says: > > "That should have problems as well as when mapping to a directory the > trailing slash on URL where it mounts in WSGIScriptAlias line is > important." > > Perhaps that is the key to get it working but I don't unterdand what > it means. > > On 24 feb, 19:39, Oleg wrote: > > > > > You dont need to compile psycopg2 yourself. The problem you have, most > > probable, you can not solve in this way. Take a look here, for > > example:http://stackoverflow.com/questions/2160256/problem-install-and-run-ps...
[web2py] web2py last update from sources error: No module named simplejson.scanner
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 import gluon.widget File "C:\web2py\gluon\widget.py", line 24, in import main File "C:\web2py\gluon\main.py", line 68, in from globals import Request, Response, Session File "C:\web2py\gluon\globals.py", line 25, in from serializers import json, custom_json File "C:\web2py\gluon\serializers.py", line 9, in import contrib.simplejson as simplejson File "C:\web2py\gluon\contrib\simplejson\__init__.py", line 111, in from decoder import JSONDecoder, JSONDecodeError File "C:\web2py\gluon\contrib\simplejson\decoder.py", line 7, in from simplejson.scanner import make_scanner
[web2py] Re: web2py last update from sources error: No module named simplejson.scanner
Now is working, Thanks !! On 1 mar, 20:24, Massimo Di Pierro wrote: > Please check again. > > On Mar 1, 12:25 pm, salbefe 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 > > import gluon.widget > > File "C:\web2py\gluon\widget.py", line 24, in > > import main > > File "C:\web2py\gluon\main.py", line 68, in > > from globals import Request, Response, Session > > File "C:\web2py\gluon\globals.py", line 25, in > > from serializers import json, custom_json > > File "C:\web2py\gluon\serializers.py", line 9, in > > import contrib.simplejson as simplejson > > File "C:\web2py\gluon\contrib\simplejson\__init__.py", line 111, in > > > > from decoder import JSONDecoder, JSONDecodeError > > File "C:\web2py\gluon\contrib\simplejson\decoder.py", line 7, in > > > > from simplejson.scanner import make_scanner
[web2py] Question about custom registration form
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] Re: password encrypt during insert
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, 黄祥 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
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 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 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, 黄祥 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
it works for me ! Thanks a lot On 28 abr, 17:02, Stifan Kristi 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 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 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, 黄祥 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] Problems using LOAD function
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. {{=LOAD('default','menu',ajax=False)}} 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 {{=locale.format("%.*f",(4,linea.vel_sonido),True)}} 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
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 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." wrote: > > > > > > > > > > href="javascript:web2py_component('quick_add_contact.load','contact_list')" > > class="button">Quick Add New Contacts > > > 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." 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." 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, salbefe 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. > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> {{=LOAD('default','menu',ajax=False)}} > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> 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 > > >>>>>> {{=locale.format("%.*f",(4,linea.vel_sonido),True)}} > > >>>>>> 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] Question about superfish menu and roles
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