[web2py] Re: get variables in view from other controller
It's that I need, with using [0][0] Can you explain that are it means? Does web2py return html like set of helpers? is [0][0] the first container's content of returned set (first div's content)? On 20 мар, 10:32, Anthony abasta...@gmail.com wrote: On Saturday, March 19, 2011 5:18:23 PM UTC-4, LightOfMooN wrote: no, it doesn't be a controller. But I can not use ajax too, because I need variables in template, but not the rendered block. (and I don't like that LOAD() loads components in new div, because it may cause a problems with css and jquery) As pbreit pointed out, if you don't want Ajax, you can use LOAD(..., ajax=False), and web2py will insert the content on the server side before delivering the page. In that case, I think the DIV that LOAD wraps around the content is unnecessary (as long as ajax_trap is also False -- looks like the DIV is used as the target for the Ajax response). Because LOAD is a helper, you should be able to do some manipulation of it to remove the outer DIV. So, maybe try something like this in your view: {{=LOAD('mycontroller', 'options', ajax=False)[0][0]}} Anthony
[web2py] Validators for webservices?
Hi all I'm looking for a way to validate the record data I receive from a webservice. Because there is no form associated it seems that I cannot use SQLFORM and form.accepts(). Is there any other way to use the already defined validators to do the check? I'm searching for something like (untested): @service.jsonrpc def update(record): errors = validate(db.mytable, record) if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == record.id).update(record) return dict(success=True) TIA - Marcel
[web2py] Re: Multiple forms grouped as one (django formset equivalent) with jquery plugin allowing clients to add and remove forms on the client-side
Thank you everyone for your help and suggestions. I realize Massimo must have like a million other things in his head right know and I don't hold it against him for not coming up with a recipe for this. :-) Again thank you Massimo for all the hard work you have put in to this great framework. As I mentioned on my first post I was evaluating web2py and Django to select which I would use for my project. I am sorry to say that I went the other way. At first web2py was looking more attractive and easy to learn and much more to my liking. I was convinced I would get things done faster and better than Django, but as I started digging deeper and deeper I realized this would not be the case. The main reasons for choosing Django are: * Better documentation * More mature * and just recently, a heck of a good IDE (PyCharm). [I hated having to write imports in every single file in django, with PyCharm its a bliss. ] Please don't get me wrong I am not trying to start a flame-war or anything. I still like web2py and I will continue to play with it. I even believe it helped me better understand some concepts about web programming in general. Thanks and keep up the good work. On Mar 9, 9:58 am, Tom Atkins minkto...@gmail.com wrote: The SheepIt jQuery plugin looks excellent - thanks for the link. I'll need to make this work with web2py sometime in the next couple of months. Hopefully someone else (not mentioning any names ;-) ) will provide some example code before then! On 9 March 2011 04:18, Dr Schmulge dr.schmu...@gmail.com wrote: Hi, Chris This is a briljant Jquery plugin, to clone form elements dynamically. http://www.mdelrosso.com/sheepit/index.php?lng=en_GBsec=home I hope it's useful to you. Regards, Janis
[web2py] passing value to xml
Hi! I'm using service.xml to return value and the call is: http://server.com/service.xml I'd like to pass a key value, so I can distinguish users. Is there a way to pass a key value? Any suggestions? I thought to just add a html view and pass the key through that and then use session to see if it's the same user, but I'd like to stay in XML even if I have to pass the key with every call. Thanks for help, Boštjan
Re: [web2py] Re: Best way to return all users who have a specific role?
Thanks for the replies. All is working OK now. Not sure what was happening yesterday. I think I was just having one of those days... In case anyone else comes across this thread - the advice below is good: use a normal shell and make sure to do a db.commit() On 19 March 2011 14:25, rochacbruno rochacbr...@gmail.com wrote: In shell you need to fire db.commit() to persist changes. Em 19/03/2011, às 10:23, Tom Atkins minkto...@gmail.com escreveu: Hmm - I spoke too soon. Database changes work OK from controllers but not from shell... On 19 March 2011 13:03, Tom Atkins minkto...@gmail.com minkto...@gmail.com wrote: Oops - my mistake - I was using Navicat to look at my sqllite database and had left it open. hence sqllite db was locked. On 19 March 2011 10:41, Tom Atkins minkto...@gmail.com minkto...@gmail.com wrote: Thanks Massimo - I was considering using accessible_query. However, I've now got a problem before I try that - auth.add_permission doesn't seem to be working: auth.add_permission(1, 'read', db.auth_user, 0) 1 but when I look in the auth_permission table there are no entries. I've tried this with alternative syntax: auth.add_permission(1, 'read', db.auth_user) 2 and tried other tables: auth.add_permission(1, 'read', db.post) 3 but still no entries in auth_permission. Any ideas? On 18 March 2011 20:08, Massimo Di Pierro massimo.dipie...@gmail.com massimo.dipie...@gmail.com wrote: If you have given explicit permission to the group: group_id=auth.add_group('Super Admin') auth.add_permission(group_id, 'read', db.mytable) then you can do: for row in db(auth.accessible_query('read', db.mytable)).select(db.mytable.ALL): print row in the case being discussed mytable is auth_user On Mar 18, 2:38 pm, Tom Atkins minkto...@gmail.com wrote: Thank you - yes the double hit on the database was what made it seem inelegant to me. Your joined query works fine and I can work with the return data. Any further improvements gratefully received! Hoping Massimo has an undocumented super 1 liner! ;-)
[web2py] AttributeError: 'Recaptcha' object has no attribute 'options'
Following the book, I do this in db.py, after auth has been instantiated. from gluon.tools import Recaptcha auth.settings.captcha = Recaptcha(request,'6LczqcISA...cAoH','6L...L2') and I get a ticket: AttributeError: 'Recaptcha' object has no attribute 'options' Any ideas? Traceback below. Ed G Traceback (most recent call last): File /opt/web-apps/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /opt/web-apps/web2py/applications/gw/views/default/user.html, line 99, in module File /opt/web-apps/web2py/gluon/globals.py, line 104, in write self.body.write(xmlescape(data)) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 1769, in xml return DIV.xml(newform) File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/tools.py, line 666, in xml SCRIPT(var RecaptchaOptions = {%s}; % self.options), AttributeError: 'Recaptcha' object has no attribute 'options'
Re: [web2py] Re: Where is the Shell ????
I think there was anything wrong with the version I downloaded for windows, downloaded the. src worked Thanks.{{ RESOLVED}} 2011/3/19 villas villa...@gmail.com Open a dos commandline window, navigate to the web2py directory, type: c:\web2py python web2py.py --help which shows all the options available. Try this: c:\web2py python web2py.py -N -M -S your_app_name_here This opens a shell in the context of your_app, then for example, you may be able to list your tables of that app with this command: db.tables See the book. On Mar 19, 11:05 pm, Ovidio Marinho ovidio...@gmail.com wrote: In version 1.93.2 the web2py not appear because the Shell? where is the Shel on Windows Vista. -- Ovidio Marinho Falcao Neto ovidio...@gmail.com Tecnologia da Informaçao Casa Civil do Governador 83 3214 7885 - 88269088 Paraiba -- Ovidio Marinho Falcao Neto ovidio...@gmail.com Tecnologia da Informaçao Casa Civil do Governador 83 3214 7885 - 88269088 Paraiba
[web2py] hierarchical authorization
Hi everybody, I have the following problem: I need some kind of hierarchical authorization. This is a simplified model: Company C001...C500 Departement D01...D15 Group G01...G40 Person P01...P30 Not every company has 15 departements, not every departement has 40 groups and so on, but the whole program should work with up 200.000 persons. Now some authorizations: - Every person is allowed to change most of (but not all) of his personal data. - Some persons are allowed to change some data of the members of a specified group or some groups or a departement. - Some persons are allowed to send messages single persons or to the members of a group or some groups or a departement or a company. - Some persons are allowed to change all data of the members of a group or some groups or a departement or a company. - Some persons are allowed to do everything (including impersonate) with all data of the members of a whole departement or company. - ... and so on ... One person could be identified by a string field like C003:D03:G12:P15. I think I could use the authorization and the decoration of web2py to allow one person to modify data or to send messages. - But how could I use the authorization e.g. to modify only some data? - And if somebody is allowed to change some data he should only see these persons he is allowed to make modifications. A sql-statement where ident like 'C003:D03:G12:% could do the job. - But would it be fast enough for 200.000 persons? - Is there any way to use theauthentization mechanism for this problem? Regards Martin
[web2py] Toggle on
Need to expand the state's stay tuned to hide the entries, showing the table so if you need to insert records oh yes I would use the toggler. Status default ON h1List Companies/h1 [a href=#nil onclick=jQuery('#form').slideToggle();toggle/a] div id=form No default = http://awesomescreenshot.com/0e99jmf89 Is default == http://awesomescreenshot.com/06b9jmj59 Ovidio Marinho Falcao Neto ovidio...@gmail.com Tecnologia da Informaçao Casa Civil do Governador 83 3214 7885 - 88269088 Paraiba
[web2py] Stumped on error: The end tag is unmatched, please check if you have a starting block tag
Hey guys, I'm stumped on this error that I'm getting. I recently upgraded from Web2py 1.79 to 1.93, and when viewing a certain, important, relatively complicated view file, I get this error. [The end tag is unmatched, please check if you have a starting block tag] And I can't, for the life of me, figure it out. The admin panel just returns that the Socket Timed Out, in the rocket.py. Could someone point me in the right direction, or maybe shed some light on exactly what end tag it's talking about?
[web2py] Re: Validators for webservices?
This: @service.jsonrpc def update(record): errors = validate(db.mytable, record) if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == record.id).update(record) return dict(success=True) should be @request.restful() def update: def PUT(id,**record): errors = db.mytbale._validate(**record).values() if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == id).update(**record) return dict(success=True) return locals() and call it with a PUT method at URL: /.../record id?field=value Massimo On Mar 20, 3:56 am, Marcel Luethi marcel.lue...@gmail.com wrote: Hi all I'm looking for a way to validate the record data I receive from a webservice. Because there is no form associated it seems that I cannot use SQLFORM and form.accepts(). Is there any other way to use the already defined validators to do the check? I'm searching for something like (untested): @service.jsonrpc def update(record): errors = validate(db.mytable, record) if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == record.id).update(record) return dict(success=True) TIA - Marcel
[web2py] Re: Stumped on error: The end tag is unmatched, please check if you have a starting block tag
Do you have something like {{end}} in your view? The old template parse was more forgiving when it comes to invalid templates and did not support blocks. On Mar 20, 9:11 am, Neodudeman tams...@gmail.com wrote: Hey guys, I'm stumped on this error that I'm getting. I recently upgraded from Web2py 1.79 to 1.93, and when viewing a certain, important, relatively complicated view file, I get this error. [The end tag is unmatched, please check if you have a starting block tag] And I can't, for the life of me, figure it out. The admin panel just returns that the Socket Timed Out, in the rocket.py. Could someone point me in the right direction, or maybe shed some light on exactly what end tag it's talking about?
[web2py] Re: Backup/Restore problem with web2py, postgres
What does this do exactly? Can you explain? I've seen fake_migrate a few times, but unsure what it does. Thanks. On Mar 20, 12:05 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: ask web2py to repair it auth.define_tables(fake_migrate=True) On Mar 19, 10:16 pm, VP vtp2...@gmail.com wrote: I've had problems with backup/restore. These could be very serious problems. So, with version 1.94.5, I simulated a backup/restore scenario and found a problem. 1. Backup up database with (psql_dump database database.sql) 2. Create another database (psql database2 database.sql) 3. Replace database in the connection string with database2. These 3 steps is to simulate a backup/restore scenario. The (uncompiled) codebase remains unchanged during these 3 steps. One would think this should work, but it doesn't; at least with my app. Here's the error's trackback: Traceback (most recent call last): File /home/username/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/username/web2py/applications/phim/models/db.py, line 42, in module auth.define_tables() # creates all needed tables File /home/username/web2py/gluon/tools.py, line 1177, in define_tables format='%(first_name)s %(last_name)s (%(id)s)') File /home/username/web2py/gluon/dal.py, line 3884, in define_table polymodel=polymodel) File /home/username/web2py/gluon/dal.py, line 581, in create_table self.create_sequence_and_triggers(query,table) File /home/username/web2py/gluon/dal.py, line 1575, in create_sequence_and_triggers self.execute(query) File /home/username/web2py/gluon/dal.py, line 1137, in execute return self.log_execute(*a, **b) File /home/username/web2py/gluon/dal.py, line 1134, in log_execute return self.cursor.execute(*a,**b) ProgrammingError: relation auth_user already exists = PS: btw, I'm not modifying auth in anyway. It's web2py's default.
[web2py] Re: Validators for webservices?
Massimo's method may be better -- I haven't personally experimented with the restful stuff yet. But you can still use SQLFORM or SQLFORM.factory with form.accepts() to run the validators. You just don't display the form anywhere if you don't need to. You also need to pass formname=None to accepts(). Doing this, form.accepts() will run your values through the validators, transform them as needed, and populate form.errors based on the GET and POST variables provided by whatever is calling your web service. Here's a simple example I cobbled together that adds two numbers. Example use: http://localhost:8000/app/controller/add?val1=3.14val2=2.718 def add(): form = SQLFORM.factory( Field('val1', 'double', requires=IS_FLOAT_IN_RANGE(0, 10)), Field('val2', 'double', requires=IS_FLOAT_IN_RANGE(0, 10)) ) if form.accepts(request.vars, formname=None): return form.vars.val1 + form.vars.val2 else: errors = Errors:\n for fieldname in form.errors: errors += %s: %s\n % (fieldname, form.errors[fieldname]) raise HTTP(400, errors) Cheers, Kevin
Re: [web2py] Re: Backup/Restore problem with web2py, postgres
It will create *.table files in your apps /database/ folder, but will not try to create those tables in database. In other words, it will fake creation of tables in db. I think :) Someone should confirm On Sun, Mar 20, 2011 at 3:40 PM, VP vtp2...@gmail.com wrote: What does this do exactly? Can you explain? I've seen fake_migrate a few times, but unsure what it does. Thanks. On Mar 20, 12:05 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: ask web2py to repair it auth.define_tables(fake_migrate=True) On Mar 19, 10:16 pm, VP vtp2...@gmail.com wrote: I've had problems with backup/restore. These could be very serious problems. So, with version 1.94.5, I simulated a backup/restore scenario and found a problem. 1. Backup up database with (psql_dump database database.sql) 2. Create another database (psql database2 database.sql) 3. Replace database in the connection string with database2. These 3 steps is to simulate a backup/restore scenario. The (uncompiled) codebase remains unchanged during these 3 steps. One would think this should work, but it doesn't; at least with my app. Here's the error's trackback: Traceback (most recent call last): File /home/username/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/username/web2py/applications/phim/models/db.py, line 42, in module auth.define_tables() # creates all needed tables File /home/username/web2py/gluon/tools.py, line 1177, in define_tables format='%(first_name)s %(last_name)s (%(id)s)') File /home/username/web2py/gluon/dal.py, line 3884, in define_table polymodel=polymodel) File /home/username/web2py/gluon/dal.py, line 581, in create_table self.create_sequence_and_triggers(query,table) File /home/username/web2py/gluon/dal.py, line 1575, in create_sequence_and_triggers self.execute(query) File /home/username/web2py/gluon/dal.py, line 1137, in execute return self.log_execute(*a, **b) File /home/username/web2py/gluon/dal.py, line 1134, in log_execute return self.cursor.execute(*a,**b) ProgrammingError: relation auth_user already exists = PS: btw, I'm not modifying auth in anyway. It's web2py's default.
[web2py] web2py Issues
Hello, Issue#1: I want make server validation, but when return the page again i want to be had the entered values: e.x: if request.vars[str(item.id)] == NO and request.vars[comment+str(item.id)] == : session.flash = Invalid Value redirect(URL(r=request,f='items',vars=request.vars)) // The previous code return an empty values. Issue#2: Is there a problem in function ajax() with version 1.91.6 . because when i used ajax('get_CIs', ['WO_cpp_id'], 'WO_ci_id'); The function get_CIs has been called fine but the request.vars.WO_cpp_id is None. Please, How i can fix the previous two issues? Thanks in Advance
[web2py] Re: web2py Issues
Hi Neveen, Without a bit more context I'm having trouble determining the problem. In principle you should be able to pass vars=request.vars to URL and have them show up in the redirected URL. For example: def func1(): if request.vars.value == hello: return you submitted hello else: redirect(URL('func2', vars=request.vars)) def func2(): return BEAUTIFY(request.vars) If you go to /app/controller/func1?name=Bob you will be redirected to /app/controller/func1?name=Bob, and request.vars will include a .name='Bob' attribute. If you go to /app/controller/func2?name=Bobvalue=hello you'll stay at func1 and see you submitted hello. Try starting with that example, verifying that it works for you, and then extending it to do what you need. If you could describe a little more about what you are trying to do, and/or include a bit more of the code you're working with, I might be able to provide more help. There may be a better way to do this already built in to web2py. Cheers, Kevin
[web2py] web2py pycon 2011 tutorial video - second part
hi, does anybody know where can i find second part of this video : http://blip.tv/file/4879126 tia Arek
[web2py] Changelog version number 1.64.4 - 1.94.4
Hi Massimo, The latest changelog entry shows 1.64.4 rather than 1.94.4. The same thing happened with 1.93... have you checked to see if your keyboard is upside-down? :-) Also, should there be a 1.94.5? Cheers, Kevin
[web2py] Re: web2py pycon 2011 tutorial video - second part
As I understand it, there was an error and the second part unfortunately did not get recorded. Cheers, Kevin
[web2py] Re: web2py pycon 2011 tutorial video - second part
Kevin is right, see http://groups.google.com/group/web2py/msg/b8da12857b5aa014?hl=en On Mar 20, 12:12 pm, Kevin Ivarsen kivar...@gmail.com wrote: As I understand it, there was an error and the second part unfortunately did not get recorded. Cheers, Kevin
[web2py] Re: web2py pycon 2011 tutorial video - second part
ok, thanks On Mar 20, 5:14 pm, DenesL denes1...@yahoo.ca wrote: Kevin is right, seehttp://groups.google.com/group/web2py/msg/b8da12857b5aa014?hl=en On Mar 20, 12:12 pm, Kevin Ivarsen kivar...@gmail.com wrote: As I understand it, there was an error and the second part unfortunately did not get recorded. Cheers, Kevin
[web2py] Converting legacy MySQL databases to web2py DAL
Hi folks, Today I made some enhancements to the web2py/scripts/extract_mysql_models.py script that converts existing MySQL tables into a DAL representation. I've attached a copy for anyone that might find it useful. The major changes are as follows: - I got rid of the dependencies on the external mysql and mysqldump executables and now use MySQLdb directly. This simplifies the parsing a lot and makes the tool a little more self-contained. (Linux users probably have the mysql command line tools installed, but Windows users may not -- at least not in the PATH) - If your id column does not have the default id name, the script looks for an AUTO INCREMENT column and marks that with type id instead. - If you have a COMMENT specified in your MySQL table, it is added as a Python comment to the Field line - You are no longer restricted to localhost - you can read tables form remote databases - There are several new command line options, such as: --dalname (specify the variable name used for the DAL; e.g. [var] = DAL(...); [var].define_table(...)) --colcomments (add a comment to the end of each Field line showing the original column specification from CREATE TABLE... useful for nothing things like default values, original datatype, etc.) --commentalign (aligns comments to some number of spaces in the generated text) --notnull (detects NOT NULL and adds notnull=True to Field) --singlemigrate (use a single migrate=False in DAL() rather than in each define_table()) --verbose (adds logging to stderr so that if it crashes, you have a chance of figuring out which table failed) You can see the full usage by running the script without any arguments. Example use: extract_mysql_models.py --user kevin --password secret --host example.com --database mywiki --dalname wikidb --colcomments --singlemigrate mywiki.py Generated output (only looks pretty with fixed-width formatting!): wikidb = DAL('mysql://kevin:sec...@example.com/mywiki', migrate=False) wikidb.define_table('comment', Field('id', 'id'), # (`id` int(11) NOT NULL AUTO_INCREMENT,) Field('page_id', 'integer'), # (`page_id` int(11) DEFAULT NULL,) Field('body', 'text'), # (`body` longtext,) Field('created_on', 'datetime'), # (`created_on` datetime DEFAULT NULL,) Field('created_by', 'integer'),# (`created_by` int(11) DEFAULT NULL,) ) wikidb.define_table('document', Field('id', 'id'), # (`id` int(11) NOT NULL AUTO_INCREMENT,) Field('page_id', 'integer'), # (`page_id` int(11) DEFAULT NULL,) Field('name', 'string'), # (`name` varchar(255) DEFAULT NULL,) Field('file', 'string'), # (`file` varchar(255) DEFAULT NULL,) Field('created_on', 'datetime'), # (`created_on` datetime DEFAULT NULL,) Field('created_by', 'integer'),# (`created_by` int(11) DEFAULT NULL,) ) wikidb.define_table('page', Field('id', 'id'), # (`id` int(11) NOT NULL AUTO_INCREMENT,) Field('body', 'text'), # (`body` longtext,) Field('created_on', 'datetime'), # (`created_on` datetime DEFAULT NULL,) Field('created_by', 'integer'),# (`created_by` int(11) DEFAULT NULL,) Field('title', 'string'), # (`title` varchar(255) DEFAULT NULL,) ) Massimo: feel free to integrate into the web2py source if you think it would be useful. Cheers, Kevin ''' Create the web2py code needed to access your mysql legacy db. This plugin needs the MySQLdb module Access your tables with: legacy_db(legacy_db.mytable.id0).select() If the script crashes this is might be due to that fact that the data_type_map dictionary below is incomplete. Please complete it, improve it and continue. Created by Falko Krause, minor modifications by Massimo Di Pierro, Ron McOuat, and Kevin Ivarsen ''' from optparse import OptionParser import re import sys import MySQLdb # If true, write some diagnostic messages to stderr. Overridden by -v option SHOW_LOG_MESSAGES = False data_type_map = dict( varchar = 'string', int = 'integer', integer = 'integer', tinyint = 'integer', smallint = 'integer', mediumint = 'integer', bigint = 'integer', float = 'double', double = 'double', char = 'string', decimal = 'integer', date = 'date', #year = 'date', time = 'time', timestamp = 'datetime', datetime = 'datetime', binary = 'blob', blob = 'blob', tinyblob = 'blob', mediumblob = 'blob', longblob = 'blob', text = 'text', tinytext = 'text', mediumtext = 'text', longtext = 'text', enum = 'string', ) def main(): options = parse_args() print
[web2py] Re: Changelog version number 1.64.4 - 1.94.4
I think I am upside down. Will fix it. On Mar 20, 11:12 am, Kevin Ivarsen kivar...@gmail.com wrote: Hi Massimo, The latest changelog entry shows 1.64.4 rather than 1.94.4. The same thing happened with 1.93... have you checked to see if your keyboard is upside-down? :-) Also, should there be a 1.94.5? Cheers, Kevin
[web2py] Re: AttributeError: 'Recaptcha' object has no attribute 'options'
There was a missing source line in 1.91.6 (and maybe others around the time). If you are running from source you can fix it by adding: self.options = options to the __init__ part of the Recaptcha class. Or upgrade to a newer version. On Mar 20, 7:44 am, Ed Greenberg greenberg...@gmail.com wrote: Following the book, I do this in db.py, after auth has been instantiated. from gluon.tools import Recaptcha auth.settings.captcha = Recaptcha(request,'6LczqcISA...cAoH','6L...L2') and I get a ticket: AttributeError: 'Recaptcha' object has no attribute 'options' Any ideas? Traceback below. Ed G Traceback (most recent call last): File /opt/web-apps/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /opt/web-apps/web2py/applications/gw/views/default/user.html, line 99, in module File /opt/web-apps/web2py/gluon/globals.py, line 104, in write self.body.write(xmlescape(data)) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 1769, in xml return DIV.xml(newform) File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/html.py, line 780, in xml (fa, co) = self._xml() File /opt/web-apps/web2py/gluon/html.py, line 771, in _xml self.components]) File /opt/web-apps/web2py/gluon/html.py, line 118, in xmlescape data = str(data) File /opt/web-apps/web2py/gluon/html.py, line 797, in __str__ return self.xml() File /opt/web-apps/web2py/gluon/tools.py, line 666, in xml SCRIPT(var RecaptchaOptions = {%s}; % self.options), AttributeError: 'Recaptcha' object has no attribute 'options'
[web2py] Re: web2py Issues
On Mar 20, 11:32 am, Neveen Adel nevo.a...@gmail.com wrote: Hello, Issue#1: I want make server validation, but when return the page again i want to be had the entered values: e.x: if request.vars[str(item.id)] == NO and request.vars[comment+str(item.id)] == : session.flash = Invalid Value redirect(URL(r=request,f='items',vars=request.vars)) Hard to tell without the action code but assuming that you are using form.accepts you should not redirect on form errors. // The previous code return an empty values. Issue#2: Is there a problem in function ajax() with version 1.91.6 . because when i used ajax('get_CIs', ['WO_cpp_id'], 'WO_ci_id'); The function get_CIs has been called fine but the request.vars.WO_cpp_id is None. Probably the action is returning an empty selection. Please, How i can fix the previous two issues? Thanks in Advance
[web2py] layouts and =include
Hi, I've just started to learning Web2py and I've found something strange for me. Could you please let me know if its me doing something wrong or its a Web2py limitation? I have some view (lets say: index.html) extending layout.html. But in layout.html I use include 'layout_body.html'. Now the problem: if I put {{include}} in the layout_body.html instead of layout.html it's not working. The structure looks like: index.html -- (extend) layout.html -- (include 'layout_body.html) layout_body.html -- {{include}} The final {{include}} is not executed... In other words it seems that the {{include}} works only if put in the root of the layout tree that is directly extended... Let me know please if its known limitation or I am doing something wrong. It's not a problem anyway - I can live without such functionality ;) however it's 'nice to have' and I dont see any reason for such limits.. thanks alot! Adam
[web2py] Re: layouts and =include
Hi kyrussa, Try the following: layout.html: Begin main layout {{include}} End main layout layout_body.html: {{extend layout.html}} Begin layout body {{include}} End layout body mypage.html {{extend layout_body.html}} This is my content When you render mypage, you should get: Begin main layout Begin layout body This is my content End layout body End main layout Hope that helps! Kevin
[web2py] Alternative for annoying default javascript integer/double/decimal validtors
Hi all, I find the default javascript validators for integer, double, and decimal SQLFORM fields to be a little annoying. Consider the following surprising behaviors: - You can't navigate within the textbox using the keyboard. Pressing left, right, home, or end all result in the cursor jumping back to the end of the input - You can't select text with ctrl-a or ctrl-shift-left/right - If the user accidentally flubs the input (e.g. 2.u1828 instead of 2.71828), the offending character is silently removed and an incorrect value may be submitted without warning. I think a better alternative is to flag to the user that the input is wrong rather than trying to correct it for them -- e.g. by changing the input background color. The following is a sample implementation that does this: -- in file web2py_ajax.html, replace the lines jQuery('input.integer').live... and jQuery('input.double,input.decimal').live... with: jQuery('input.integer').live('keydown keyup', function(){ if (! this.value.match(/^[+-]?[0-9]*$/)) { jQuery(this).addClass(w2p_inputerror); } else { jQuery(this).removeClass(w2p_inputerror); } }); jQuery('input.double,input.decimal').live('keydown keyup', function(){ if (! this.value.match(/^[+-]?[0-9]*\.?[0-9]*$/)) { jQuery(this).addClass(w2p_inputerror); } else { jQuery(this).removeClass(w2p_inputerror); } }); -- in file base.css, add the following style: input.w2p_inputerror { background: #FF8; } A few notes: 1. The regexes used to validate numbers are intentionally naive. For example. the double validator accepts +, -, +., and -., which are of couse not valid numbers. However, suppose the user enters a value between -1 and 0. They are likely to start by typing -., and I don't think it's polite to flash the textbox at them when they are about to enter a valid number. 2. The double validator does not permit scientific notation - e.g. 1e6 for 1 million. Such notation is probably of limited use for most people, the old validator rejected such values anyway, and I didn't feel like implementing it :-) 3. The jquery events listen to both keyup and keydown. keyup is necessary because the input.value has not yet been updated when keydown is fired. But listening to keydown is useful if the user holds down the backspace key - the background color will be reset as soon as the last offending character has been deleted, rather than waiting for the user to release the backspace key. 4. I used the class name w2p_inputerror in an attept to namespace this somewhat web2py-specific class. I hope some people find this to be useful. If other people have been annoyed by the current default, perhaps we could open discussion to make this the new default in web2py? Cheers, Kevin
[web2py] Re: passing value to xml
http://server.com/service.xml/x http://server.com/service.xml?key=x On Mar 20, 6:03 am, b0j3 boje...@gmail.com wrote: Hi! I'm using service.xml to return value and the call is: http://server.com/service.xml I'd like to pass a key value, so I can distinguish users. Is there a way to pass a key value? Any suggestions? I thought to just add a html view and pass the key through that and then use session to see if it's the same user, but I'd like to stay in XML even if I have to pass the key with every call. Thanks for help, Boštjan
[web2py] Re: layouts and =include
For another alternative which I think is more flexible, look at the {{block}} syntax. This lets you define multiple sections that can be overridden by an extending template. Example (untested): -- layout.html title{{block title}}My default title{{end}}/title script {{block scripts}} {{end}} /script div {{block content}} {{end}} /div -- view.html {{extend layout.html}} {{block title}}My new title{{end}} {{block scripts}} function foo() { return 1; }} {{end}} {{block content}} Hello world! {{end}} In this case, My default title would be replaced by My new title (but it would remain My default title if you did not specify a title block in view.html). The script and content values also get filled in as you would expect. Cheers, Kevin
[web2py] Re: passing value to xml
To expand on DenesL's reply, from your controller you would access these values in the following ways: For http://example.com/app/controller/service.xml/somevalue you would use: request.args(0) # returns somevalue, or None if nothing is provided For http://example.com/app/controller/service.xml?key=somevalue you would use: request.vars.get('key') # returns somevalue, or None if a key is not specified Hope that helps, Kevin
[web2py] Re: passing value to xml
Thanks, guys. That helped. I also found out (not reading the manual - manly I am), that putting @service.xml before the definition in controller means the xml return is somewhat mandatory, but you have to use xml in your URL e.g.: http://example.com/example/default/call/xml/controller/pass_value Boštjan On 20 mar., 20:14, Kevin Ivarsen kivar...@gmail.com wrote: To expand on DenesL's reply, from your controller you would access these values in the following ways: Forhttp://example.com/app/controller/service.xml/somevalueyou would use: request.args(0) # returns somevalue, or None if nothing is provided Forhttp://example.com/app/controller/service.xml?key=somevalueyou would use: request.vars.get('key') # returns somevalue, or None if a key is not specified Hope that helps, Kevin
[web2py] XML manipulation
Hi All, I would like to extract XML from a table and then manipulate it. The process being something like this in horrible pseudo-code: my table fields = id:1, name:Alan, price:5 xmldata = table.xml transform xmldata, e.g. xmldata.replace_element_name('name', 'newname') xmldata.replace_element_value('price', '8') return xmldata Output: item id1/id newnameAlan/newname price8/price / item I call my controller in browser and receive my transformed XML I guess it might use .xml and TAG for example. Has anyone got an example of doing what I want? Maybe I have to use lxml or even beautiful soup, but it seems that web2py already has all the ingredients. Regards, David
[web2py] Re: layouts and =include
Yes, thats what I am playing with now. Thanks :) Regards Adam
[web2py] Re: XML manipulation
OK I found a way (it was of course easier than I thought!). However, if anyone has any interesting XML resources/tips, I would still be interested to learn more. Thanks!
[web2py] Re: Validators for webservices?
Hi Massimo After upgrading to 1.94.5 it works perfectly. Thank you very much! Is there anywhere some documentation regarding request.restful() besides your video and the thread here on Google groups? Great stuff! Regards, Marcel On 20 Mrz., 15:20, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This: @service.jsonrpc def update(record): errors = validate(db.mytable, record) if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == record.id).update(record) return dict(success=True) should be @request.restful() def update: def PUT(id,**record): errors = db.mytbale._validate(**record).values() if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == id).update(**record) return dict(success=True) return locals() and call it with a PUT method at URL: /.../record id?field=value Massimo On Mar 20, 3:56 am, Marcel Luethi marcel.lue...@gmail.com wrote: Hi all I'm looking for a way to validate the record data I receive from a webservice. Because there is no form associated it seems that I cannot use SQLFORM and form.accepts(). Is there any other way to use the already defined validators to do the check? I'm searching for something like (untested): @service.jsonrpc def update(record): errors = validate(db.mytable, record) if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == record.id).update(record) return dict(success=True) TIA - Marcel
[web2py] Re: Validators for webservices?
Hi Kevin Thanks for your input! This is a valuable solution. But I would still need to add all my already existing validators to SQLFORM.factory. Wouldn't I? Therefore I tried Massimo's solution first. Best regards, Marcel On 20 Mrz., 15:43, Kevin Ivarsen kivar...@gmail.com wrote: Massimo's method may be better -- I haven't personally experimented with the restful stuff yet. But you can still use SQLFORM or SQLFORM.factory with form.accepts() to run the validators. You just don't display the form anywhere if you don't need to. You also need to pass formname=None to accepts(). Doing this, form.accepts() will run your values through the validators, transform them as needed, and populate form.errors based on the GET and POST variables provided by whatever is calling your web service. Here's a simple example I cobbled together that adds two numbers. Example use:http://localhost:8000/app/controller/add?val1=3.14val2=2.718 def add(): form = SQLFORM.factory( Field('val1', 'double', requires=IS_FLOAT_IN_RANGE(0, 10)), Field('val2', 'double', requires=IS_FLOAT_IN_RANGE(0, 10)) ) if form.accepts(request.vars, formname=None): return form.vars.val1 + form.vars.val2 else: errors = Errors:\n for fieldname in form.errors: errors += %s: %s\n % (fieldname, form.errors[fieldname]) raise HTTP(400, errors) Cheers, Kevin
[web2py] setup.py to install web2py globally into the python env/virtualenv
Hello all, In an attempt to make web2py pip installable, so that I can use gluon as a module in other python programs, I created a setup.py that can be used to create a source dist for PyPI. Attached are the files that need to be placed in the web2py root directory. To create the source distribution: python setup.py sdist To install from the source distribution (After running the above command and using the sdist that it creates): python setup.py install After installing in your python env or virtualenv: To create a new web2py application directory: mkweb2pyenv path_to_project_dir To run web2py from a directory: runweb2py path_to_project_dir I hope this makes its way to web2py Trunk. A clone with the files included can be found at : https://code.google.com/r/lifeeth-pip I made a video of running an instance for those who like to watch: https://www.youtube.com/watch?v=f6cFkK2ZDPY -- Praneeth IRC: lifeeth new_files.tar.bz2 Description: BZip2 compressed data
[web2py] Re: How to build windows binary yourself?
OK, I've got a version that appears to build successfully - had to re-write the code to gather the list of data_files - reglob() didn't return files in expected format. It's working but currently is including a bunch of windows API files in the dist directory, so it would NOT be appropriate for public distribution as-is without removing those files first (Danger, Danger Will Robinson licensing issues!). I'll see if I can figure out how to exclude them in the first place or at least automatically remove them with a secondary batch script.
[web2py] Re: get variables in view from other controller
On Sunday, March 20, 2011 3:05:04 AM UTC-4, LightOfMooN wrote: It's that I need, with using [0][0] Can you explain that are it means? Does web2py return html like set of helpers? is [0][0] the first container's content of returned set (first div's content)? It looks like LOAD returns a __tag__ object, which contains a DIV object, which contains the rendered inner HTML (i.e., from the view called by LOAD). So, the [0][0] gets you the inner HTML (i.e., what's inside the DIV wrapper). Anyway, I *think* that's right -- someone else may know more. Anthony
Re: [web2py] Re: How to build windows binary yourself?
We have used http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/standalone_exe.py To build custom exes of web2py with certain modules added in. The above works with py2exe. Recently I have been using cxfreeze with my other projects - It appears to be way more simpler than py2exe. -- Praneeth IRC: lifeeth On Mon, Mar 21, 2011 at 4:06 AM, Brian M bmere...@gmail.com wrote: OK, I've got a version that appears to build successfully - had to re-write the code to gather the list of data_files - reglob() didn't return files in expected format. It's working but currently is including a bunch of windows API files in the dist directory, so it would NOT be appropriate for public distribution as-is without removing those files first (Danger, Danger Will Robinson licensing issues!). I'll see if I can figure out how to exclude them in the first place or at least automatically remove them with a secondary batch script.
[web2py] Re: XML manipulation
I use lots of XML to drive automation, file system structure, validation, user initial input, etc, so pretty much everywhere I make use of xml. much of the data (that may be user or project specific) is submitted as XML, then use that to populate tables (which BTW - I found lately to be a great way to share data between module [something that looks like a properties object]). I also frequently generate and/ or convert chunks of xml to dictionary objects (wrapper to make a dictionary behave like an object - looks like web2py's storage) so I can run through data by doing a.b.c.d (which I find very useful at times). These are some of the ways where I use xml on daily basis. So my use of it in a web2py context goes more towards DAL stand-alone than in a 'over the web' context, but you're welcome to anything I have if interested. I have lots of code and can probably make samples depending on what you need, - I mostly stick to etree (maybe just a preference), because I like that I can reset .root anywhere i like and can easily group similar items). Mart :) On Mar 20, 3:58 pm, villas villa...@gmail.com wrote: OK I found a way (it was of course easier than I thought!). However, if anyone has any interesting XML resources/tips, I would still be interested to learn more. Thanks!
Re: [web2py] Re: How to build windows binary yourself?
Thanks Praneeth, looks like what your script builds what I've got going produce pretty much the same output (once I comment out the few extra modules you've got that I don't). 1) I notice you're using shutil to just copy the applications directory rather than passing the correct tuples to data_files - that's probably an easier approach. 2) The data_files declaration you do have is missing splashlogo.gif, so the TK gui will not work. 3) You're not including routes.example.py, router.example.py or options_std.py probably not a major issue. 4) You're also including a bunch of API-MS-WIN-CORE-*.dll files which probably shouldn't be distributed with the app. Perhaps some extra shutil calls at the end to remove them? Relating back to my original reason for starting this task - it looks like you don't need to do anything special to get pyodbc included - as long as you've got it installed it seems to get included in the binary distribution.
[web2py] Re: XML manipulation
Thanks Mart, that's really kind! To cut a long story short, I eventually figured out that I don't need to manipulate any XML itself at this stage, I can manipulate everything first and just render it at the end. I've wasted so much time messing around, so if it gets complicated for me again, I'll come and ask! Sometimes the obvious is the most elusive! Best wishes, -D
[web2py] Re: Stumped on error: The end tag is unmatched, please check if you have a starting block tag
I searched my entire file for anything with the word 'end' Closest things were {{end = len(list)}} and !--End-- both of which I've changed, and I've still got the error. On Mar 20, 10:22 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Do you have something like {{end}} in your view? The old template parse was more forgiving when it comes to invalid templates and did not support blocks. On Mar 20, 9:11 am, Neodudeman tams...@gmail.com wrote: Hey guys, I'm stumped on this error that I'm getting. I recently upgraded from Web2py 1.79 to 1.93, and when viewing a certain, important, relatively complicated view file, I get this error. [The end tag is unmatched, please check if you have a starting block tag] And I can't, for the life of me, figure it out. The admin panel just returns that the Socket Timed Out, in the rocket.py. Could someone point me in the right direction, or maybe shed some light on exactly what end tag it's talking about?
[web2py] Re: XML manipulation
Agreed, often best to wait, take a step back and eventually we trip and fall on our own answers ;) On Mar 20, 8:57 pm, villas villa...@gmail.com wrote: Thanks Mart, that's really kind! To cut a long story short, I eventually figured out that I don't need to manipulate any XML itself at this stage, I can manipulate everything first and just render it at the end. I've wasted so much time messing around, so if it gets complicated for me again, I'll come and ask! Sometimes the obvious is the most elusive! Best wishes, -D
[web2py] Re: Stumped on error: The end tag is unmatched, please check if you have a starting block tag
I think this is creating the problem: {{end = len(list)}} This is to be considered in a bug in the template parser. I think I have fixed it in trunk (please check it). Meanwhile if you choose to stable, you can remove the spaces {{end=len(list)}} and the problem should go away. Massimo On Mar 20, 8:05 pm, Neodudeman tams...@gmail.com wrote: I searched my entire file for anything with the word 'end' Closest things were {{end = len(list)}} and !--End-- both of which I've changed, and I've still got the error. On Mar 20, 10:22 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Do you have something like {{end}} in your view? The old template parse was more forgiving when it comes to invalid templates and did not support blocks. On Mar 20, 9:11 am, Neodudeman tams...@gmail.com wrote: Hey guys, I'm stumped on this error that I'm getting. I recently upgraded from Web2py 1.79 to 1.93, and when viewing a certain, important, relatively complicated view file, I get this error. [The end tag is unmatched, please check if you have a starting block tag] And I can't, for the life of me, figure it out. The admin panel just returns that the Socket Timed Out, in the rocket.py. Could someone point me in the right direction, or maybe shed some light on exactly what end tag it's talking about?
Re: [web2py] setup.py to install web2py globally into the python env/virtualenv
This is a great thing to put web2py to a new level of quality. Thanks! On 20 Mar 2011 23:34, Praneeth Bodduluri life...@gmail.com wrote: Hello all, In an attempt to make web2py pip installable, so that I can use gluon as a module in other python programs, I created a setup.py that can be used to create a source dist for PyPI. Attached are the files that need to be placed in the web2py root directory. To create the source distribution: python setup.py sdist To install from the source distribution (After running the above command and using the sdist that it creates): python setup.py install After installing in your python env or virtualenv: To create a new web2py application directory: mkweb2pyenv path_to_project_dir To run web2py from a directory: runweb2py path_to_project_dir I hope this makes its way to web2py Trunk. A clone with the files included can be found at : https://code.google.com/r/lifeeth-pip I made a video of running an instance for those who like to watch: https://www.youtube.com/watch?v=f6cFkK2ZDPY -- Praneeth IRC: lifeeth
[web2py] Re: setup.py to install web2py globally into the python env/virtualenv
This is great! Monday and Tuesday are busy days for me but I will check this asap. Please open a web2py issue on google code to make sure this is tracked. Massimo On Mar 20, 4:34 pm, Praneeth Bodduluri life...@gmail.com wrote: Hello all, In an attempt to make web2py pip installable, so that I can use gluon as a module in other python programs, I created a setup.py that can be used to create a source dist for PyPI. Attached are the files that need to be placed in the web2py root directory. To create the source distribution: python setup.py sdist To install from the source distribution (After running the above command and using the sdist that it creates): python setup.py install After installing in your python env or virtualenv: To create a new web2py application directory: mkweb2pyenv path_to_project_dir To run web2py from a directory: runweb2py path_to_project_dir I hope this makes its way to web2py Trunk. A clone with the files included can be found at :https://code.google.com/r/lifeeth-pip I made a video of running an instance for those who like to watch: https://www.youtube.com/watch?v=f6cFkK2ZDPY -- Praneeth IRC: lifeeth new_files.tar.bz2 2KViewDownload
[web2py] Re: hierarchical authorization
Isn't this a perfect example of a place to use web2py with LDAP? -- Joe On Mar 20, 5:22 am, Martin Weissenboeck mweis...@gmail.com wrote: Hi everybody, I have the following problem: I need some kind of hierarchical authorization. This is a simplified model: Company C001...C500 Departement D01...D15 Group G01...G40 Person P01...P30 Not every company has 15 departements, not every departement has 40 groups and so on, but the whole program should work with up 200.000 persons. Now some authorizations: - Every person is allowed to change most of (but not all) of his personal data. - Some persons are allowed to change some data of the members of a specified group or some groups or a departement. - Some persons are allowed to send messages single persons or to the members of a group or some groups or a departement or a company. - Some persons are allowed to change all data of the members of a group or some groups or a departement or a company. - Some persons are allowed to do everything (including impersonate) with all data of the members of a whole departement or company. - ... and so on ... One person could be identified by a string field like C003:D03:G12:P15. I think I could use the authorization and the decoration of web2py to allow one person to modify data or to send messages. - But how could I use the authorization e.g. to modify only some data? - And if somebody is allowed to change some data he should only see these persons he is allowed to make modifications. A sql-statement where ident like 'C003:D03:G12:% could do the job. - But would it be fast enough for 200.000 persons? - Is there any way to use theauthentization mechanism for this problem? Regards Martin
Re: [web2py] Re: hierarchical authorization
Thank you for this hint. I do not have any experience with LDAP but of course it would be an interesting callenge to learn more. 2011/3/21 Joe Barnhart joe.barnh...@gmail.com Isn't this a perfect example of a place to use web2py with LDAP? -- Joe On Mar 20, 5:22 am, Martin Weissenboeck mweis...@gmail.com wrote: Hi everybody, I have the following problem: I need some kind of hierarchical authorization. This is a simplified model: Company C001...C500 Departement D01...D15 Group G01...G40 Person P01...P30 Not every company has 15 departements, not every departement has 40 groups and so on, but the whole program should work with up 200.000 persons. Now some authorizations: - Every person is allowed to change most of (but not all) of his personal data. - Some persons are allowed to change some data of the members of a specified group or some groups or a departement. - Some persons are allowed to send messages single persons or to the members of a group or some groups or a departement or a company. - Some persons are allowed to change all data of the members of a group or some groups or a departement or a company. - Some persons are allowed to do everything (including impersonate) with all data of the members of a whole departement or company. - ... and so on ... One person could be identified by a string field like C003:D03:G12:P15. I think I could use the authorization and the decoration of web2py to allow one person to modify data or to send messages. - But how could I use the authorization e.g. to modify only some data? - And if somebody is allowed to change some data he should only see these persons he is allowed to make modifications. A sql-statement where ident like 'C003:D03:G12:% could do the job. - But would it be fast enough for 200.000 persons? - Is there any way to use theauthentization mechanism for this problem? Regards Martin