[web2py] Re: Postgres: what am i doing wrong ?
Anthony, You pointed me in the right direction. I thought DAL() was systematically importing the model... my wrong. Once I added auto_import=True everything worked as expected. Thanks a lot. PS: Many thanks too to the others who gave me some advice ;-) On Feb 7, 6:26 pm, Anthony abasta...@gmail.com wrote: Just tried it - same results. FYI, I'm only using the interactive python shell to illustrate the problem I face I my app... When you use the -M option to load your models, are you then still doing this in your shell session: db = DAL('postgres://postgres:@localhost/courier') If so, don't -- the db object will already be defined when your db.py file is executed, and the above will end up overwriting it (and therefore losing all of its table definitions from db.py). Just do: python web2py.py -S courier -M -N db.tables (Note the -N option -- that prevents cron from starting.) If you're using the DAL outside of a web2py app, then you'll still need to create model definitions (i.e., with db.define_table) in your code -- the DAL doesn't know what tables and fields are in your db unless you tell it by defining the models. However, if you have already defined the models in an app somewhere, you might be able to make use of auto_import:http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define Anthony
[web2py] dynamic model (with uploaded db)
Hi, I'm moving my first steps ith web2py. I'm considering it to setup a REST service where a user can upload (zipped) sqlite DBs and view/edit their content through a web interface. The db structure is fixed (it's the storage of a desktop application), so I can define a model for it, but I wonder if it's possible to use DAL dynamically. This is the workflow: 1 - the user uploads the file 2 - the user accesses a certain page where the uploaded DBs are listed (I keep the list in a simple model) 3 - the user click on a DB and a page is opened with various options to edit its contents. At this point web2py should expose a model bound to the specific DB. I'm going to try the following way: 1 - define a method inside a model (e.g. inside /models/dynmodel.py) which takes the DB path as an argument and the instanciate a DAL object for it. 2 - do a DAL.define_table and here come my doubts. What happens when I do e define_table on a DB when the table already exists? I would like to know if someone has already solved a similar need, and if there are best practices do do that in web2py. thanks, giovanni
[web2py] Re: dynamic model (with uploaded db)
PS: I've tried using the auto_import=True option in DAL, but if I try to access any table, eg. db(db['table'].select(), I get KeyErrors On 8 Feb, 09:28, giovanni allegri gioha...@gmail.com wrote: Hi, I'm moving my first steps ith web2py. I'm considering it to setup a REST service where a user can upload (zipped) sqlite DBs and view/edit their content through a web interface. The db structure is fixed (it's the storage of a desktop application), so I can define a model for it, but I wonder if it's possible to use DAL dynamically. This is the workflow: 1 - the user uploads the file 2 - the user accesses a certain page where the uploaded DBs are listed (I keep the list in a simple model) 3 - the user click on a DB and a page is opened with various options to edit its contents. At this point web2py should expose a model bound to the specific DB. I'm going to try the following way: 1 - define a method inside a model (e.g. inside /models/dynmodel.py) which takes the DB path as an argument and the instanciate a DAL object for it. 2 - do a DAL.define_table and here come my doubts. What happens when I do e define_table on a DB when the table already exists? I would like to know if someone has already solved a similar need, and if there are best practices do do that in web2py. thanks, giovanni
[web2py] Search menu
Hello everyone, I'd like to have a search menu that has two submenus. Submenus will appear if the mouse is over the search menu. The first submenu is nothing but a text field and a button where the user can enter an expression and press the button to get the results of the search (this is for basic search), and the second submenu is Advanced Search that will take away the user to a new page so that they could enter the detailed criteria for their search. Is this (the first submenu) easy to implement in web2py? Thanks, Shartha
[web2py] The Delete doesn't work in my SQLForm.Grid
Hi all, I'm using a grid to update my database, using it I can Search, Clear, View and Edit the table but not Delete. Click on Delete, the page response me nothing at all. My environment is using the colours layout plugin. When I'm using the following same code in the default ”Welcome project, the Delete it just works FINE. So I'm just wondering does the layout would affect the Delete in the SQLForm.Grid? Many thanks. In db.py, a simple table. db.define_table('product', Field('user'), Field('buildDef')) In my Controller: def edit(): grid = SQLFORM.grid(db.product) return locals() In my view: {{extend 'layout.html'}} {{=BEAUTIFY(response._vars)}}
[web2py] how to display data
Hello, I have 2 controllers Index and articles, how do I display data from defined in articles in Index controller? Regards, Praveen
[web2py] Re: Transparently convert request.vars into unicode strings
Bruno, Alan, thanks for replies! Actually I hoped that web2py have built-in methods to converting all input to Unicode strings (since this is tendency for all applications). Do web2py guaranties, that input string always converted to UTF-8 from client browser encoding? I'm not sure. But if it is then I think Bruno's solution is most applicable with only note that input value can be not correct UTF-8 string, so it should be checked or ignored, like so: unicode(value, 'utf-8', 'ignore') -- Vladimir Rutsky
[web2py] Openldap and user_groups
Hi, I'm trying to login to our openldap server. When a user login for the first time I got this error: AttributeError: 'NoneType' object has no attribute 'user_groups' in tools.py / update_groups user_groups = self.user_groups = current.session.auth.user_groups = {} Happen that current.session.auth is None If I comment current.session: user_groups = self.user_groups = {} # = current.session.auth.user_groups = {} login is working and user groups are created. I'm missing something? Thank you -- Massimiliano
[web2py] Re: dynamic model (with uploaded db)
auto_import takes the database folder with all the stored files. You can then avoid to do define_tables, because the definitions are on the files auto_imported. This means that you create a db, define_table for every table in one app, and access the same data without re-defining all tables with auto_import. If you are going to access some random db in some path and want to access the data through the DAL, you have to istantiate a connection and define the tables you want to access if they are not yet defined by some other app. If you don't want to create the tables or do changes in the schema, you can do: define_table('example', Field('name'), . migrate=False ) If you're going to access many tables and don't want to repeat migrate=False all over the definitions, you can istantiate a connection with db = DAL('uri', migrate_enabled=False) In this way, table definitions allow you to access the data through the DAL, but the DAL won't attempt to create/migrate the existing table. PS: let's say you have in a table 20 columns but you need to access only 10 of them, you can define a table with 10 columns and access that data without any problems. Just be sure that for every Field you define exists a column with the corresponding type defined.
[web2py] Re: The Delete doesn't work in my SQLForm.Grid
Uhm, strange. If you see the table from the admin app, after you delete the record there is still the same record on the table ? This question arises because delete attaches a small javascript onclick of the delete button that fires an ajax request to delete the record and then removes the row from the DOM. There is the possibility that there's an hiccup in the javascript on the page, that stops this from happening. Also, there is the possibility that the ajax request is fired but not the piece of the removal of the row from the actual grid. Just see if the ajax request is made when you press the button or if there are any errors debugging the page, e.g. with firebug.
[web2py] NameError: name 'now' is not defined
Hello, i got an exception when using the sample code for storring the sessions in a database. I used the sample code from http://www.web2py.com/book/default/chapter/04#session Model: ... db.define_table('web2py_session', Field('locked', 'boolean', default=False), Field('client_ip'), Field('created_datetime', 'datetime', default=now), Field('modified_datetime', 'datetime'), Field('unique_key'), Field('session_data', 'text')) ... Exception: Traceback (most recent call last): File /home/geht/euch/nichts/an/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/geht/euch/nichts/an/web2py/applications/moepse/models/default.py, line 30, in module Field('created_datetime', 'datetime', default=now), NameError: name 'now' is not defined Kind Regards, Sciurus vulgaris
[web2py] markmin and image width
Hi, How I can set the width of an image (to be processed by markmin)? Best regards, Jose
[web2py] Re: NameError: name 'now' is not defined
Should probably be request.now. Anthony On Wednesday, February 8, 2012 7:49:51 AM UTC-5, Sciurus vulgaris wrote: Hello, i got an exception when using the sample code for storring the sessions in a database. I used the sample code from http://www.web2py.com/book/default/chapter/04#session Model: ... db.define_table('web2py_session', Field('locked', 'boolean', default=False), Field('client_ip'), Field('created_datetime', 'datetime', default=now), Field('modified_datetime', 'datetime'), Field('unique_key'), Field('session_data', 'text')) ... Exception: Traceback (most recent call last): File /home/geht/euch/nichts/an/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/geht/euch/nichts/an/web2py/applications/moepse/models/default.py, line 30, in module Field('created_datetime', 'datetime', default=now), NameError: name 'now' is not defined Kind Regards, Sciurus vulgaris
[web2py] Re: NameError: name 'now' is not defined
Solved, web2py automatic generates this table when using session.connect. Kind Regards, Sciurus vulgaris
[web2py] Re: dynamic model (with uploaded db)
Thanks very much. If I understand correctly auto_import will only work for DBs located in the databases/ folder and have associated a .table file, right? While, if my DB is anywhere I still can use it (without auto_import) but setting to False the migration option. I will give it a try... as soon as I will have the table definitions set up ;) giovanni On 8 Feb, 13:47, Niphlod niph...@gmail.com wrote: auto_import takes the database folder with all the stored files. You can then avoid to do define_tables, because the definitions are on the files auto_imported. This means that you create a db, define_table for every table in one app, and access the same data without re-defining all tables with auto_import. If you are going to access some random db in some path and want to access the data through the DAL, you have to istantiate a connection and define the tables you want to access if they are not yet defined by some other app. If you don't want to create the tables or do changes in the schema, you can do: define_table('example', Field('name'), . migrate=False ) If you're going to access many tables and don't want to repeat migrate=False all over the definitions, you can istantiate a connection with db = DAL('uri', migrate_enabled=False) In this way, table definitions allow you to access the data through the DAL, but the DAL won't attempt to create/migrate the existing table. PS: let's say you have in a table 20 columns but you need to access only 10 of them, you can define a table with 10 columns and access that data without any problems. Just be sure that for every Field you define exists a column with the corresponding type defined.
[web2py] Re: dynamic model (with uploaded db)
On Wednesday, February 8, 2012 8:55:11 AM UTC-5, giovanni allegri wrote: Thanks very much. If I understand correctly auto_import will only work for DBs located in the databases/ folder and have associated a .table file, right? The db itself doesn't have to be in the /databases folder -- the *.table files are stored there regardless of where the actual db resides. Anthony
[web2py] Re: Openldap and user_groups
This options resolve the error: *auth.settings.create_user_groups = False* On Wed, Feb 8, 2012 at 1:22 PM, Massimiliano mbelle...@gmail.com wrote: Hi, I'm trying to login to our openldap server. When a user login for the first time I got this error: * * *AttributeError: 'NoneType' object has no attribute 'user_groups'* in * * *tools.py / update_groups* *user_groups = self.user_groups = current.session.auth.user_groups = {}* Happen that *current.session.auth* is *None* If I comment current.session: user_groups = self.user_groups = {} # = current.session.auth.user_groups = {} login is working and user groups are created. I'm missing something? Thank you -- Massimiliano -- Massimiliano
[web2py] Re: Database error from constraint violation seemingly ignored
On Wednesday, February 8, 2012 2:16:21 AM UTC-5, Mark Kirkwood wrote: Sorry, I was not being all that clear. What I meant to say was: When I try to delete such a record, instead of the form telling me that the delete was prevented it appears to have succeeded. However a refresh of the form shows the record survived (and obviously the database log tells us why)! Forms don't know about database constraints -- they will only return and display friendly errors if a validator or onvalidation fails (that's why, for example, if you have notnull=True, you still need an IS_NOT_EMPTY() validator for the form to check for an empty field before submission). In your case, were you doing the delete from an edit form or from the grid itself (via the delete button)? If the latter, what happens is that the row is immediately removed from the grid via Javascript, and then an Ajax request is sent to delete the record from the db -- but if the Ajax request fails (which I assume happened in your case), I don't think any feedback is displayed to the page. Perhaps we should correct that -- first check the response of the Ajax request, and only remove the row from the grid if it was successful, otherwise flash an error message. Anthony
[web2py] Re: Just lost all my data
Changing the hmac_key key will prevent existing users from logging in because stored keys cannot be hashed any more. I am pretty sure it does not delete any data. Something else has caused your problem (if indeed the data has disappeared). The only routines in dal.py that ever delete data require that your explicitly call db.table.drop or db.table.truncate. First of all. Ar you sure your data is deleted or is it just that your queries return nothing? What is exactly in your databases/ folder? What are the creation times of the files in there? Massimo On Feb 7, 11:59 pm, Lewis lewis_le...@hotmail.com wrote: I switched auth to using the proper key: originally: auth = Auth(jodb) changed to: auth = Auth(jodb, hmac_key=Auth.get_or_create_key()) The original worked fine. But, it seemed that using the hmac_key was preferred. So I changed it. Now, all the data in all tables is gone. The auth tables are empty. The data tables for the application itself are empty. ??? There is nothing in sql.log. The last entry was from a week ago indicating successful creation of each table. Nothing since. In postgresql in the sql for each table it appears that all the tables were dropped and created with new constraints. for example: -- Table: joke -- DROP TABLE joke; CREATE TABLE joke ( id serial NOT NULL, joketext text, created_on timestamp without time zone, created_by integer, CONSTRAINT joke_pkey PRIMARY KEY (id ), CONSTRAINT joke_created_by_fkey FOREIGN KEY (created_by) REFERENCES auth_user (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) WITH ( OIDS=FALSE ); ALTER TABLE joke OWNER TO postgres; Wow. Have you seen DAL do this before? It was just test data in a test app and I have a version from a week ago in csv files, but wow. That's bad. I didn't change anything else in the model. Here are the table definitions: jodb.define_table('joke', Field('joketext', 'text',length=2048, requires = IS_NOT_EMPTY()), Field('created_on', 'datetime', default=request.now), Field('created_by', jodb.auth_user)) jodb.define_table('category', Field('name', 'text', requires = IS_NOT_EMPTY())) jodb.define_table('joke_category', Field('joke', jodb.joke), Field('category', jodb.category), format = '%(name)s') Is this by design?
[web2py] Re: Just lost all my data
This is get_or_create function: def get_or_create_key(filename=None): request = current.request if not filename: filename = os.path.join(request.folder,'private','auth.key') if os.path.exists(filename): key = open(filename,'r').read().strip() else: key = web2py_uuid() open(filename,'w').write(key) return key There is no code in web2py that deletes databases. On Feb 8, 1:03 am, pbreit pbreitenb...@gmail.com wrote: Hmmm, I would not think that would happen. Mine just looks like this: auth = Auth(db) auth.settings.hmac_key = 'sha512:5669f-51df-5-9e-4' Possible the get_or_create_key() function is the culprit but I don't know why that would happen.
[web2py] Re: Just lost all my data
Can you reproduce the problem -- that is, first create the auth tables via Auth(jodb), then fill them with some test data, then change your code to Auth(jodb, hmac_key=Auth.get_or_create_key()), and observe if on the next request the Auth tables are all dropped and re-created in the database? Anthony On Wednesday, February 8, 2012 1:03:25 AM UTC-5, Lewis wrote: Correction: only the auth tables were dropped and recreated and the one table that had a foreign key to auth. So, it is linked to the change to auth. It looks like that instead of just hashing passwords with a different key (which would have invalidated all the old passwords, of course--this is what I thought would happen) the auth tables had to be rebuilt from scratch. I still have somewhat cold tingles... On Feb 7, 9:59 pm, Lewis lewis_le...@hotmail.com wrote: I switched auth to using the proper key: originally: auth = Auth(jodb) changed to: auth = Auth(jodb, hmac_key=Auth.get_or_create_key()) The original worked fine. But, it seemed that using the hmac_key was preferred. So I changed it. Now, all the data in all tables is gone. The auth tables are empty. The data tables for the application itself are empty. ??? There is nothing in sql.log. The last entry was from a week ago indicating successful creation of each table. Nothing since. In postgresql in the sql for each table it appears that all the tables were dropped and created with new constraints. for example: -- Table: joke -- DROP TABLE joke; CREATE TABLE joke ( id serial NOT NULL, joketext text, created_on timestamp without time zone, created_by integer, CONSTRAINT joke_pkey PRIMARY KEY (id ), CONSTRAINT joke_created_by_fkey FOREIGN KEY (created_by) REFERENCES auth_user (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) WITH ( OIDS=FALSE ); ALTER TABLE joke OWNER TO postgres; Wow. Have you seen DAL do this before? It was just test data in a test app and I have a version from a week ago in csv files, but wow. That's bad. I didn't change anything else in the model. Here are the table definitions: jodb.define_table('joke', Field('joketext', 'text',length=2048, requires = IS_NOT_EMPTY()), Field('created_on', 'datetime', default=request.now), Field('created_by', jodb.auth_user)) jodb.define_table('category', Field('name', 'text', requires = IS_NOT_EMPTY())) jodb.define_table('joke_category', Field('joke', jodb.joke), Field('category', jodb.category), format = '%(name)s') Is this by design?
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
Well BSD isn't what you want for your goals. BSD allows anyone to download and sell your code as if it was their own. Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Anthony
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
But with BSD they do not have to provide the code, and they do not have to even say the code came from your project. Basically the only requirement is if they do give the code away they need to keep the BSD copyright which allows anyone else who downloads it to do whatever they want with the code and also not submit any changes if they don't want to. On Wed, Feb 8, 2012 at 6:41 AM, Anthony abasta...@gmail.com wrote: Well BSD isn't what you want for your goals. BSD allows anyone to download and sell your code as if it was their own. Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Anthony -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
Re: [web2py] login next doesn't work Version 1.99.4 (2011-12-14 14:46:14) stable
Same problem here On Fri, Feb 3, 2012 at 5:12 PM, Tito Garrido titogarr...@gmail.com wrote: Hi Folks, I'm using login with ldap and login_next doesn't work... from gluon.contrib.login_methods.ldap_auth import ldap_auth auth.settings.login_methods=[ldap_auth(mode='company',server='mycompany',base_dn='ou=myou,o= mycompany.com')] auth.settings.actions_disabled=['register','change_password','request_reset_password','profile'] auth.settings.remember_me_form = False auth.settings.login_next = URL('default','get_ldapgroups') Is it expected? It just goes to index and doesn't care about my redirection... Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Massimiliano
[web2py] Re: using radio widget can't receive the empty submit
Note that when there are no values in the set then *no* input type=radio fields are created in the form, so there is nothing to send when you submit the form. On Feb 7, 10:38 pm, Dan ideall...@googlemail.com wrote: You are right, if I used an non-empty list to submit, both forms work fine. so the widget = SQLFORM.widgets.radio.widget did have different behavior to the form submission.
[web2py] Handling a POST
I have a device that generates regular POSTs with CSV data inside (10 values). I want to be able to receive these POSTs, check to see if they are valid CSVs (contain comma's and linebreak), store in database and send acknowledge. Anyone who can help with example controller/view? Thanks in advance, Hans
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
http://www.bsdnewsletter.com/bsd/license.html On Wed, Feb 8, 2012 at 6:45 AM, Bruce Wade bruce.w...@gmail.com wrote: But with BSD they do not have to provide the code, and they do not have to even say the code came from your project. Basically the only requirement is if they do give the code away they need to keep the BSD copyright which allows anyone else who downloads it to do whatever they want with the code and also not submit any changes if they don't want to. On Wed, Feb 8, 2012 at 6:41 AM, Anthony abasta...@gmail.com wrote: Well BSD isn't what you want for your goals. BSD allows anyone to download and sell your code as if it was their own. Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Anthony -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
Re: [web2py] Re: a beginner question about queries
I think you have a mistake in your requires : db.purchases.name.requires = IS_IN_DB(db,db.customers*.id*,'%(name)s') In purchases name you should have a id (an integer), so then you can use represent : db.purchases.name.represent = lambda id, row: db.auth_user(id).name if id!=None else 'N/A' # the if is needed if you plan to use empty_or(is_in_db... Then if you make a query for data from purchase you will get : Jack, CD John, DVD Instead of the id like pbreit was showing... 1, CD 2, DVD Richard On Wed, Feb 8, 2012 at 1:58 AM, pbreit pbreitenb...@gmail.com wrote: I'm not sure that reference is going to work. The reference usually points to the id. So: db.define_table('customers', Field('name'), Field('age'), format = '%(name)s' ) db.define_table('purchases', Field('customer_id', db.customers), Field('cart') ) Then the query might be: rows = db((db.purchases.id0)(db.purchases.customer_id==db.customers.id )).select() The purchases table would need to look like: (1, CD) (1, DVD) Web2py automatically makes the first column in all tables an auto-incrementing field named id.
[web2py] problems running web2py with apache on windows (client denied by server configuration)
I have to run web2py on a Windows dev server (before moving the app to a Linux box!) I've tried to setup the minimal apache conf: WSGIScriptAlias / path_to_web2py\wsgihandler.py Directory path_to_web2py\wsgihandler.py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory AliasMatch ^/([^/]+)/static/(.*) path_to_web2py\applications\ $1\static\$2 Directory path_to_web2py\applications\*\static\ Order Allow,Deny Allow from all /Directory Location /admin Deny from all /Location LocationMatch ^/([^/]+)/appadmin Deny from all /LocationMatch (path_to_web2py is obviously an obscured path for my real physical path) I will study the problem of moving web2py to a sublocation (I can't keep it to the server root), but alos this first configuration doesn't work for me. If I browse to http://localhost/, I expect to see the default applications, instead I get an Access Denied. The Apache error.log says: [error] [client 127.0.0.1] client denied by server configuration: path_to_web2py/wsgihandler.py What am I doing wrong? giovanni
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
But with BSD they do not have to provide the code, and they do not have to even say the code came from your project. No, no matter what, they do have to say the code came from your project -- here's an excerpt: - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. If someone uses your BSD licensed code within their proprietary software, if they redistribute that software, they are still required to acknowledge the inclusion of your work (same with the MIT license). Anthony
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
I am reading about, but I think I will go with LPGL. Thanks everyone for the hellp with this! On Wed, Feb 8, 2012 at 12:50 PM, Bruce Wade bruce.w...@gmail.com wrote: http://www.bsdnewsletter.com/bsd/license.html On Wed, Feb 8, 2012 at 6:45 AM, Bruce Wade bruce.w...@gmail.com wrote: But with BSD they do not have to provide the code, and they do not have to even say the code came from your project. Basically the only requirement is if they do give the code away they need to keep the BSD copyright which allows anyone else who downloads it to do whatever they want with the code and also not submit any changes if they don't want to. On Wed, Feb 8, 2012 at 6:41 AM, Anthony abasta...@gmail.com wrote: Well BSD isn't what you want for your goals. BSD allows anyone to download and sell your code as if it was their own. Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Anthony -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: problems running web2py with apache on windows (client denied by server configuration)
I've found the problem. I had added an erroneus wsgihandler.py to the Directory tag. Now my problem is: [Wed Feb 08 16:04:26 2012] [error] File D:/LAVORO/Software/Web/ web2py_src/web2py/wsgihandler.py, line 25, in module [Wed Feb 08 16:04:26 2012] [error] import os [Wed Feb 08 16:04:26 2012] [error] ImportError: No module named os On 8 Feb, 15:52, giovanni allegri gioha...@gmail.com wrote: I have to run web2py on a Windows dev server (before moving the app to a Linux box!) I've tried to setup the minimal apache conf: WSGIScriptAlias / path_to_web2py\wsgihandler.py Directory path_to_web2py\wsgihandler.py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory AliasMatch ^/([^/]+)/static/(.*) path_to_web2py\applications\ $1\static\$2 Directory path_to_web2py\applications\*\static\ Order Allow,Deny Allow from all /Directory Location /admin Deny from all /Location LocationMatch ^/([^/]+)/appadmin Deny from all /LocationMatch (path_to_web2py is obviously an obscured path for my real physical path) I will study the problem of moving web2py to a sublocation (I can't keep it to the server root), but alos this first configuration doesn't work for me. If I browse tohttp://localhost/, I expect to see the default applications, instead I get an Access Denied. The Apache error.log says: [error] [client 127.0.0.1] client denied by server configuration: path_to_web2py/wsgihandler.py What am I doing wrong? giovanni
[web2py] Re: 2 Questions regarding auth
Where would I add these? Add the links wherever you want them in your user interface. I am really mystified how the auth() class call receives the method as its argument from these urls assuming that the user action looks like: def user() return dict(form=auth()) Auth is a callable class, so when you call auth(), you are calling the Auth.__call__ method. That method checks to see if request.args[0] is among the set of supported Auth methods, and if so, it calls the associated method via: return getattr(self, args[0])() So, the __call__ method essentially acts as a router to the other Auth methods. Of course, you can also call those methods directly rather than relying on request.args and the __call__ router. I am really mystified about how one can index the request.args using parens instead of square braces? as in: h2{{=T( request.args(0).replace('_',' ').capitalize() )}}/h2 request.args is a storage.List object, which acts like a regular Python list but is also callable (i.e., it has a __call__ method). You can call it with an index, and it will return the same value as if you had indexed via the brackets syntax. The only difference is if you call it with an invalid index, instead of throwing an exception, it simply returns None. So, let's say request.args is an empty list -- in that case, request.args(0) is None, but request.args[0] will result in the following error: IndexError: list index out of range. This allows you to do things like passing request.args(0) as a value without first having to check whether it exists. Anthony
Re: [web2py] how to display data
First select the data you want to display #select all records with all fields articles = db(db.articles).select() Second, pass it to the view return dict(articles=articles) Third, render it in the view inde.html {{=articles}} Note: this is the most basic data displaying with Web2py, you will need to increment funcionality and design. 2012/2/8 Praveen Bhat praveenbha...@gmail.com: Hello, I have 2 controllers Index and articles, how do I display data from defined in articles in Index controller? Regards, Praveen -- Carlos J. Costa Cientista da Computação Esp. Gestão em Telecom EL MELECH NEEMAN! אָמֵן
Re: [web2py] Re: Workflow engine for web2py
For my self I am interresting to workflow in context of LIMS and here a article about kind of workflows in LIMS : http://www.scientificcomputing.com/workflow-perspectives-in-lims.aspx Richard On Tue, Feb 7, 2012 at 11:12 PM, mart msenecal...@gmail.com wrote: I think features such as those you already implemented in your bug tracking app hold some importance here as well Ie. the good use of groups, permissions ability to modify things like ownership - as an example, a corporate accounting department should still have the ability to reimburse employee expenses even though the said employee's accounting contact's position has been terminated (maybe along with 875 other poor employees that same day)... Doh! did I write that out loud? ;) oh well, it still holds true, the wf should still be able to handle any kind of changes like work item ownership and re- route accordingly (this also serves as an example of a good use of roles in a wf :) ) here is a example of implementation details of a workflow. Granted, probably a little too large in scale (especially in light of its new future), but... the idea is there none the less. I think the doc should also contain a blurb on how it makes use of databases http://help.adobe.com/en_US/livecycle/9.0/overview.pdf ** for those who followed the thread on the use of the word Enterprise, notice the acronym 'ES' in the product's name. Mart :) On Feb 8, 3:07 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: That's a finite state machine. It is nice and simple but too simple. Anyway, the problem in using that with web2py (or any other web framework) it is not designed to maintain its state using the database. Anyway, it should be possible to modify it so that state and rules are stored in the database. Do we expect more from a workflow system? I am not sure convinced every workflow I need can be modeled finite state machine. I will give this some more thought. massimo On Feb 7, 4:25 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: There is no ubuntu official package as far as I can see, so you will have to follow the installation information explain into the tar ball available here :http://www.hforge.org/itools/ Then : from itools.workflow import Workflow And the rest is explained in the docs : http://www.hforge.org/itools/docs/workflow/ I think you will pretty much have to build your own logic to make use of workflow for given objects (tables and rows)... But there is surely a way that this lib could be included into web2py core so we can make use of workflow utility readily. Richard 2012/2/7 António Ramos ramstei...@gmail.com How to use this in web2py ? dummies tutorial? 2012/2/7 omicron jacques.bouss...@gmail.com This library is small and easy to use: http://www.hforge.org/itools/docs/workflow/
[web2py] Re: dataTables with serverside json
Hi Richard ! Pl. excuse my late replying. Glad to hear that you got it working. If you are interested, I can share my code. I am not using fnInitComplete. Mine is very simple minimal code. --- Vineet On Feb 7, 10:19 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: Finally got it to work... There was a problem with the init of DTs particularly this option : http://datatables.net/release-datatables/extras/FixedColumns/server-s... *fnInitComplete* * * * * It's not solving my speed problem as I expect it could do... So I will put it on hold, but I plan to implement a basic server interaction script as the php DTs example to make it easier deploy DTs with server side capability... Richard On Mon, Feb 6, 2012 at 6:10 PM, Bruno Rocha rochacbr...@gmail.com wrote: Not, PowerGrid is based in pure Jquery Templates -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
I'm not sure if looking at the problem of license from the business point of view is reasonable. If Bruno's goal was to make the business people happy, he would put his software into the public domain. But I'm guessing he is more interested in getting some help from others and maybe building a small community around the project. In my opinion this works best when code is collectively own and protected from abuse (e.g. proprietary forks). The assumed connection between the number of users and a scale of contributions does not sound right to me. Depending on the chosen license there would be different number and type of contributions. Non-copyleft license doesn't encourage contribution, it encourages the use. The code can be taken by everyone who will leave an attribution note for exchange, but usually not more than that. Unless the rate of development of the project is very high, the business would always prefer to fork a project and maintain proprietary changes on their own, over a struggle with upstream integration. Copyleft license encourages the contribution, as it protects the code from being abused, so no risk of being taken advantage of and more likely that some developers will join you. On the users side, however, it scares of the integrators, people who have a number of different pieces of code that they don't want to or can't release as a free software. The question that remains is if the copyleft licenses can be used by business at all? Let's limit the discussion to the most common case of customizers, people who adapt software to the needs of their clients (e.g. making extensions or plugins) or use it to build custom products (e.g. websites). Now, we need to remember that when the work is being released, the license is between the business and its client. Not between the business and the entire world. So the freedoms of the software are granted to the client only and it is up to him to decide if he wants to distribute the software any further. If he does, only then he will be bounded by the copyleft clause to do it on the same terms. It doesn't matter if it is AGPL, GPL, LGPL or BSD, the effect here is the same. The only difference is the case of deploying the software on a server, which according to AGPL is a form of distribution and would require making the source code available upon request. However, in practice it is not always a concern, e.g. when the target deployment happens in the intranet. Saying that legal department avoids GPL or AGPL and not saying *why* is not very convincing. Argument from authority is not enough. I could agree, that AGPL might be not very convincing as it seems to give away for what the customer has paid to everyone. However, you have to remember that potential competition is still bounded by the same license. They could copy your customer's website and to distinguish themselves add some extra features, but at the end they will have to release those changes on AGPL too. Now, nothing stops your customer from using what they did on his website. I dare to say, this would create a fast progressing market with lots of competition. Fair competition, without any artificial market barriers. So does it make sense to demonise it as bad for bussiness?
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
Yes it does make it very bad for business but good for customers/competition :D. For example the site I created made $5 million in 2 months, why in the world would I want that source code to get into the wrong hands? On Wed, Feb 8, 2012 at 8:59 AM, Wikus van de Merwe dupakrop...@googlemail.com wrote: I'm not sure if looking at the problem of license from the business point of view is reasonable. If Bruno's goal was to make the business people happy, he would put his software into the public domain. But I'm guessing he is more interested in getting some help from others and maybe building a small community around the project. In my opinion this works best when code is collectively own and protected from abuse (e.g. proprietary forks). The assumed connection between the number of users and a scale of contributions does not sound right to me. Depending on the chosen license there would be different number and type of contributions. Non-copyleft license doesn't encourage contribution, it encourages the use. The code can be taken by everyone who will leave an attribution note for exchange, but usually not more than that. Unless the rate of development of the project is very high, the business would always prefer to fork a project and maintain proprietary changes on their own, over a struggle with upstream integration. Copyleft license encourages the contribution, as it protects the code from being abused, so no risk of being taken advantage of and more likely that some developers will join you. On the users side, however, it scares of the integrators, people who have a number of different pieces of code that they don't want to or can't release as a free software. The question that remains is if the copyleft licenses can be used by business at all? Let's limit the discussion to the most common case of customizers, people who adapt software to the needs of their clients (e.g. making extensions or plugins) or use it to build custom products (e.g. websites). Now, we need to remember that when the work is being released, the license is between the business and its client. Not between the business and the entire world. So the freedoms of the software are granted to the client only and it is up to him to decide if he wants to distribute the software any further. If he does, only then he will be bounded by the copyleft clause to do it on the same terms. It doesn't matter if it is AGPL, GPL, LGPL or BSD, the effect here is the same. The only difference is the case of deploying the software on a server, which according to AGPL is a form of distribution and would require making the source code available upon request. However, in practice it is not always a concern, e.g. when the target deployment happens in the intranet. Saying that legal department avoids GPL or AGPL and not saying *why* is not very convincing. Argument from authority is not enough. I could agree, that AGPL might be not very convincing as it seems to give away for what the customer has paid to everyone. However, you have to remember that potential competition is still bounded by the same license. They could copy your customer's website and to distinguish themselves add some extra features, but at the end they will have to release those changes on AGPL too. Now, nothing stops your customer from using what they did on his website. I dare to say, this would create a fast progressing market with lots of competition. Fair competition, without any artificial market barriers. So does it make sense to demonise it as bad for bussiness? -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
Re: [web2py] Re: dataTables with serverside json
Yes! I think the PowerTable of Burno don't implement server side processing yet... We maybe can start form there to make a server side implementation of PowerTable... What do you think? I think, we have to split table header from data then wrote a python implementation fo the php script as shown in the example of DTs... For sure see a bit of your code could help me figure out the path I should follow and help my reflexion. About fnInitComplete it is just needed in case you want to initialise DTs with fixed columns... Richard On Wed, Feb 8, 2012 at 11:52 AM, Vineet vineet.deod...@gmail.com wrote: Hi Richard ! Pl. excuse my late replying. Glad to hear that you got it working. If you are interested, I can share my code. I am not using fnInitComplete. Mine is very simple minimal code. --- Vineet On Feb 7, 10:19 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: Finally got it to work... There was a problem with the init of DTs particularly this option : http://datatables.net/release-datatables/extras/FixedColumns/server-s... *fnInitComplete* * * * * It's not solving my speed problem as I expect it could do... So I will put it on hold, but I plan to implement a basic server interaction script as the php DTs example to make it easier deploy DTs with server side capability... Richard On Mon, Feb 6, 2012 at 6:10 PM, Bruno Rocha rochacbr...@gmail.com wrote: Not, PowerGrid is based in pure Jquery Templates -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?
it looks good just wondering if that would work with fastcgi ? say that we have 10 fastcgi running... are they sharing the modules ? On Tue, Feb 7, 2012 at 10:53 PM, Ross Peoples ross.peop...@gmail.comwrote: Sorry Mariano, I misspelled your name in my last post :) To give you a better example of what you might want to do here is a more advanced module that makes a static class and better resembles the singleton pattern: class Counter(object): instance = None @classmethod def get(cls): if cls.instance == None: cls.instance = Counter() return cls.instance def __init__(self, message='Hello World!'): self.message = message self.count = 0 def get_count(self): self.count += 1 return self.count def get_message(self): return self.message Then your controller would look something like this now: from mymodule import Counter counter = Counter.get() count = counter.get_count() return dict(count=count) By calling Counter.get() instead of Counter(), we ensure that there is only ever once instance of the Counter object, and that the object will last for the lifetime of the web2py instance. -- Sebastian E. Ovide
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
On Wednesday, February 8, 2012 9:53:41 AM UTC-5, rochacbruno wrote: I am reading about, but I think I will go with LPGL. Note, the oauth20_account_google.pyhttps://github.com/rochacbruno/Movuca/blob/master/modules/oauth20_account_google.py module that is included is GPLv3, which I assume is not compatible with LGPL (which is more permissive). Perhaps Michele will offer you an LGPL license for this purpose. Anthony
[web2py] how to deploy web2py not in the apache root (help with url rewriting)
I've seen a lot of examples to manage url rewriting and proxying with web2py, but I haven't found a solution to my problem. I don't have much experience with mod_rewrite, but I would like to use it and avoid rewriting inside web2py (through its routes facilites). My situation is a single domain, where various applications are hosted through Aliases. I have path_to_wsgi/applications/myapp, and I would like to serve it at http://my.domain.ip/myapp. The domain root points to another service, so I can't install web2py to the root. Is there e ready to use recipe to do it? Thanks giovanni
[web2py] Re: 2 Questions regarding auth
OK, thanks. Tricky. My exposure to classes didn't get as far as the __call__ method. Crud is also a callable class and works similarly to Auth. All of the validators are callable classes as well. When you specify the validator, you initialize it: Field('fruit', requires=IS_IN_SET(['apple', 'banana', 'orange'])) and during the validation process, the form processing code calls the validator object, passing the submitted value to it. Anthony
[web2py] Setup virtual hosting with Web2py and apache2 mod wsgi on Ubuntu server 11.10
New blog entry http://bit.ly/xqB508 Setup virtual hosting with Web2py and apache2 mod wsgi on Ubuntu server 11.10http://martin.tecnodoc.com.ar/post/2012/02/08/14_setup-virtual-hosting-with-web2py-and-apache2-mod-wsgi-on-ubuntu-server-1110
[web2py] Re: Just lost all my data
So, good news. I cannot reproduce. Yes, Massimo: I knew this change would invalidate passwords. Just 3 test accounts so that didn't matter. I backed up the data this time. (Good to learn how to backup postgresql...) Switched to incorrect auth with generic hash key. Worked. Everything there. Switched back to correct auth with per app hmac_key. Worked. Everything there. Interestingly, the web2py sql.log didn't show any migrations. I can't recover the postgresql log so I don't know what it saw (something else to fix). So, I can't say what happened. Only other symptom is that I was working on the app while someone else was accessing it from the web. So, the good news is that this change (very rare as most people wouldn't change the auth hashing method once set up) works as expected. On Feb 8, 6:23 am, Anthony abasta...@gmail.com wrote: Can you reproduce the problem -- that is, first create the auth tables via Auth(jodb), then fill them with some test data, then change your code to Auth(jodb, hmac_key=Auth.get_or_create_key()), and observe if on the next request the Auth tables are all dropped and re-created in the database? Anthony On Wednesday, February 8, 2012 1:03:25 AM UTC-5, Lewis wrote: Correction: only the auth tables were dropped and recreated and the one table that had a foreign key to auth. So, it is linked to the change to auth. It looks like that instead of just hashing passwords with a different key (which would have invalidated all the old passwords, of course--this is what I thought would happen) the auth tables had to be rebuilt from scratch. I still have somewhat cold tingles... On Feb 7, 9:59 pm, Lewis lewis_le...@hotmail.com wrote: I switched auth to using the proper key: originally: auth = Auth(jodb) changed to: auth = Auth(jodb, hmac_key=Auth.get_or_create_key()) The original worked fine. But, it seemed that using the hmac_key was preferred. So I changed it. Now, all the data in all tables is gone. The auth tables are empty. The data tables for the application itself are empty. ??? There is nothing in sql.log. The last entry was from a week ago indicating successful creation of each table. Nothing since. In postgresql in the sql for each table it appears that all the tables were dropped and created with new constraints. for example: -- Table: joke -- DROP TABLE joke; CREATE TABLE joke ( id serial NOT NULL, joketext text, created_on timestamp without time zone, created_by integer, CONSTRAINT joke_pkey PRIMARY KEY (id ), CONSTRAINT joke_created_by_fkey FOREIGN KEY (created_by) REFERENCES auth_user (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) WITH ( OIDS=FALSE ); ALTER TABLE joke OWNER TO postgres; Wow. Have you seen DAL do this before? It was just test data in a test app and I have a version from a week ago in csv files, but wow. That's bad. I didn't change anything else in the model. Here are the table definitions: jodb.define_table('joke', Field('joketext', 'text',length=2048, requires = IS_NOT_EMPTY()), Field('created_on', 'datetime', default=request.now), Field('created_by', jodb.auth_user)) jodb.define_table('category', Field('name', 'text', requires = IS_NOT_EMPTY())) jodb.define_table('joke_category', Field('joke', jodb.joke), Field('category', jodb.category), format = '%(name)s') Is this by design?
Re: [web2py] Setup virtual hosting with Web2py and apache2 mod wsgi on Ubuntu server 11.10
Also if you want to use uwsgi + nginx I supplied an updated script in a past post that works with Ubuntu 11.10 the default one that came with my version of web2py didn't work with Ubuntu 11.10 On Wed, Feb 8, 2012 at 10:06 AM, Martín Mulone mulone.mar...@gmail.comwrote: New blog entry http://bit.ly/xqB508 Setup virtual hosting with Web2py and apache2 mod wsgi on Ubuntu server 11.10http://martin.tecnodoc.com.ar/post/2012/02/08/14_setup-virtual-hosting-with-web2py-and-apache2-mod-wsgi-on-ubuntu-server-1110 -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] PyCon Web Development Summit 2012 Panel Discussions
Hey, this is your time to ask questions about Python on the web! Google Moderator: Submit questions to panelists at the PyCon Web Development Summit (March 8, 2012, Santa Clara CA) http://www.google.com/moderator/#16/e=1c9a94 Best regards
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
The assumed connection between the number of users and a scale of contributions does not sound right to me. I was just suggesting that it's an empirical question which approach will yield more (and better) contributions, and that it likely depends on the particular situation. AGPL will likely scare off any commercial use, so may limit the potential for a large base of contributors (and the smaller base of non-commercial users may not be particularly sophisticated or interested in making the kinds of customizations that would make for useful contributions, or they may not be motivated to get involved because the project is not popular and therefore lacks prestige for their resumes). GPL would certainly be better, and I think most of the major CMSes (WordPress, Drupal, Joomla) use that license. However, plenty of CMSes also use LGPL, and a good number use BSD/MIT as well (e.g., Concrete5, django-cms, Radiant CMS and most of the other Rails CMSes). Very few use AGPL. Many popular open sources projects have attracted active communities of contributors with MIT/BSD licenses. The only difference is the case of deploying the software on a server, which according to AGPL is a form of distribution and would require making the source code available upon request. However, in practice it is not always a concern, e.g. when the target deployment happens in the intranet. Though, in that case, you are giving the software to your employees for free -- which they could then take to a competitor (or their own startup). Saying that legal department avoids GPL or AGPL and not saying *why* is not very convincing. Argument from authority is not enough. I think the point was simply that whether or not legal department fear of GPL/AGPL is justified, it is the current reality and will therefore hamper adoption of the product by businesses. I could agree, that AGPL might be not very convincing as it seems to give away for what the customer has paid to everyone. However, you have to remember that potential competition is still bounded by the same license. Yes, but they get to achieve feature parity with the original developer without making any investment, which gives them an advantage. Anthony
[web2py] Re: how to deploy web2py not in the apache root (help with url rewriting)
For now I've solved setting the WSGIScriptAlias to /w2p and in routes.py: routes_out = ((r'/(?Pany.*)', r'/w2p/\gany'),) Any comments are welcome for something cleaner, but I fear that reverse rewriting for URL() is only possible if set inside routes.py. Am I wrong? giovanni On 8 Feb, 18:45, giovanni allegri gioha...@gmail.com wrote: I've seen a lot of examples to manage url rewriting and proxying with web2py, but I haven't found a solution to my problem. I don't have much experience with mod_rewrite, but I would like to use it and avoid rewriting inside web2py (through its routes facilites). My situation is a single domain, where various applications are hosted through Aliases. I have path_to_wsgi/applications/myapp, and I would like to serve it athttp://my.domain.ip/myapp. The domain root points to another service, so I can't install web2py to the root. Is there e ready to use recipe to do it? Thanks giovanni
[web2py] Re: problems running web2py with apache on windows (client denied by server configuration)
SOLVED, setting the WSGIPythonHome directive to my python install, otherwise mod_wsgi looks in the wrong prefix (probably the one set when compiled?) giovanni On 8 Feb, 16:07, giovanni allegri gioha...@gmail.com wrote: I've found the problem. I had added an erroneus wsgihandler.py to the Directory tag. Now my problem is: [Wed Feb 08 16:04:26 2012] [error] File D:/LAVORO/Software/Web/ web2py_src/web2py/wsgihandler.py, line 25, in module [Wed Feb 08 16:04:26 2012] [error] import os [Wed Feb 08 16:04:26 2012] [error] ImportError: No module named os On 8 Feb, 15:52, giovanni allegri gioha...@gmail.com wrote: I have to run web2py on a Windows dev server (before moving the app to a Linux box!) I've tried to setup the minimal apache conf: WSGIScriptAlias / path_to_web2py\wsgihandler.py Directory path_to_web2py\wsgihandler.py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory AliasMatch ^/([^/]+)/static/(.*) path_to_web2py\applications\ $1\static\$2 Directory path_to_web2py\applications\*\static\ Order Allow,Deny Allow from all /Directory Location /admin Deny from all /Location LocationMatch ^/([^/]+)/appadmin Deny from all /LocationMatch (path_to_web2py is obviously an obscured path for my real physical path) I will study the problem of moving web2py to a sublocation (I can't keep it to the server root), but alos this first configuration doesn't work for me. If I browse tohttp://localhost/, I expect to see the default applications, instead I get an Access Denied. The Apache error.log says: [error] [client 127.0.0.1] client denied by server configuration: path_to_web2py/wsgihandler.py What am I doing wrong? giovanni
[web2py] Re: Just lost all my data
The only problem I even had about migrations which has causes (what appeared to be) data loss is that if you run out of disk space the .table files may get corrupted. There is no actual loss of data but when this happens, one needs to recover some disk space and run web2py in fake_migrate mode to rebuildthe missing .tables files. This does not appear to be your case anyway. I have no idea what happened but I am sure something else deleted the files (if they were deleted), not web2py. Massimo On Feb 8, 12:18 pm, Lewis lewis_le...@hotmail.com wrote: So, good news. I cannot reproduce. Yes, Massimo: I knew this change would invalidate passwords. Just 3 test accounts so that didn't matter. I backed up the data this time. (Good to learn how to backup postgresql...) Switched to incorrect auth with generic hash key. Worked. Everything there. Switched back to correct auth with per app hmac_key. Worked. Everything there. Interestingly, the web2py sql.log didn't show any migrations. I can't recover the postgresql log so I don't know what it saw (something else to fix). So, I can't say what happened. Only other symptom is that I was working on the app while someone else was accessing it from the web. So, the good news is that this change (very rare as most people wouldn't change the auth hashing method once set up) works as expected. On Feb 8, 6:23 am, Anthony abasta...@gmail.com wrote: Can you reproduce the problem -- that is, first create the auth tables via Auth(jodb), then fill them with some test data, then change your code to Auth(jodb, hmac_key=Auth.get_or_create_key()), and observe if on the next request the Auth tables are all dropped and re-created in the database? Anthony On Wednesday, February 8, 2012 1:03:25 AM UTC-5, Lewis wrote: Correction: only the auth tables were dropped and recreated and the one table that had a foreign key to auth. So, it is linked to the change to auth. It looks like that instead of just hashing passwords with a different key (which would have invalidated all the old passwords, of course--this is what I thought would happen) the auth tables had to be rebuilt from scratch. I still have somewhat cold tingles... On Feb 7, 9:59 pm, Lewis lewis_le...@hotmail.com wrote: I switched auth to using the proper key: originally: auth = Auth(jodb) changed to: auth = Auth(jodb, hmac_key=Auth.get_or_create_key()) The original worked fine. But, it seemed that using the hmac_key was preferred. So I changed it. Now, all the data in all tables is gone. The auth tables are empty. The data tables for the application itself are empty. ??? There is nothing in sql.log. The last entry was from a week ago indicating successful creation of each table. Nothing since. In postgresql in the sql for each table it appears that all the tables were dropped and created with new constraints. for example: -- Table: joke -- DROP TABLE joke; CREATE TABLE joke ( id serial NOT NULL, joketext text, created_on timestamp without time zone, created_by integer, CONSTRAINT joke_pkey PRIMARY KEY (id ), CONSTRAINT joke_created_by_fkey FOREIGN KEY (created_by) REFERENCES auth_user (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) WITH ( OIDS=FALSE ); ALTER TABLE joke OWNER TO postgres; Wow. Have you seen DAL do this before? It was just test data in a test app and I have a version from a week ago in csv files, but wow. That's bad. I didn't change anything else in the model. Here are the table definitions: jodb.define_table('joke', Field('joketext', 'text',length=2048, requires = IS_NOT_EMPTY()), Field('created_on', 'datetime', default=request.now), Field('created_by', jodb.auth_user)) jodb.define_table('category', Field('name', 'text', requires = IS_NOT_EMPTY())) jodb.define_table('joke_category', Field('joke', jodb.joke), Field('category', jodb.category), format = '%(name)s') Is this by design?
[web2py] pycon 2012
So... who's coming to pycon 2012 in Santa Clara? How about some open space meeting and dinner together? RSVP here http://mdp.cti.depaul.edu/rsvp/default/respond_event/a481f9c5-7aa9-404d-86cb-501ea29e043a Massimo
[web2py] Update legacy table using primarykey failed
I have legacy table called IQWAGFTY which doesn't have id field so I specify primarkey for the existing field. I received KeyError: 'TYPRCD' for crud.updae but not crud.create. What am I doing wrong or is it not supported to update with primarykey ? Model - db.define_table('IQWAGFTY', Field('TYPRCD', length=15, label=Product Code:), Field('TYPRKJ', length=50, label=Part Number:), Field('TYTYPE', length=2, label=Type:), Field('TYFLAG', length=1, default=), Field('TYUUSR', length=128, default = auth.user.username.upper() if auth.user else None, label=Updated by:), Field('TYUDAT', 'datetime', default=request.now, label=updated on:), primarykey=['TYPRCD']) Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) TRACEBACK: Traceback (most recent call last): File D:\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 111, in module File D:\web2py\gluon\globals.py, line 149, in lambda self._caller = lambda f: f() File D:\web2py\gluon\tools.py, line 2456, in f return action(*a, **b) File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 68, in test return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File D:\web2py\gluon\tools.py, line 2978, in update detect_record_change = self.settings.detect_record_change): File D:\web2py\gluon\sqlhtml.py, line 1033, in accepts record_id = dict((k, request_vars[k]) for k in self.table._primarykey) File D:\web2py\gluon\sqlhtml.py, line 1033, in genexpr record_id = dict((k, request_vars[k]) for k in self.table._primarykey) KeyError: 'TYPRCD' Contoller(create:OK) - def test(): return dict(form=crud.create(db.IQWAGFTY))
[web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Apple seems to be doing OK with OS X. I don't recall what flavor of BSD kernel is at its base, but OS X is BSD with an Apple front end and very few Gnu utilities. On Feb 8, 9:41 am, Anthony abasta...@gmail.com wrote: Well BSD isn't what you want for your goals. BSD allows anyone to download and sell your code as if it was their own. Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Anthony
Re: [web2py] Update legacy table using primarykey failed
ote that currently this is only available for DB2, MS-SQL, Ingres and Informix, but others can be easily added. At the time of writing, we cannot guarantee that the primarykey attribute works with every existing legacy table and every supported database backend. For simplicity, we recommend, if possible, creating a database view that has an auto-increment id field. Here what the book says... Do you have a compatible DMS? Richard On Wed, Feb 8, 2012 at 2:45 PM, Omi Chiba ochib...@gmail.com wrote: I have legacy table called IQWAGFTY which doesn't have id field so I specify primarkey for the existing field. I received KeyError: 'TYPRCD' for crud.updae but not crud.create. What am I doing wrong or is it not supported to update with primarykey ? Model - db.define_table('IQWAGFTY', Field('TYPRCD', length=15, label=Product Code:), Field('TYPRKJ', length=50, label=Part Number:), Field('TYTYPE', length=2, label=Type:), Field('TYFLAG', length=1, default=), Field('TYUUSR', length=128, default = auth.user.username.upper() if auth.user else None, label=Updated by:), Field('TYUDAT', 'datetime', default=request.now, label=updated on:), primarykey=['TYPRCD']) Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) TRACEBACK: Traceback (most recent call last): File D:\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 111, in module File D:\web2py\gluon\globals.py, line 149, in lambda self._caller = lambda f: f() File D:\web2py\gluon\tools.py, line 2456, in f return action(*a, **b) File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 68, in test return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File D:\web2py\gluon\tools.py, line 2978, in update detect_record_change = self.settings.detect_record_change): File D:\web2py\gluon\sqlhtml.py, line 1033, in accepts record_id = dict((k, request_vars[k]) for k in self.table._primarykey) File D:\web2py\gluon\sqlhtml.py, line 1033, in genexpr record_id = dict((k, request_vars[k]) for k in self.table._primarykey) KeyError: 'TYPRCD' Contoller(create:OK) - def test(): return dict(form=crud.create(db.IQWAGFTY))
[web2py] Re: Update legacy table using primarykey failed
Oh.. mabybe this ?? http://www.web2py.com/books/default/chapter/29/6?search=primarykey#Legacy-databases-and-keyed-tables The update_record function is not available for Rows of keyed tables. Then what option do I have to update the table ? On Feb 8, 1:45 pm, Omi Chiba ochib...@gmail.com wrote: I have legacy table called IQWAGFTY which doesn't have id field so I specify primarkey for the existing field. I received KeyError: 'TYPRCD' for crud.updae but not crud.create. What am I doing wrong or is it not supported to update with primarykey ? Model - db.define_table('IQWAGFTY', Field('TYPRCD', length=15, label=Product Code:), Field('TYPRKJ', length=50, label=Part Number:), Field('TYTYPE', length=2, label=Type:), Field('TYFLAG', length=1, default=), Field('TYUUSR', length=128, default = auth.user.username.upper() if auth.user else None, label=Updated by:), Field('TYUDAT', 'datetime', default=request.now, label=updated on:), primarykey=['TYPRCD']) Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) TRACEBACK: Traceback (most recent call last): File D:\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 111, in module File D:\web2py\gluon\globals.py, line 149, in lambda self._caller = lambda f: f() File D:\web2py\gluon\tools.py, line 2456, in f return action(*a, **b) File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 68, in test return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File D:\web2py\gluon\tools.py, line 2978, in update detect_record_change = self.settings.detect_record_change): File D:\web2py\gluon\sqlhtml.py, line 1033, in accepts record_id = dict((k, request_vars[k]) for k in self.table._primarykey) File D:\web2py\gluon\sqlhtml.py, line 1033, in genexpr record_id = dict((k, request_vars[k]) for k in self.table._primarykey) KeyError: 'TYPRCD' Contoller(create:OK) - def test(): return dict(form=crud.create(db.IQWAGFTY))
[web2py] Re: Update legacy table using primarykey failed
Do you have a compatible DMS? Yes, I'm using DB2. On Feb 8, 2:01 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: ote that currently this is only available for DB2, MS-SQL, Ingres and Informix, but others can be easily added. At the time of writing, we cannot guarantee that the primarykey attribute works with every existing legacy table and every supported database backend. For simplicity, we recommend, if possible, creating a database view that has an auto-increment id field. Here what the book says... Do you have a compatible DMS? Richard On Wed, Feb 8, 2012 at 2:45 PM, Omi Chiba ochib...@gmail.com wrote: I have legacy table called IQWAGFTY which doesn't have id field so I specify primarkey for the existing field. I received KeyError: 'TYPRCD' for crud.updae but not crud.create. What am I doing wrong or is it not supported to update with primarykey ? Model - db.define_table('IQWAGFTY', Field('TYPRCD', length=15, label=Product Code:), Field('TYPRKJ', length=50, label=Part Number:), Field('TYTYPE', length=2, label=Type:), Field('TYFLAG', length=1, default=), Field('TYUUSR', length=128, default = auth.user.username.upper() if auth.user else None, label=Updated by:), Field('TYUDAT', 'datetime', default=request.now, label=updated on:), primarykey=['TYPRCD']) Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) TRACEBACK: Traceback (most recent call last): File D:\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 111, in module File D:\web2py\gluon\globals.py, line 149, in lambda self._caller = lambda f: f() File D:\web2py\gluon\tools.py, line 2456, in f return action(*a, **b) File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 68, in test return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File D:\web2py\gluon\tools.py, line 2978, in update detect_record_change = self.settings.detect_record_change): File D:\web2py\gluon\sqlhtml.py, line 1033, in accepts record_id = dict((k, request_vars[k]) for k in self.table._primarykey) File D:\web2py\gluon\sqlhtml.py, line 1033, in genexpr record_id = dict((k, request_vars[k]) for k in self.table._primarykey) KeyError: 'TYPRCD' Contoller(create:OK) - def test(): return dict(form=crud.create(db.IQWAGFTY))
Re: [web2py] Re: Update legacy table using primarykey failed
Maybe the : migrate=False I don't see it in your model so maybe web2py try to modify you database?? I have never use keyed table since web2py is not designed for and strongly suggest to migrate data into a surrogate refactored database model... Richard On Wed, Feb 8, 2012 at 3:07 PM, Omi Chiba ochib...@gmail.com wrote: Do you have a compatible DMS? Yes, I'm using DB2. On Feb 8, 2:01 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: ote that currently this is only available for DB2, MS-SQL, Ingres and Informix, but others can be easily added. At the time of writing, we cannot guarantee that the primarykey attribute works with every existing legacy table and every supported database backend. For simplicity, we recommend, if possible, creating a database view that has an auto-increment id field. Here what the book says... Do you have a compatible DMS? Richard On Wed, Feb 8, 2012 at 2:45 PM, Omi Chiba ochib...@gmail.com wrote: I have legacy table called IQWAGFTY which doesn't have id field so I specify primarkey for the existing field. I received KeyError: 'TYPRCD' for crud.updae but not crud.create. What am I doing wrong or is it not supported to update with primarykey ? Model - db.define_table('IQWAGFTY', Field('TYPRCD', length=15, label=Product Code:), Field('TYPRKJ', length=50, label=Part Number:), Field('TYTYPE', length=2, label=Type:), Field('TYFLAG', length=1, default=), Field('TYUUSR', length=128, default = auth.user.username.upper() if auth.user else None, label=Updated by:), Field('TYUDAT', 'datetime', default=request.now, label=updated on:), primarykey=['TYPRCD']) Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) TRACEBACK: Traceback (most recent call last): File D:\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 111, in module File D:\web2py\gluon\globals.py, line 149, in lambda self._caller = lambda f: f() File D:\web2py\gluon\tools.py, line 2456, in f return action(*a, **b) File D:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 68, in test return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File D:\web2py\gluon\tools.py, line 2978, in update detect_record_change = self.settings.detect_record_change): File D:\web2py\gluon\sqlhtml.py, line 1033, in accepts record_id = dict((k, request_vars[k]) for k in self.table._primarykey) File D:\web2py\gluon\sqlhtml.py, line 1033, in genexpr record_id = dict((k, request_vars[k]) for k in self.table._primarykey) KeyError: 'TYPRCD' Contoller(create:OK) - def test(): return dict(form=crud.create(db.IQWAGFTY))
Re: [web2py] Re: [web2py-users-brazil:2924] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
FreeBSD is the base. And that is the beauty and problem for some with BSD. All the developers of FreeBSD don't benefit from apple using their code. But at the same time they are the kind of coders that just are happy someone is using their code :) On Wed, Feb 8, 2012 at 11:54 AM, Cliff cjk...@gmail.com wrote: Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Apple seems to be doing OK with OS X. I don't recall what flavor of BSD kernel is at its base, but OS X is BSD with an Apple front end and very few Gnu utilities. On Feb 8, 9:41 am, Anthony abasta...@gmail.com wrote: Well BSD isn't what you want for your goals. BSD allows anyone to download and sell your code as if it was their own. Well, they are required to include the copyright notice and BSD license with the code, so they can't really pass it off as their own, and they aren't likely to be able to sell it given that it can be downloaded freely elsewhere (unless, of course, they make value-added contributions, which presumably would only be paid for if deemed worth the cost). Anthony -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] Re: Update legacy table using primarykey failed
I tried with both sqlite and postgresql and it works as expected. Are you sure you are using the last version of web2py ? exceptions and line number don't match with 1.99.4 (that is the version I tested for your sample code, the only different thing is that I don't have a DB2 instance available, sorry)
Re: [web2py] login next doesn't work Version 1.99.4 (2011-12-14 14:46:14) stable
I don't know how I can debug it :-/ On Wed, Feb 8, 2012 at 12:45 PM, Massimiliano mbelle...@gmail.com wrote: Same problem here On Fri, Feb 3, 2012 at 5:12 PM, Tito Garrido titogarr...@gmail.comwrote: Hi Folks, I'm using login with ldap and login_next doesn't work... from gluon.contrib.login_methods.ldap_auth import ldap_auth auth.settings.login_methods=[ldap_auth(mode='company',server='mycompany',base_dn='ou=myou,o= mycompany.com')] auth.settings.actions_disabled=['register','change_password','request_reset_password','profile'] auth.settings.remember_me_form = False auth.settings.login_next = URL('default','get_ldapgroups') Is it expected? It just goes to index and doesn't care about my redirection... Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Massimiliano -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
Re: [web2py] login next doesn't work Version 1.99.4 (2011-12-14 14:46:14) stable
Hi, Try this: 1. Logout from you app. 2. delete all your sessions files in sessions folder. (if your are in a development environment) 3. Login again and see how the redirect behave. Ricardo On Wed, Feb 8, 2012 at 8:57 PM, Tito Garrido titogarr...@gmail.com wrote: I don't know how I can debug it :-/ On Wed, Feb 8, 2012 at 12:45 PM, Massimiliano mbelle...@gmail.com wrote: Same problem here On Fri, Feb 3, 2012 at 5:12 PM, Tito Garrido titogarr...@gmail.com wrote: Hi Folks, I'm using login with ldap and login_next doesn't work... from gluon.contrib.login_methods.ldap_auth import ldap_auth auth.settings.login_methods=[ldap_auth(mode='company',server='mycompany',base_dn='ou=myou,o=mycompany.com')] auth.settings.actions_disabled=['register','change_password','request_reset_password','profile'] auth.settings.remember_me_form = False auth.settings.login_next = URL('default','get_ldapgroups') Is it expected? It just goes to index and doesn't care about my redirection... Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Massimiliano -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
Re: [web2py] login next doesn't work Version 1.99.4 (2011-12-14 14:46:14) stable
I've found that the problem could be in auth.navbar that doesn't take care of auth.settings.login_next and logout_next. I filed a bug and provided a patch. http://code.google.com/p/web2py/issues/detail?id=652 give it a try On Wed, Feb 8, 2012 at 10:08 PM, Ricardo Pedroso rmdpedr...@gmail.comwrote: Hi, Try this: 1. Logout from you app. 2. delete all your sessions files in sessions folder. (if your are in a development environment) 3. Login again and see how the redirect behave. Ricardo On Wed, Feb 8, 2012 at 8:57 PM, Tito Garrido titogarr...@gmail.com wrote: I don't know how I can debug it :-/ On Wed, Feb 8, 2012 at 12:45 PM, Massimiliano mbelle...@gmail.com wrote: Same problem here On Fri, Feb 3, 2012 at 5:12 PM, Tito Garrido titogarr...@gmail.com wrote: Hi Folks, I'm using login with ldap and login_next doesn't work... from gluon.contrib.login_methods.ldap_auth import ldap_auth auth.settings.login_methods=[ldap_auth(mode='company',server='mycompany',base_dn='ou=myou,o= mycompany.com')] auth.settings.actions_disabled=['register','change_password','request_reset_password','profile'] auth.settings.remember_me_form = False auth.settings.login_next = URL('default','get_ldapgroups') Is it expected? It just goes to index and doesn't care about my redirection... Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Massimiliano -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Massimiliano
[web2py] Re: is_https
thank you for the fast reply. I'm using scgi, so my setup looks like this: location / { include /etc/nginx/scgi_params; scgi_pass 127.0.0.1:4000; } to solve the problem I created a file scgi_ssl_params with following content: scgi_param SSL_PROTOCOL$ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; and modified my setup to: location / { include /etc/nginx/scgi_params; include /etc/nginx/scgi_ssl_params; scgi_pass 127.0.0.1:4000; }
[web2py] Re: Database error from constraint violation seemingly ignored
You are correct, I was clicking the delete button on the grid. Yes, I think checking the success or otherwise of the Ajax request sounds like the right thing to do - since calls to the db can fail for all sorts of reasons, not just constraints. Regards Mark Anthony wrote: In your case, were you doing the delete from an edit form or from the grid itself (via the delete button)? If the latter, what happens is that the row is immediately removed from the grid via Javascript, and then an Ajax request is sent to delete the record from the db -- but if the Ajax request fails (which I assume happened in your case), I don't think any feedback is displayed to the page. Perhaps we should correct that -- first check the response of the Ajax request, and only remove the row from the grid if it was successful, otherwise flash an error message.
Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?
That is a VERY good question. If you already have a setup like this, give it a shot and see if it worksI would be interested to know the result.
[web2py] Re: Update legacy table using primarykey failed
Good point. I was using ver 1.99.2. I tried with the 1.99.4 and now It shows a different error for the same contoller. Hm... strange. Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) Traceback: Traceback (most recent call last): File C:\web2py\gluon\restricted.py, line 204, in restricted exec ccode in environment File C:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 113, in module File C:\web2py\gluon\globals.py, line 172, in lambda self._caller = lambda f: f() File C:\web2py\gluon\tools.py, line 2533, in f return action(*a, **b) File C:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 69, in test db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File C:\web2py\gluon\tools.py, line 3069, in update detect_record_change = self.settings.detect_record_change): File C:\web2py\gluon\sqlhtml.py, line 1140, in accepts '%s != %s' % (record_id, self.record_id) SyntaxError: user is tampering with form's record_id: {'TYPRCD': None} != {'TYPRCD': '000115126002200'} On Feb 8, 2:35 pm, Niphlod niph...@gmail.com wrote: I tried with both sqlite and postgresql and it works as expected. Are you sure you are using the last version of web2py ? exceptions and line number don't match with 1.99.4 (that is the version I tested for your sample code, the only different thing is that I don't have a DB2 instance available, sorry)
[web2py] Re: Update legacy table using primarykey failed
I mean on version 1.99.2, I got error when I access the function(page). On version 1.99.4, I can access the function(page) but got the error when I submit. On Feb 8, 3:50 pm, Omi Chiba ochib...@gmail.com wrote: Good point. I was using ver 1.99.2. I tried with the 1.99.4 and now It shows a different error for the same contoller. Hm... strange. Contoller (update:NG) -- def test(): return dict(form=crud.update(db.IQWAGFTY, db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) Traceback: Traceback (most recent call last): File C:\web2py\gluon\restricted.py, line 204, in restricted exec ccode in environment File C:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 113, in module File C:\web2py\gluon\globals.py, line 172, in lambda self._caller = lambda f: f() File C:\web2py\gluon\tools.py, line 2533, in f return action(*a, **b) File C:/web2py/applications/Inventory_Reserve_Admin/controllers/ default.py, line 69, in test db.IQWAGFTY(db.IQWAGFTY.TYPRCD=='000115126002200'))) File C:\web2py\gluon\tools.py, line 3069, in update detect_record_change = self.settings.detect_record_change): File C:\web2py\gluon\sqlhtml.py, line 1140, in accepts '%s != %s' % (record_id, self.record_id) SyntaxError: user is tampering with form's record_id: {'TYPRCD': None} != {'TYPRCD': '000115126002200'} On Feb 8, 2:35 pm, Niphlod niph...@gmail.com wrote: I tried with both sqlite and postgresql and it works as expected. Are you sure you are using the last version of web2py ? exceptions and line number don't match with 1.99.4 (that is the version I tested for your sample code, the only different thing is that I don't have a DB2 instance available, sorry)
[web2py] Advice please: best way to count records?
I'm building my own record counter and paginator for index functions, like this: 'records 1 - 20 of 315 found by query' The question is what is the best way to get the total record count, in this case 315. In the case above, I use a limitby(0, 20) to get the first 20 records. I can think of two ways to do it, but I don't like either one. First is to formulate the query without the limitby clause and do a db(query).count(). That would give me the total number of records in the set. Then add the limitby clause to the query to get the records of interest. I don't like this because it involves two hits to the database. The second way is to get the entire record set by running a select without the limitby, then letting Python take the desired slice out of the row set. I don't like this method because it might return a lot of rows. Thus I get the db bottleneck again plus the overhead of turning all of the rows into Web2py objects. There must be a better solution. Can some kind soul tell me what it might be? All opinions welcome. Thanks, Cliff Kachinske
[web2py] Re: Database error from constraint violation seemingly ignored
+1 but if the Ajax request fails (which I assume happened in your case), I don't think any feedback is displayed to the page. Perhaps we should correct that -- first check the response of the Ajax request, and only remove the row from the grid if it was successful, otherwise flash an error message. In fact, I go one step further. I have the callback function in the controller rebuild the entire list table and update it via returned javascript. Maybe not appropriate for all situations, as these list tables usually contain 10 items and are just as likely to have items added as deleted. On Feb 8, 9:14 am, Anthony abasta...@gmail.com wrote: On Wednesday, February 8, 2012 2:16:21 AM UTC-5, Mark Kirkwood wrote: Sorry, I was not being all that clear. What I meant to say was: When I try to delete such a record, instead of the form telling me that the delete was prevented it appears to have succeeded. However a refresh of the form shows the record survived (and obviously the database log tells us why)! Forms don't know about database constraints -- they will only return and display friendly errors if a validator or onvalidation fails (that's why, for example, if you have notnull=True, you still need an IS_NOT_EMPTY() validator for the form to check for an empty field before submission). In your case, were you doing the delete from an edit form or from the grid itself (via the delete button)? If the latter, what happens is that the row is immediately removed from the grid via Javascript, and then an Ajax request is sent to delete the record from the db -- but if the Ajax request fails (which I assume happened in your case), I don't think any feedback is displayed to the page. Perhaps we should correct that -- first check the response of the Ajax request, and only remove the row from the grid if it was successful, otherwise flash an error message. Anthony
Re: [web2py] Advice please: best way to count records?
If your query don't involve joins, why not making to request to database? If you don't have a heavy load site I don't think you will have speed issue by doing it that way... web2py make a lot of request to database if you use represent (one request per row) since the lambda is attached to a record... Richard On Wed, Feb 8, 2012 at 5:15 PM, Cliff cjk...@gmail.com wrote: I'm building my own record counter and paginator for index functions, like this: 'records 1 - 20 of 315 found by query' The question is what is the best way to get the total record count, in this case 315. In the case above, I use a limitby(0, 20) to get the first 20 records. I can think of two ways to do it, but I don't like either one. First is to formulate the query without the limitby clause and do a db(query).count(). That would give me the total number of records in the set. Then add the limitby clause to the query to get the records of interest. I don't like this because it involves two hits to the database. The second way is to get the entire record set by running a select without the limitby, then letting Python take the desired slice out of the row set. I don't like this method because it might return a lot of rows. Thus I get the db bottleneck again plus the overhead of turning all of the rows into Web2py objects. There must be a better solution. Can some kind soul tell me what it might be? All opinions welcome. Thanks, Cliff Kachinske
[web2py] Re: web2py long term projects: experiences ?
Thanks Martin. Though I don't speak Spanish (I have a little Italian), I got enough from your presentation to understand the concepts behind no-models Web2py. Very clear presentation and code. On Feb 7, 6:35 am, Martín Mulone mulone.mar...@gmail.com wrote: I can tell my experience, I'm working for 2 years with web2py or more I think. I work in different projects, one I currently developing I think is quite big, work with millons of records, and is very complex and has many lines of code and many tables, is an internal application for a national company. Also I worked in instant press from 1 year ago or more, and many other applications. In matter of scaling what I can say. Don't keep it with the basic. For me this is python and the important is the code, the beauty of the code, make sure that you application use modules, yes import is a great thing, this keep you code well order, take in mind nobody wants to read an awfull code, and in a future you can add new code and debug the problems easily. When you have a big app, models are not a good idea, this is why some experience developers quite from using web2py, the problem is that are giving up too fast, because you can avoid using models in web2py app, or at least using elemental models. You can read more why in my slides from last pycon at argentinahttp://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110. Also you can read examples like lessmodel application that bruno rocha made or the plugin aproach by kenshi herehttp://dev.s-cubism.com/plugin_jstree. Scheduler is another great piece of code, it's small but pretty powerfull, It's really nice and I use a lot. I don't know why the people are not using more. You can run a long time task to avoid timeout of the server and client with long tasks. Dal, well in my experience is great but not always I can use full of it. Many times I have heavly or complex queries that I have to pass it with executesql. But dal is working pretty well with this mix. About breakage when upgrating web2py, yes I have some, but it's my fault because sometimes I'm using experimental features and not stable, I want always the last features, I remember scheduler and grid give me some trouble with this. But in generally I have running application of about 2-3 years ago with the last version. 2012/2/3 howesc how...@umich.edu i don't know of any blogs that discuss the experiences of users over the long term. i suspect this group history might be an indication. heck, check my posts over the past couple of years - whenever i hit bumps in the road i tend to ask questions here. are there specific things we can help answer? i have used web2py for 4 live production projects (and a few toys along the way), 3 of the 4 are on google app engine, and one of the 4 sees a sustained 60 requests a second average, so i've been using it all heavily (though not always the most up to date, i'm slow at incorporating new features). cfh -- http://www.tecnodoc.com.ar
[web2py] Re: Advice please: best way to count records?
Thanks Richard. Not heavy use sites as they are business to business or management tool sites. On Feb 8, 5:31 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: If your query don't involve joins, why not making to request to database? If you don't have a heavy load site I don't think you will have speed issue by doing it that way... web2py make a lot of request to database if you use represent (one request per row) since the lambda is attached to a record... Richard On Wed, Feb 8, 2012 at 5:15 PM, Cliff cjk...@gmail.com wrote: I'm building my own record counter and paginator for index functions, like this: 'records 1 - 20 of 315 found by query' The question is what is the best way to get the total record count, in this case 315. In the case above, I use a limitby(0, 20) to get the first 20 records. I can think of two ways to do it, but I don't like either one. First is to formulate the query without the limitby clause and do a db(query).count(). That would give me the total number of records in the set. Then add the limitby clause to the query to get the records of interest. I don't like this because it involves two hits to the database. The second way is to get the entire record set by running a select without the limitby, then letting Python take the desired slice out of the row set. I don't like this method because it might return a lot of rows. Thus I get the db bottleneck again plus the overhead of turning all of the rows into Web2py objects. There must be a better solution. Can some kind soul tell me what it might be? All opinions welcome. Thanks, Cliff Kachinske
[web2py] xml-rpc code causes compile error in mywiki default.py
Hello, While working through the book I got to the part in chapter 3 mywiki where you replace def call()... function with [code] service = Service() @service.xmlrpc def find_by(keyword): finds pages that contain keyword for XML-RPC return db(db.page.title.contains(keyword).select().as_list() def call(): exposes all registered services, including XML-RPC return service() [code] in default.py However, I get a compile error saying: failed to compile because: SyntaxError at line 96 at char 2 invalid syntax (C:web2py/applications/mywiki/controllers/default/py, line 96) I have little to no experience programming in Python so i bet this is an easy error for you guys to spot. Thank youin advance for your help. Regards, Bill
[web2py] maybe minor bug or just documentation
I set a field in a table definition to unique = True. I then tested this and deliberately entered a duplicate value. The result was an error ticket: 76.22.75.122.2012-02-08.23-48-55.c324e160-1b8e-4db0-9345-5422e59467c2 class 'psycopg2.IntegrityError' duplicate key value violates unique constraint category_name_key DETAIL: Key (name)=(Religious) already exists. VERSION This is a bit unfortunate as this is a very likely runtime error as a site visitor might not realize his entry was a duplicate. I went back and added a constraint on the field: jodb.category.name.requires = IS_NOT_IN_DB(jodb,jodb.category.name) I went back and added a deliberate duplicate and the error was trapped when the form was submitted, which was the right behavior (though the message isn't that pretty!). I only point this out because the web2py book says that adding the constraint is optional when a field has been set to unique. Well, it's not really optional if you don't want your users seeing a runtime error: In line 14, db.image.title represents the field title of table image. The attribute requires allows you to set requirements/constraints that will be enforced by web2py forms. Here we require that the title is unique: IS_NOT_IN_DB(db, db.image.title) Notice this is optional because it is set automatically given that Field(’title’, unique=True). I think these two specifications do two different things. Setting the field to unique tells the DAL to tell the db to make the field values unique in the DDL. Setting the constraint tells web2py to enforce uniqueness in CRUD. You need to do both.
[web2py] Re: option to move smartgrid buttons to the left side
Still have to ask one more time about this possibility, or something else that would help for mobile viewing of smartgrid. Just opened the application on iPad and all is perfect, actually IMPRESSIVE. But on the android phone, I couldn't scroll horizontally to reach buttons and that is a problem. Is there anything to do to make smartgrid usable on the android phone? (not sure how it behaves on iPhone) Thanks,Adnan
Re: [web2py] Re: is_https
Joerg, Sorry for late reply, yes your solution is very correct. mic 2012/2/8 Joerg Poeltl joerg.poe...@newmind.at: thank you for the fast reply. I'm using scgi, so my setup looks like this: location / { include /etc/nginx/scgi_params; scgi_pass 127.0.0.1:4000; } to solve the problem I created a file scgi_ssl_params with following content: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; and modified my setup to: location / { include /etc/nginx/scgi_params; include /etc/nginx/scgi_ssl_params; scgi_pass 127.0.0.1:4000; }
[web2py] Re: maybe minor bug or just documentation
In line 14, db.image.title represents the field title of table image. The attribute requires allows you to set requirements/constraints that will be enforced by web2py forms. Here we require that the title is unique: IS_NOT_IN_DB(db, db.image.title) Notice this is optional because it is set automatically given that Field(’title’, unique=True). The book says that explicitly adding the IS_NOT_IN_DB validator is optional because if you specify unique=True but do not explicitly specify any validators at all, the IS_NOT_IN_DB validator will be assigned automatically. For example: db.define_table('user', Field('username', unique=True)) print db.user.username.requires [gluon.validators.IS_NOT_IN_DB object at 0x0439D710, gluon.validators.IS_LENGTH object at 0x0439D5F8] Notice that I did not specify the IS_NOT_IN_DB validator in the field definition, but it was added anyway because I set unique=True. Note, this only happens if you don't specify requires at all. Anthony
Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?
Using mmap you share memory among processes. You have at least two ways: 1) named 2) unnamed With 1) named mmap you just open the handle in each process. With 2) you need to open the handle before the fork. I suggest 1) because fcgi or scgi fork early so you could not be able to create an unnamed mmap before fork, even if it is possible. Locking/semaphores is not a problem, just think of using the same semantic of file locking (i.e. each process can lock for read or write random ranges of bytes). You can reach a very high level of parallelism with lower dead-locking probability than with java threads. mic mic 2012/2/8 Ross Peoples ross.peop...@gmail.com: That is a VERY good question. If you already have a setup like this, give it a shot and see if it worksI would be interested to know the result.
[web2py] why many lines in /root/var/log/uwsgi-python/web2py log : routing 0 routes 0 ?
Hi, My production environment: latest web2py trunk, nginx, uwsgi, postgresql, ubuntu, linode. Why are there many lines (one per web request) in the following format: Wed Feb 8 19:03:53 2012* - routing 0 routes 0* showing in the following log file:? /root/var/log/uwsgi-python/web2py.log ? Is it coming from web2py or uwsgi or nginx or?. How can I turn this logging off?. Thanks, Carlos
[web2py] Re: how to deploy web2py not in the apache root (help with url rewriting)
Hi, I have had some success using wsgi on a fedora system by installing the following config file in /etc/httpd/conf.d . It's basically the config from the online manual with rewrite rules taken from the user group. I have two applications, 'cpa4' and 'master' that are accessed with http://server2/w2p/cpa4 and http://server/w2p/master. -- NameVirtualHost *:80 NameVirtualHost *:443 VirtualHost *:80 ServerName server2 RewriteEngine on RewriteLog /var/log/httpd/rewrite_log RewriteLogLevel 9 RewriteRule ^/master(.*)$ /w2p/master$1 [PT,L] RewriteRule ^/cpa4(.*)$ /w2p/cpa4$1 [PT,L] WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py WSGIDaemonProcess web2py user=apache group=apache home=/opt/web-apps/ web2py WSGIProcessGroup web2py Directory /opt/web-apps/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory AliasMatch ^/([^/]+)/static/(.*) /opt/web-apps/web2py/applications/ $1/static/$2 Directory /opt/web-apps/web2py/applications/*/static Options -Indexes Order Allow,Deny Allow from all /Directory Location /admin Deny from all /Location LocationMatch ^/([^/]+)/appadmin Deny from all /LocationMatch CustomLog /var/log/httpd/access_log common ErrorLog /var/log/httpd/error_log /VirtualHost VirtualHost *:443 ServerName server2 SSLEngine on SSLCertificateFile /etc/httpd/ssl/self_signed.cert SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key RewriteEngine on RewriteLog /var/log/httpd/rewrite_log RewriteLogLevel 9 RewriteRule ^/admin(.*)$ /w2p/admin$1 [PT,L] RewriteRule ^/examples(.*)$ /w2p/examples$1 [PT,L] WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py WSGIDaemonProcess web2py2 user=apache group=apache home=/opt/web- apps/web2py WSGIProcessGroup web2py2 Directory /opt/web-apps/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory AliasMatch ^/([^/]+)/static/(.*) /opt/web-apps/web2py/applications/ $1/static/$2 Directory /opt/web-apps/web2py/applications/*/static Options -Indexes ExpiresActive On ExpiresDefault access plus 1 hour Order Allow,Deny Allow from all /Directory CustomLog /var/log/httpd/access_log common ErrorLog /var/log/httpd/error_log /VirtualHost -- On Feb 8, 12:52 pm, giovanni allegri gioha...@gmail.com wrote: For now I've solved setting the WSGIScriptAlias to /w2p and in routes.py: routes_out = ((r'/(?Pany.*)', r'/w2p/\gany'),) Any comments are welcome for something cleaner, but I fear that reverse rewriting for URL() is only possible if set inside routes.py. Am I wrong? giovanni On 8 Feb, 18:45, giovanni allegri gioha...@gmail.com wrote: I've seen a lot of examples to manage url rewriting and proxying with web2py, but I haven't found a solution to my problem. I don't have much experience with mod_rewrite, but I would like to use it and avoid rewriting inside web2py (through its routes facilites). My situation is a single domain, where various applications are hosted through Aliases. I have path_to_wsgi/applications/myapp, and I would like to serve it athttp://my.domain.ip/myapp. The domain root points to another service, so I can't install web2py to the root. Is there e ready to use recipe to do it? Thanks giovanni
[web2py] Re: using radio widget can't receive the empty submit
Got it. Thanks a lot for your patience and the explanation. On Feb 8, 10:45 pm, DenesL denes1...@yahoo.ca wrote: Note that when there are no values in the set then *no* input type=radio fields are created in the form, so there is nothing to send when you submit the form. On Feb 7, 10:38 pm,Danideall...@googlemail.com wrote: You are right, if I used an non-empty list to submit, both forms work fine. so the widget = SQLFORM.widgets.radio.widget did have different behavior to the form submission.
[web2py] Re: Handling a POST
I use this code to accept an image submission from an iPhone app: def mobilepost(): item_id = 0 form = SQLFORM.factory( Field('username'), Field('title'), Field('price'), Field('image', 'upload', uploadfolder=request.folder+'static/uploads')) if form.accepts(request): user = db(db.auth_user.email==form.vars.username).select().first() if user: item_id = db.item.insert(seller=user, title=form.vars.title, image=form.vars.image_newfilename, start_price=form.vars.price, price_change=form.vars.price * 0.1) elif form.errors: response.flash = 'form has errors' app_logging.info(form.errors) return ''
[web2py] Wanting to learn
I'm wanting to learn how to use the web2py framework but I'm a bit of a python newbie. I've got some of the basics down and I have experience in other languages(mostly php/javascript and some java). I've been looking through the web2py book and I really want to find something that will walk you through creating an app. I want to see how things connect with one another. I could look at some simple apps on github but I'm worried I'll get lost trying to figure them out at this point. Does such a guide exist?
[web2py] Re: Wanting to learn
Did you try recreating the example in Overview section of online book? On Feb 9, 9:42 am, bradcland bradcl...@gmail.com wrote: I'm wanting to learn how to use the web2py framework but I'm a bit of a python newbie. I've got some of the basics down and I have experience in other languages(mostly php/javascript and some java). I've been looking through the web2py book and I really want to find something that will walk you through creating an app. I want to see how things connect with one another. I could look at some simple apps on github but I'm worried I'll get lost trying to figure them out at this point. Does such a guide exist?
[web2py] Re: Wanting to learn
I'd suggest sticking to the Web2py book in the beginning. The Overview chapter essentially steps you through building app-like functionality (ie, a wiki). http://web2py.com/books/default/chapter/29/3
[web2py] session2trash doesn't work with separate=True
with this option: session.connect(request, response, separate=True) session2trash script crashed (it couldn't unlink directories). Can someone fix this? Thanks.
[web2py] Re: Anyone deployed web2py on 1and1 shared hosting?
Just an update I opened a webfaction account, pointed one of my 1and1 domains to it, and installed web2py by running a single script I found on the webfaction forum... Install web2py with nginx and uwsgihttp://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi
[web2py] Re: The Delete doesn't work in my SQLForm.Grid
Thanks a lot, Niphlod. It seems that's my environment issue, I created a new project with colorus plugin and the Delete in grid works just fine. Thanks again. On Feb 8, 8:54 pm, Niphlod niph...@gmail.com wrote: Uhm, strange. If you see the table from the admin app, after you delete the record there is still the same record on the table ? This question arises because delete attaches a small javascript onclick of the delete button that fires an ajax request to delete the record and then removes the row from the DOM. There is the possibility that there's an hiccup in the javascript on the page, that stops this from happening. Also, there is the possibility that the ajax request is fired but not the piece of the removal of the row from the actual grid. Just see if the ajax request is made when you press the button or if there are any errors debugging the page, e.g. with firebug.
[web2py] How to upload the file through the controller in uploads folder and insert them into database
def create(): import os filepath = os.path.join(request.folder,'uploads') form = FORM(TABLE(TR(Compliance Activity:,INPUT(_type=text,_name=activity,requires=IS_NOT_EMPTY(error_message='Please Enter the Activity'))), TR(Document:,INPUT(_type=file,_name=fileupload,requires=IS_NOT_EMPTY(error_message='Please Select the file you want to Upload'))), TR(,INPUT(_type=submit,_value=SUBMIT if form.accepts(request.vars, session): session.activity = form.vars.activity session.fileupload = form.vars.fileupload.filename db.submit_compliance_detail.insert(compliance_activity=session.activity,compliance_manager='themisde...@gmail.com',compliance_owner=auth.user.email,document=session.fileupload) response.flash = 'uploaded' return dict(form=form)