[web2py] Re: Installing the book as an app?
I'm sorry, the error ticket was my fault - forget it. The book application is working fine. Nico --
[web2py] Upload field with clear text filename
I'm not sure why this is difficult, but I see many posts about this when I search, yet none exactly work for me. This seems like it should be easy but is surprisingly difficult in web2py. I want to keep a table of uploaded files with the uploads in a blob field and the names in clear text in a filename field. Like this model: db.define_table(fileobject, Field(filename,string,length=50,readable=False,writable=False), Field(upload,upload,uploadfield=object_data), Field(object_type,string,length=20,readable=False,writable=False), Field(object_data,blob), Field(owner,reference auth_user,default=auth.user_id,readable=False, writable=False), Field(saved,datetime,default=datetime.now(),readable=False,writable= False), Field(state,string,length=16,readable=False,writable=False), migrate=settings.migrate) Reading the relevant posts and the online book lead me to believe the way is with a controller like this one: def index(): form=SQLFORM(db.fileobject) if request.vars.upload: form.vars.filename = request.vars.upload.filename if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form=form) And yet this controller does not work. The blob is filled in but the filename is ignored and shows in the table as None. In fact, form.vars is an empty collection and placing form.vars.filename in it does not produce an error, but it is ignored by the form processing. In addition to the filename, I'd like to add the information about the object type etc. at the same point in the process, i.e. after the file has been chosen but before it has been loaded into the database. I've been trying to scan through the code (I'm using 2.3.2 source) to answer my own questions about the upload field but it's just taking too much time. The upload field is one of those parts of web2py that you either love or... uh... don't. To me it seems designed for a very specific use model. If my use model deviates too much then using upload is like pounding square pegs into round holes. I'm tired of pounding. Someone show me how to whittle off the corners of my square peg! (You would think this would be an easy task, yet from the number of posts on this exact topic I know I'm in the company of a large number of others.) --
[web2py] Re: Table Name from ROWS object
yes please; it would be really helpful for beginners like me thank you On Friday, 28 December 2012 12:56:44 UTC+5, Massimo Di Pierro wrote: Apparently only in one example: http://web2py.com/books/default/search/29?search=**dict I can add something about this. On Friday, 28 December 2012 01:24:37 UTC-6, at wrote: thank you massimo for this interesting and very useful tip ... it would save my good amount of time btw, is this syntax available in web2py documentation? On Friday, 28 December 2012 12:05:46 UTC+5, Massimo Di Pierro wrote: *db((db[table_name].id == rowid) (db[table_name][myfld] == )).update([myfld] = myvalue)* * * *should be* * * *db((db[table_name].id == rowid) (db[table_name][myfld] == )).update(**{myfld:myvalue})* * * On Friday, 28 December 2012 00:40:15 UTC-6, at wrote: It's working when I give table_name after getting table object programatically, but when the same syntax is used for column names in update statement it returns syntax error; please consider the following statement: *db((db[table_name].id == rowid) (db[table_name][myfld] == )).update([myfld] = myvalue)* thanks On Thursday, 27 December 2012 19:41:45 UTC+5, Anthony wrote: * db(db[tname].id http://db.tname.id/ == rowid).select() *or just: db[tname](rowid) Anthony On Thursday, December 27, 2012 9:35:55 AM UTC-5, at wrote: Wanted to avoid hard-coding table name in the following statement by using var *tname*, but not successful: any tip pls? *db(db.tname.id == rowid).select* Thanks On Thursday, 27 December 2012 19:10:31 UTC+5, at wrote: gr8! *tname,z=my_rows.colnames[0].split('.')* gave the desired table name thanks very much! best regards On Thursday, 27 December 2012 18:47:07 UTC+5, Massimo Di Pierro wrote: Yes and No. You can get rows.colnames and they contain table names . field name On Thursday, 27 December 2012 07:45:52 UTC-6, at wrote: How can we get table name from ROWS object? Thanks --
[web2py] Re: Installing the book as an app?
On Friday, 28 December 2012 18:56:37 UTC+11, Nico Zanferrari wrote: Hello, the right URL is https://github.com/mdipierro/web2py-book.git ;-)) Ah, that makes quite a difference :) Thanks. git itself doesn't need the .git --
[web2py] Re: Upload field with clear text filename
Are you saying you want the name in the filename field to be encoded into the string stored in the upload field so the file has the name in the filename field upon download? If so, then try: if request.vars.upload and request.vars.filename: request.vars.upload.filename = request.vars.filename form = SQLFORM(db.fileobject) That will re-assign the filename of the uploaded file to the value entered by the user, and web2py will then encode that user-entered filename into the new filename. Another option is to do nothing upon upload and instead replace the original filename with the user-entered filename upon download (which you could do via a custom_retrieve function for the upload field). Note, web2py relies on the filename extension to set the HTTP headers appropriately upon download, so you may want to add some logic to obtain the original filename extension in case the user fails to enter it. Anthony On Friday, December 28, 2012 4:15:52 AM UTC-5, Joe Barnhart wrote: I'm not sure why this is difficult, but I see many posts about this when I search, yet none exactly work for me. This seems like it should be easy but is surprisingly difficult in web2py. I want to keep a table of uploaded files with the uploads in a blob field and the names in clear text in a filename field. Like this model: db.define_table(fileobject, Field(filename,string,length=50,readable=False,writable=False), Field(upload,upload,uploadfield=object_data), Field(object_type,string,length=20,readable=False,writable=False), Field(object_data,blob), Field(owner,reference auth_user,default=auth.user_id,readable= False,writable=False), Field(saved,datetime,default=datetime.now(),readable=False, writable=False), Field(state,string,length=16,readable=False,writable=False), migrate=settings.migrate) Reading the relevant posts and the online book lead me to believe the way is with a controller like this one: def index(): form=SQLFORM(db.fileobject) if request.vars.upload: form.vars.filename = request.vars.upload.filename if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form=form) And yet this controller does not work. The blob is filled in but the filename is ignored and shows in the table as None. In fact, form.vars is an empty collection and placing form.vars.filename in it does not produce an error, but it is ignored by the form processing. In addition to the filename, I'd like to add the information about the object type etc. at the same point in the process, i.e. after the file has been chosen but before it has been loaded into the database. I've been trying to scan through the code (I'm using 2.3.2 source) to answer my own questions about the upload field but it's just taking too much time. The upload field is one of those parts of web2py that you either love or... uh... don't. To me it seems designed for a very specific use model. If my use model deviates too much then using upload is like pounding square pegs into round holes. I'm tired of pounding. Someone show me how to whittle off the corners of my square peg! (You would think this would be an easy task, yet from the number of posts on this exact topic I know I'm in the company of a large number of others.) --
Re: [web2py] Re: delete uploads with SQLFORM.factory
Hi, I had a look at sqlform.py, the error comes from the fact that if a default value is set for the field upload, web2py tries to read it and store it as the new value for the upload field. As a result it is not possible to me to edit forms and remove uploads by setting the default value, this trick doesn't work. Moreover, I tried to fix the initial error about the missing file, by setting db.test_img['picture'].default equal to real path of the file. This worked well but than, if I understood correctly how web2py works, it tried to store again the default value as the new value, starting a kind of loop! That was wrong, and actually this has never worked, it stopped due to the 'error filename' to long. The good thing is that by changing this two line (line 1394 of sqlhtml.py) f = self.table[fieldname].default or '' fields[fieldname] = f to: fields[fieldname] = self.table[fieldname].default It seems that this solved the issue, but of course, I need something better. 2012/12/27 Paolo paolo.vall...@gmail.com Hi Massimo, thank for the answer, I updated the code but the problem is still there, I made several tests, no one figured out what is wrong. So that I tried to simplify the code as follows: db.define_table('test_img', Field(picture, upload, uploadfolder=os.path.join(request.folder,'uploads','pictures'), uploadseparate=True), Field('created_on', 'datetime', default=request.now, writable=False) ) def sqlform_add(): form = SQLFORM.factory(db.test_img, _class='well', upload=URL('default', 'download'), uploadfolder=os.path.join(request.folder, 'uploads','pictures'), uploadseparate=True, table_name='test') if form.process(dbio=False).accepted: id = db.test_img.insert(**dict(form.vars)) return response.render('generic.html', dict(form=form)) def sqlform_edit(): img = db(db.test_img.id0).select().first() db.test_img['picture'].default = img['picture'] form = SQLFORM.factory(db.test_img, _class='well', upload=URL('default', 'download'), uploadfolder=os.path.join(request.folder, 'uploads','pictures'), uploadseparate=True, table_name='test') if form.process(dbio=False).accepted: print 'form accepted' return response.render('generic.html', dict(form=form)) what I got: - adding an img with sqlform_add and then removing it with appadmin -- worked - adding an img with appadmin and then removing it with sqlform_edit -- failed - using both sqlform_add and sqlform_edit -- failed Now I am thinking about the way I set the default value, maybe for a field as an upload I have to set something more? Paolo On Thursday, December 27, 2012 9:28:54 PM UTC+1, Massimo Di Pierro wrote: perhaps not the cause of the problem but request.folder+'uploads/**pictures' should be os.path.join(request.folder,'**uploads','pictures') On Thursday, 27 December 2012 00:30:00 UTC-6, Paolo wrote: Hi Massimo, I've just tried to post and then edit with both SQLFORM.factory having uploadseparate but nothing has changed. The problem is still there, actually I am making explicitly inserts and edits. The whole SQLFORM.factory to edit a field is this: for field in ['title','description', 'user_contact', 'picture' ]: db.club[field].default = club[field] for field in ['name']: db.cities[field].default = city[field] form = SQLFORM.factory(db.club, db.cities, _class='well', formstyle='bootstrap', showid= False, upload=URL('default', 'download'),uploadfolder =request.folder+'**uploads/pictures', uploadseparate=True, autodelete=True,table_name ='club') Paolo On Thursday, December 27, 2012 12:47:19 AM UTC+1, Massimo Di Pierro wrote: Did you upload the file first and then add uploadseparate/uploadfolder? On Wednesday, 26 December 2012 12:49:01 UTC-6, Paolo wrote: Hi all, it seems to me that SQLFORM.factory doesn't honor the uploadseparate option because I'am not able to delete the uploaded file with SQLFORM.factory form = SQLFORM.factory(db.club, db.cities, _class='well', formstyle='bootstrap', showid= False, upload=URL('default', 'download'), uploadfolder =request.folder+'**uploads/pictures', uploadseparate=True, autodelete=True,table_name ='club' ) The error: Enter code here...2012-12-26 19:38:07,728 - web2py - ERROR - Traceback (most recent call last): File /home/paolo/Dropbox/git/**web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/paolo/Dropbox/git/**web2py/applications/bikend/** controllers/club.py, line 123, in module
Re: [web2py] Re: Graph Model (proposal to contribute)
Too bad graphviz does not accept css (and the source is weird also). I wonder if there is any alternative library with similar functionality. Maybe something to produce an svg visual model with a simple API. Am I asking too much? --
[web2py] nesting in views
I have a following problem with the syntax, who can help me here please. here is my code: *{{=A(XML(T('New Ticket')), _href='#', [if '/ttracker/index' in request.env.path_info: _style='text-decoration: bold;' pass])}} * syntax error: [if... what is the correct syntax? --
Re: [web2py] Can the parametric router 301 redirect from www?
On 27 Dec 2012, at 10:31 PM, HittingSmoke hittingsm...@gmail.com wrote: Pretty straight forward question. Can I use the parametric routes.py language to 301 redirect from www.domain.com to domain.com for proper search engine crawling? You'd be better off configuring your server to do that. If you want to use web2py routes, I think you need the pattern-matching router. --
[web2py] setup-web2py-ubuntu.sh and Python 2.7
I want to make a new Python installtion on a Debian computer. I have installed Python 2.7.3, because there are some new language constructs I want to use. Afterwards I have made a new installation of web2py using the script setup-web2py-ubuntu.sh. Works fine, but it uses Python 2.6 What changes should I make? Regards, Martin --
Re: [web2py] Where to host web2py
Gustavo, Make sure that you're accessing it via https, I've noticed that if I click on the admin button from the main page accessed via http, it uses whatever transport protocol that was specified to get there. If you're already doing this I'd take a look at the web2py logs in $OPENSHIFT_PYTHON_LOG_DIR. A while back I had submitted a bug for how their proxy didn't set wsgi params when it passed the request to the gear. That's been the only time I've run into an issue like that. Also make sure your options_std.py is linked to options.py If you come across any more info, I'd be happy to take a look. Andrew On Wednesday, December 26, 2012 8:38:21 AM UTC-6, Gustavo Souza wrote: Hi Adrew, I followed these steps and was able to deploy the web2py, and it works! ... I did with version 2.3.2 My only problem is that the web2py admin panel is disabled. I created the file parameters_443.py and put the password hash, but still the message appears admin disabled because unable to access password file I have to change something? Em domingo, 19 de agosto de 2012 20h39min52s UTC-3, Andrew escreveu: A little different in order. Do all the openshift stuff first, then download web2py and copy it into the wsgi folder. I would suggest using the application file I provide on the github repo and modify: This: sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'libs', 'gluon')) to This: sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'wsgi', 'web2by', 'gluon')) #honestly I don't know if sys.path.append handles stuff recursively so maybe this isn't necessary and you just comment out the gluon line. There are other nuances like addressing db host / port / user / pass variables that should all be setup in wsgi/application file. For example if you're using SQL lite, I have an example variable setup in the wsgi/application handler and then in your model you'd just use something like: db = DAL('sqlite://storage.sqlite',folder=SQLITE_DIR) If you want to use the admin, you'll need to create a parameters_443.py with your hashed password in it but there are caveats to using the IDE in the cloud since app changes are applied via rhc / git. This is why I created the openshift deployer. Andrew --
[web2py] Re: Graph Model (proposal to contribute)
Hi, just to clarify please... is this to show the model using a graphical model? Or is it for extending the DAL to support Graph databasehttp://en.wikipedia.org/wiki/Graph_databasemodels ? -- Luc. On Saturday, 15 December 2012 14:49:48 UTC, Jose wrote: Hi I modified the admin and welcome, to allow create a model graph. https://lh5.googleusercontent.com/-z1rs1IRsFcQ/UMyMMJlwbiI/ABQ/RYtc02P-6EU/s1600/button.jpeg The click in button grahp model shows something like: https://lh3.googleusercontent.com/-PBWs_z2wW9A/UMyNvshomVI/ABg/oJbgEb1wjks/s1600/diagram.jpeg depends only of pygraphviz. Best Regards, Jose --
Re: [web2py] Re: Graph Model (proposal to contribute)
D3js 2012/12/28 Alan Etkin spame...@gmail.com Too bad graphviz does not accept css (and the source is weird also). I wonder if there is any alternative library with similar functionality. Maybe something to produce an svg visual model with a simple API. Am I asking too much? -- --
Re: [web2py] WWW SQL Designer to DAL converter
Yes, it's pretty much the same, you can also generate web2py from it, and it works just fine. Well, the relations needs a bit of work, but it does make it easier. On Friday, December 28, 2012 12:12:32 AM UTC-7, Massimo Di Pierro wrote: Didn't we have this already? http://gaesql.appspot.com/ I am not sure who owns that. I think this is the source: web2py.app.SqlDesigner.w2p but I am not 100% sure. Anyway, probably the one by Elcio is better. It would be nice if it could go both ways (export and import). Massimo On Friday, 28 December 2012 00:56:28 UTC-6, rochacbruno wrote: Great! It would be nice if we automate the whole process, users put the .xml in /models or /private folder and this script can be called automatically if model doesnt exists, or we can put a button in admin generate models -- upload the xml I will do some tests! On Thu, Dec 27, 2012 at 10:28 PM, Elcio Ferreira elc...@gmail.comwrote: https://github.com/elcio/visualdal Feedback and suggestions, please. Elcio http://visie.com.br/ http://elcio.com.br/ -- --
[web2py] Re: Upload field with clear text filename
Hi Anthony -- I want the opposite of this -- I want the actual text filename, not the encoded one. The book example I followed did not work. -- Joe On Friday, December 28, 2012 2:18:24 AM UTC-8, Anthony wrote: Are you saying you want the name in the filename field to be encoded into the string stored in the upload field so the file has the name in the filename field upon download? If so, then try: if request.vars.upload and request.vars.filename: request.vars.upload.filename = request.vars.filename form = SQLFORM(db.fileobject) That will re-assign the filename of the uploaded file to the value entered by the user, and web2py will then encode that user-entered filename into the new filename. Another option is to do nothing upon upload and instead replace the original filename with the user-entered filename upon download (which you could do via a custom_retrieve function for the upload field). Note, web2py relies on the filename extension to set the HTTP headers appropriately upon download, so you may want to add some logic to obtain the original filename extension in case the user fails to enter it. Anthony On Friday, December 28, 2012 4:15:52 AM UTC-5, Joe Barnhart wrote: I'm not sure why this is difficult, but I see many posts about this when I search, yet none exactly work for me. This seems like it should be easy but is surprisingly difficult in web2py. I want to keep a table of uploaded files with the uploads in a blob field and the names in clear text in a filename field. Like this model: db.define_table(fileobject, Field(filename,string,length=50,readable=False,writable=False), Field(upload,upload,uploadfield=object_data), Field(object_type,string,length=20,readable=False,writable=False ), Field(object_data,blob), Field(owner,reference auth_user,default=auth.user_id,readable= False,writable=False), Field(saved,datetime,default=datetime.now(),readable=False, writable=False), Field(state,string,length=16,readable=False,writable=False), migrate=settings.migrate) Reading the relevant posts and the online book lead me to believe the way is with a controller like this one: def index(): form=SQLFORM(db.fileobject) if request.vars.upload: form.vars.filename = request.vars.upload.filename if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form=form) And yet this controller does not work. The blob is filled in but the filename is ignored and shows in the table as None. In fact, form.vars is an empty collection and placing form.vars.filename in it does not produce an error, but it is ignored by the form processing. In addition to the filename, I'd like to add the information about the object type etc. at the same point in the process, i.e. after the file has been chosen but before it has been loaded into the database. I've been trying to scan through the code (I'm using 2.3.2 source) to answer my own questions about the upload field but it's just taking too much time. The upload field is one of those parts of web2py that you either love or... uh... don't. To me it seems designed for a very specific use model. If my use model deviates too much then using upload is like pounding square pegs into round holes. I'm tired of pounding. Someone show me how to whittle off the corners of my square peg! (You would think this would be an easy task, yet from the number of posts on this exact topic I know I'm in the company of a large number of others.) --
[web2py] Re: new admin in trunk
Works fine for me too. It's a little large looking on my screen. But I notice the same about my own Bootstrap-based app. I almost feel like I need to find a way to trim out some of the extra whitespace and reduce the font sizes a tad. But that's probably just me. -- Joe B. On Monday, December 24, 2012 12:00:29 PM UTC-8, Massimo Di Pierro wrote: As a Christmas present (not from me but from Paolo) there is a new admin in trunk based on Bootstrap. Please check it out. If this is ok we should soon commit 2.4.1 because there are yet more bug fixes. ;-) Massimo --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
{{=auth.navbar(user_identifier='%(email)s')}} This defaults to user_identifier='%(first_name)s' but you do not have a first name. On Friday, 28 December 2012 01:10:34 UTC-6, Alec Taylor wrote: Thanks, but that also isn't working: `type 'exceptions.AttributeError' 'Row' object has no attribute 'first_name'` But I do get a different traceback, i.e., here: web2py\gluon\tools.py, line 1285, in navbar user_identifier = user_identifier % self.user On Fri, Dec 28, 2012 at 5:41 PM, Bruno Rocha rocha...@gmail.comjavascript: wrote: For the record: There is a problem on this line https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1415 If you use auth.signature it will raise an error do I propose to change it to: return '%s %s' % (user.get(first_name, email), user.get(last_name, )) or some other check. -- --
[web2py] Re: nesting in views
*{{=A(T('New Ticket'), _href='#', **_style=('text-decoration: bold;' if** '/ttracker/index' in request.env.path_info else None))}} * On Friday, 28 December 2012 05:42:07 UTC-6, _developer_ wrote: I have a following problem with the syntax, who can help me here please. here is my code: *{{=A(XML(T('New Ticket')), _href='#', [if '/ttracker/index' in request.env.path_info: _style='text-decoration: bold;' pass])}} * syntax error: [if... what is the correct syntax? --
Re: [web2py] Re: Graph Model (proposal to contribute)
I would very much prefer if the graph were generated in JS instead of using serverside code. On Friday, 28 December 2012 12:34:49 UTC-6, Ramos wrote: D3js 2012/12/28 Alan Etkin spam...@gmail.com javascript: Too bad graphviz does not accept css (and the source is weird also). I wonder if there is any alternative library with similar functionality. Maybe something to produce an svg visual model with a simple API. Am I asking too much? -- --
[web2py] Redmine beside web2py with Nginx deployment script
Hello, This is a new year gift for the one who would use Redmine beside web2py... :) The script is largely base on new Niphold web2py nginx deployment script ( https://groups.google.com/forum/?fromgroups=#!searchin/web2py/nginx$20niphold/web2py/15J3T35_K_w/v_t1099dIf4J ). I spend many hours write it, test it and debug Redmine, so I copyright it and distribute it under CC without commercial use. Executing it in a fresh Ubuntu 12.04 server you will get : - Latest Redmine stable (2.2.0 from http://rubyforge.org), - Rails (3.2.9 from GEM) - Ruby (ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]) (Ubuntu ruby-dev package that should correspond to the latest stable Ruby) - working with Unicorn (latest stable from GEM), - web2py (latest stable) - uWSGI (I think latest stable), start in Emperor mode - Nginx (Ubuntu default) - PostgreSQL (Ubuntu default) - Redmine database will be installed in PostgreSQL - Self Signed SSL Certificat I try to make the script asking all the question at the beginning of the installation process just after launch it, but there is a confirmation asked during execution where you have to choose which language to use for the Redmine default values. Just hit enter you will get English Redmine default values. At the end of the execution, you should access your sever like this : http://IPADSRESS/ # web2py Welcome should appear http://IPADSRESS/redmine # Redmine! Please report issue, submit improvement or post any comment here, and I will be glad to improve the script. Happy new year to all! Richard -- #!/bin/bash # -- # Description : Installation and basic configuration of web2py, uWSGI, Redmine, # Unicorn, Nginx and PostgreSQL. # Usage : Copy the script in /home/username and run it as root, you may # need to allow exectuion (chmod +x). Ex.: # sudo ./setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh #File : setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh # Author : Richard V?zina # Email : ml.richard.vez...@gmail.com # Copyright : Richard V?zina #Date : ven 28 d?c 2012 13:27:11 EST # Disclaimers : This script is provided as is, without warranty of any kind. # Licence : CC BY-NC 2.5 CA # -- echo 'setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh' echo 'Requires Ubuntu = 12.04 (May works with 12.10 not tested) and installs Redmine + Unicorn + Web2py + uWSGI + Nginx + PostgreSQL' # Check if user has root privileges if [[ $EUID -ne 0 ]]; then echo You must run the script as root or using sudo exit 1 fi # -- # We concentrate here user prompts!! # Get Redmine Postgres Database Password echo -e Redmine Postgres Database Password: \c read REDMINEPASSWORD # Get Web2py Admin Password echo -e Web2py Admin Password: \c read PW cd ~ openssl genrsa 1024 self_signed.key chmod 400 self_signed.key openssl req -new -x509 -nodes -sha1 -days 1780 -key self_signed.key self_signed.cert openssl x509 -noout -fingerprint -text self_signed.cert self_signed.info # -- apt-get update apt-get -y upgrade apt-get autoremove apt-get autoclean apt-get -y install postgresql apt-get -y install nginx-full apt-get -y install build-essential python-dev libxml2-dev python-pip unzip apt-get -y install ruby1.9.3 # Ref.: http://askubuntu.com/questions/137485/rails-3-not-using-rvm apt-get -y install libpq-dev # Required for gem1.9.3 install pg Ref.: http://stackoverflow.com/questions/6040583/unable-to-install-pg-gem-on-ubuntu-cant-find-the-libpq-fe-h-header gem1.9.3 install rails --no-rdoc --no-ri # For testing (faster) --no-rdoc --no-ri gem1.9.3 install unicorn --no-rdoc --no-ri # For testing (faster) --no-rdoc --no-ri gem1.9.3 install pg --no-rdoc --no-ri # For testing (faster) --no-rdoc --no-ri cd /opt wget http://rubyforge.org/frs/download.php/76627/redmine-2.2.0.tar.gz wget http://rubyforge.org/frs/download.php/76628/redmine-2.2.0.tar.gz.md5 md5sum --check redmine-2.2.0.tar.gz.md5 redmine_md5_checked_successfully if [ -f redmine_md5_checked_successfully ] then tar xvfz redmine-2.2.0.tar.gz rm redmine_md5_checked_successfully else echo Redmine md5 check sum failed... exit 1 fi cd redmine-2.2.0 bundle install --without development test rmagick sqlite mysql mkdir /var/www ln -s /opt/redmine-2.2.0/public /var/www/redmine chown -R www-data.www-data /var/www chown -R www-data.www-data /opt/redmine-2.2.0/public # To avoid prompt during execution of the script use psql instead of createuser #echo Enter a postgres redmine user password twice: #createuser -P -S -D -R -l -e redmine # createuser switch: -P --pwprompt -S --no-superuser -D --no-createdb -R --no-createrole -l
Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh
Hello, I publish a new script that allow deployment of Redmine beside web2py. Here : https://groups.google.com/forum/?fromgroups=#!searchin/web2py/redmine/web2py/ZqL7Si8Khbo/Es-wK1yXdgQJ Notice : After some read, I choose Unicorn over Phussion Passenger. Richard On Thu, Dec 20, 2012 at 9:57 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: please email me the patch of latest file when ready for inclusion. On Thursday, 20 December 2012 03:18:20 UTC-6, Niphlod wrote: perfect, Ccing Massimo on this final one. Il giorno giovedì 20 dicembre 2012 00:16:25 UTC+1, Paolo ha scritto: Hi I was trying with the script that comes with the stable web2py. with the one on dropbox I problem has gone. Paolo 2012/12/19 Niphlod nip...@gmail.com @Simone, an other improvement to the script could be to combine into a single server the 80, and 443 to avoid duplicating configuration, as stated here : http://nginx.org/en/docs/http/configuring_https_servers.**html** #single_http_https_serverhttp://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server I don't had test this. Also, here the code for permanent redirection server { server_name $hostname; listen 80; return 301 http*s*://$hostname$request_uri; # NOTE: I am not sure for $hostname here, because I didn't set hostname for my VM until now, as in the example (URL below) we can use domainName.com instead if properly configure in nginx ... } People may want separate configs for http and https. The script objective is to have a working copy of web2py. If we start to follow such requests, we'd end up installing postgresql and redis too :P @Paolo: try the script found at the dropbox link. If the same error happens I think we need the log of pip and a hand by Roberto on the specific error... -- -- Paolo -- --
Re: [web2py] Can the parametric router 301 redirect from www?
I'm using my host's shared nginx instance to serve web2py through uwsgi to save RAM and keep responsiveness up. I can't really do any server-side configuration that isn't through uwsgi or web2py without building my own nginx instance unfortunately. I really like the simplicity of the parametric router so I was hoping it would be possible there. Maybe it's something that could be added to the newer router at some point. On Friday, December 28, 2012 7:39:36 AM UTC-8, Jonathan Lundell wrote: On 27 Dec 2012, at 10:31 PM, HittingSmoke hittin...@gmail.comjavascript: wrote: Pretty straight forward question. Can I use the parametric routes.py language to 301 redirect from www.domain.com to domain.com for proper search engine crawling? You'd be better off configuring your server to do that. If you want to use web2py routes, I think you need the pattern-matching router. --
Re: [web2py] setup-web2py-ubuntu.sh and Python 2.7
root@N4050:~# which python /usr/bin/python root@N4050:~# root@N4050:~# file /usr/bin/python /usr/bin/python: symbolic link to `python2.7' root@N4050:~# ls /usr/bin/python /usr/bin/python root@N4050:~# ls -al /usr/bin/python lrwxrwxrwx 1 root root 9 Oct 10 20:51 /usr/bin/python - python2.7 root@N4050:~# which python2.7 /usr/bin/python2.7 looks better with colors :) but I hope you get the point that there is a default python for the operating system that you can change simple by creating a symbolic link using /usr/bin/python example: rm /usr/bin/python # its just a simple link ln /usr/bin/python2.7 /usr/bin/python this should do it On Fri, Dec 28, 2012 at 4:18 PM, Martin Weissenboeck mweis...@gmail.comwrote: I want to make a new Python installtion on a Debian computer. I have installed Python 2.7.3, because there are some new language constructs I want to use. Afterwards I have made a new installation of web2py using the script setup-web2py-ubuntu.sh. Works fine, but it uses Python 2.6 What changes should I make? Regards, Martin -- --
Re: [web2py] Can the parametric router 301 redirect from www?
On 28 Dec 2012, at 12:56 PM, HittingSmoke hittingsm...@gmail.com wrote: I'm using my host's shared nginx instance to serve web2py through uwsgi to save RAM and keep responsiveness up. I can't really do any server-side configuration that isn't through uwsgi or web2py without building my own nginx instance unfortunately. I really like the simplicity of the parametric router so I was hoping it would be possible there. Maybe it's something that could be added to the newer router at some point. Here's something you can do without any routing at all: first thing in your model, check the hostname for www, and call redirect() with an edited (to remove the www.) of the incoming URL. It's not as efficient as doing it in the server itself, it's not much overhead, and for a 301 it isn't all that critical anyway. On Friday, December 28, 2012 7:39:36 AM UTC-8, Jonathan Lundell wrote: On 27 Dec 2012, at 10:31 PM, HittingSmoke hittin...@gmail.com wrote: Pretty straight forward question. Can I use the parametric routes.py language to 301 redirect from www.domain.com to domain.com for proper search engine crawling? You'd be better off configuring your server to do that. If you want to use web2py routes, I think you need the pattern-matching router. --
[web2py] Can web2py be used for highly complex relational databases?
Can web2py be used for highly complex relational databases for large fiscal projects? Example: California's Fi$cal project - http://www.fiscal.ca.gov/http://www.linkedin.com/redirect?url=http%3A%2F%2Fwww%2Efiscal%2Eca%2Egov%2Furlhash=DBJm_t=tracking_anet - with roughly 10,000 tables and many complex joins. What components of web2py would start to get slow or not work well when having so many tables? If web2py would instead be better used to prototype the Fi$cal system, what would be good production-version candidates to migrate to? Pure Python using sqlAlchemy? Java? Anything that would make migration easier such as Python-based frameworks? Thanks, Alex Glaros --
[web2py] Requirement for Oracle R12 General Ledger / Cost Management Functional Consultan
Requirement for Oracle R12 General Ledger / Cost Management Functional Consultant Position: General Ledger / Cost Management Resource Work Location: Keene, NH Duration: 9 months Strong Oracle R12 General Ledger / Cost Management Functional Consultant • Knowledge of Inventory Costing / Strong Inventory Transaction Background a Plus • Knowledge of Sub Ledger Accounting • Strong Understanding of Various Cost Methods, Especially FIFO • Additional Skills: Design, conceptualize, lead solution workshops, conduct CRP sessions, manage stakeholders • Good understanding of Oracles capabilities and implications to external systems • Must be able to lead workshops and teams • Must have knowledge and experience with requirements definition, process design, application design and configuration and testing of GL / Cost Mgmt / Inventory Costing and sub ledger accounting (SLA) • Knowledge / Experience in the Food Industry a Plus CONTACT : manish@gmail.com Thanks and REGARDS HMG America --
[web2py] Intro and my Web2py app
Hello, I'm new to Web2py having used it for a few assignments and final project in our web frameworks class. Here's my app that I'm hoping to take a little further as I get a better handle on Web2py and Python. It's not deployed on any domain, so just posting the source: https://github.com/ilyabe/BillSplitter The basic idea is to give roommates an easy option to split bills, i.e. the main/responsible (admin) roommate pays, uploads the bills to the app, and roommates sign up to auto-pay their portions. Just wanted to introduce myself and say hello! Thanks, Ilya --
[web2py] Re: upload from Edit page
Hi Massimo, I am using upload attachments. I have Create and Edit pages with number of fields. Upload is one of the fields. Now in create page, it was pretty straight forward using, Upload field in model. Table name is service_attachments Field('attachment','upload',uploadfolder=os.path.join(request.folder, 'attachments')) (Model) if form.vars.attachment: form.vars.attachment_name = request.vars.attachment.filename id = thisdb.service_attachments.insert(**thisdb.service_attachments._filter_fields(form.vars)) .(Controller) And this works great.It inserts the record into the table and also saves the attachment into the folder as - service_attachments.attachment.b19d4ef38978e8e6.746d707437756c626f.jpg Now for edit functionality page, I want users to be able to add more images. Just calling the form.custom.widget.attachment again is not serving the purpose. So I tried doing, manual upload for this particular page. Eg, input class=upload id=service_attachments_attachment name=attachment type=file / (view) I recreated this HTML statement with taking reference of what the Create upload field creates in HTML.. In Controller, if request.vars.attachment != '': form.vars.attachment = request.vars.attachment.file filename = request.vars.attachment.filename form.vars.attachment_name = filename id = thisdb.service_attachments.insert(**thisdb.service_attachments._filter_fields(form.vars)) Just Assigning this manual field to the already existing upload field. This saves the file, the same way as upload field does. It does save the file in the folder specified and also inserts the record in the service_attachments table.But, it saves the extension of that field as .txt, regardless of what the file type is. It saves the file as .txt in the folder and the db record. Let me now if this is giving you the clear picture. Arti On Thursday, December 20, 2012 7:10:47 AM UTC-8, Massimo Di Pierro wrote: Can you explain what you are trying to accomplish and what your models are? I do not understand from the code. On Tuesday, 18 December 2012 13:51:12 UTC-6, ArNew wrote: Hi Everyone, I need help urgently. In my application, I am have included upload fields in Create and edit page. Through create page, it was very straight forward with: td{{=form.custom.widget.attachment}}/td (View) Field('attachment','upload',uploadfolder=os.path.join(request.folder, 'attachments')) (DAL). if form.vars.attachment: form.vars.attachment_name = request.vars.attachment.filename id = thisdb.service_attachments.insert(**thisdb.service_attachments._filter_fields(form.vars)) .(Controller) And this works great. That with Edit page is not the same, as it is not about editing the current image, but uploading more attachments. So I tried doing something like this: input class=upload id=service_attachments_attachment name=attachment type=file / (view) if request.vars.attachment != '': form.vars.attachment = request.vars.attachment.file filename = request.vars.attachment.filename form.vars.attachment_name = filename id = thisdb.service_attachments.insert(**thisdb.service_attachments._filter_fields(form.vars)) This follows the very similar procedure of saving the encrypted version of attachment name in the attachment field, but it changes the extension to .txt for all the attachments. It saves the attachment as service_attachments.attachment.b19d4ef38978e8e6.746d707437756c626f.txt where as the orginal attachment is photo.JPG. So ideall it should save it as service_attachments.attachment.b19d4ef38978e8e6.746d707437756c626f.JPG. Can anyone please help me with this? --
Re: [web2py] Redmine beside web2py with Nginx deployment script
Holy Shit ! This SO AWESOME !! Just the kind of combination I was looking for ! I am so trying this at work next week... 10x a lot! Couple of questions: 1. Can that be used on a vm-based ubuntu, say, on VirtualBox on win7 ? 2. Is it a 64bit flavour of ubuntu? 3. What python version is it using? 2.6/2.7? 32/64 bit? 4. What version/flavor of PostgresSQL is it insalling? 8.x/9.x? 32/64bit? On Friday, December 28, 2012 12:17:12 PM UTC-8, Richard wrote: Hello, This is a new year gift for the one who would use Redmine beside web2py... :) The script is largely base on new Niphold web2py nginx deployment script ( https://groups.google.com/forum/?fromgroups=#!searchin/web2py/nginx$20niphold/web2py/15J3T35_K_w/v_t1099dIf4J ). I spend many hours write it, test it and debug Redmine, so I copyright it and distribute it under CC without commercial use. Executing it in a fresh Ubuntu 12.04 server you will get : - Latest Redmine stable (2.2.0 from http://rubyforge.org), - Rails (3.2.9 from GEM) - Ruby (ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]) (Ubuntu ruby-dev package that should correspond to the latest stable Ruby) - working with Unicorn (latest stable from GEM), - web2py (latest stable) - uWSGI (I think latest stable), start in Emperor mode - Nginx (Ubuntu default) - PostgreSQL (Ubuntu default) - Redmine database will be installed in PostgreSQL - Self Signed SSL Certificat I try to make the script asking all the question at the beginning of the installation process just after launch it, but there is a confirmation asked during execution where you have to choose which language to use for the Redmine default values. Just hit enter you will get English Redmine default values. At the end of the execution, you should access your sever like this : http://IPADSRESS/ # web2py Welcome should appear http://IPADSRESS/redmine # Redmine! Please report issue, submit improvement or post any comment here, and I will be glad to improve the script. Happy new year to all! Richard --
[web2py] Re: Can the parametric router 301 redirect from www?
I ended up setting up a new static app using my host's shared Apache instance. I'm pointing all my www.* domains at it which simply contains a mod_rewrite entry to remove www from URLs. This should be less overhead than configuring it in the model and doesn't use any more of my allotted memory. On Thursday, December 27, 2012 10:31:01 PM UTC-8, HittingSmoke wrote: Pretty straight forward question. Can I use the parametric routes.py language to 301 redirect from www.domain.com to domain.com for proper search engine crawling? --
Re: [web2py] Re: Graph Model (proposal to contribute)
El viernes, 28 de diciembre de 2012 15:34:49 UTC-3, Ramos escribió:D3js I'm looking at the awsome examples of D3.js at http://d3js.org/ The thing is that I can't find anything pre-built to show a relational database scheme as graphviz does. --
[web2py] Re: Upload field with clear text filename
I see. I think the problem is that you have set the writable attribute of the filename field to False. In that case, try setting the default value of that field: if request.vars.upload: db.fileobject.filename.default = request.vars.upload.filename form = SQLFORM(db.fileobject) Anthony On Friday, December 28, 2012 2:28:53 PM UTC-5, Joe Barnhart wrote: Hi Anthony -- I want the opposite of this -- I want the original text filename, not a replacement. The book example I followed did not work. I found at least one problem -- the test if request.vars.upload: does not work. Even though the upload field has a valid filename, the FieldStorage object returns False for the test. In the book the recommended test was if request.vars.upload != None but that was found to have a walkback if the submit button was pressed without choosing a filename, as request.vars.upload returns an empty string in that case. -- Joe On Friday, December 28, 2012 2:18:24 AM UTC-8, Anthony wrote: Are you saying you want the name in the filename field to be encoded into the string stored in the upload field so the file has the name in the filename field upon download? If so, then try: if request.vars.upload and request.vars.filename: request.vars.upload.filename = request.vars.filename form = SQLFORM(db.fileobject) That will re-assign the filename of the uploaded file to the value entered by the user, and web2py will then encode that user-entered filename into the new filename. Another option is to do nothing upon upload and instead replace the original filename with the user-entered filename upon download (which you could do via a custom_retrieve function for the upload field). Note, web2py relies on the filename extension to set the HTTP headers appropriately upon download, so you may want to add some logic to obtain the original filename extension in case the user fails to enter it. Anthony On Friday, December 28, 2012 4:15:52 AM UTC-5, Joe Barnhart wrote: I'm not sure why this is difficult, but I see many posts about this when I search, yet none exactly work for me. This seems like it should be easy but is surprisingly difficult in web2py. I want to keep a table of uploaded files with the uploads in a blob field and the names in clear text in a filename field. Like this model: db.define_table(fileobject, Field(filename,string,length=50,readable=False,writable=False), Field(upload,upload,uploadfield=object_data), Field(object_type,string,length=20,readable=False,writable=False ), Field(object_data,blob), Field(owner,reference auth_user,default=auth.user_id,readable= False,writable=False), Field(saved,datetime,default=datetime.now(),readable=False, writable=False), Field(state,string,length=16,readable=False,writable=False), migrate=settings.migrate) Reading the relevant posts and the online book lead me to believe the way is with a controller like this one: def index(): form=SQLFORM(db.fileobject) if request.vars.upload: form.vars.filename = request.vars.upload.filename if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form=form) And yet this controller does not work. The blob is filled in but the filename is ignored and shows in the table as None. In fact, form.vars is an empty collection and placing form.vars.filename in it does not produce an error, but it is ignored by the form processing. In addition to the filename, I'd like to add the information about the object type etc. at the same point in the process, i.e. after the file has been chosen but before it has been loaded into the database. I've been trying to scan through the code (I'm using 2.3.2 source) to answer my own questions about the upload field but it's just taking too much time. The upload field is one of those parts of web2py that you either love or... uh... don't. To me it seems designed for a very specific use model. If my use model deviates too much then using upload is like pounding square pegs into round holes. I'm tired of pounding. Someone show me how to whittle off the corners of my square peg! (You would think this would be an easy task, yet from the number of posts on this exact topic I know I'm in the company of a large number of others.) --
Re: [web2py] Re: Graph Model (proposal to contribute)
D3js seems Awsome. Its already included in Meteorjs http://www.dashingd3js.com/table-of-contents http://bost.ocks.org/mike/d3/workshop/ 2012/12/28 Alan Etkin spame...@gmail.com El viernes, 28 de diciembre de 2012 15:34:49 UTC-3, Ramos escribió:D3js I'm looking at the awsome examples of D3.js at http://d3js.org/ The thing is that I can't find anything pre-built to show a relational database scheme as graphviz does. -- --
[web2py] Re: Can web2py be used for highly complex relational databases?
My advice would be to start with the database back end you will ultimately use. With 10,000 tables you would have to explore a way to avoid running the model files with every request. There are posts in this forum that explain how to do it. On Friday, December 28, 2012 10:38:25 AM UTC-5, Alex Glaros wrote: Can web2py be used for highly complex relational databases for large fiscal projects? Example: California's Fi$cal project - http://www.fiscal.ca.gov/http://www.linkedin.com/redirect?url=http%3A%2F%2Fwww%2Efiscal%2Eca%2Egov%2Furlhash=DBJm_t=tracking_anet - with roughly 10,000 tables and many complex joins. What components of web2py would start to get slow or not work well when having so many tables? If web2py would instead be better used to prototype the Fi$cal system, what would be good production-version candidates to migrate to? Pure Python using sqlAlchemy? Java? Anything that would make migration easier such as Python-based frameworks? Thanks, Alex Glaros --
Re: [web2py] Re: Unable to set is_active=True when record_versioning is enabled
I agree this is the right way to do it. On Friday, December 28, 2012 2:03:13 AM UTC-5, Massimo Di Pierro wrote: If we allow setting is_active from False to True we would be able to re-cycle the record and there would be a record of the recycling (who deleted it, who restored it, and when). If we clone a deleted record we break references to it and it would be hard to track the consequences of the restoration. Massimo On Friday, 28 December 2012 00:19:54 UTC-6, Mandar Vaze wrote: You should be able to clone a deleted record however. I agree. An ability to clone the deleted record would be great. I assume no such feature exists (correct ? I didn't find any) If you are just using your auditing log like a recycle bin, then please name it as such. Minor nitpick - Current behavior isn't EXACTLY like a recycle bin. Recycle Bin indicates an object has gone FROM one location to recycle bin. But in this case, the older copy of record is copied to archive table and record itself is MODIFIED (is_active=False) In any case, you can count this as a vote for not allowing undeletes by changing the is_active flag. I'm OK with this as well. -Mandar --
[web2py] Re: Can web2py be used for highly complex relational databases?
What is the level of dependency of this application? I bet you can factor this project into dozens of different apps, which communicates with each others through APIs if needed. It's hard to think of an app with 10,000 tables all interdependent. --
Re: [web2py] Redmine beside web2py with Nginx deployment script
My configuration is pretty similar to what you have. Just try it and report here any issue. Richard On Friday, December 28, 2012, Arnon Marcus a.m.mar...@gmail.com wrote: Holy Shit ! This SO AWESOME !! Just the kind of combination I was looking for ! I am so trying this at work next week... 10x a lot! Couple of questions: 1. Can that be used on a vm-based ubuntu, say, on VirtualBox on win7 ? 2. Is it a 64bit flavour of ubuntu? 3. What python version is it using? 2.6/2.7? 32/64 bit? 4. What version/flavor of PostgresSQL is it insalling? 8.x/9.x? 32/64bit? On Friday, December 28, 2012 12:17:12 PM UTC-8, Richard wrote: Hello, This is a new year gift for the one who would use Redmine beside web2py... :) The script is largely base on new Niphold web2py nginx deployment script ( https://groups.google.com/forum/?fromgroups=#!searchin/web2py/nginx$20niphold/web2py/15J3T35_K_w/v_t1099dIf4J ). I spend many hours write it, test it and debug Redmine, so I copyright it and distribute it under CC without commercial use. Executing it in a fresh Ubuntu 12.04 server you will get : - Latest Redmine stable (2.2.0 from http://rubyforge.org), - Rails (3.2.9 from GEM) - Ruby (ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]) (Ubuntu ruby-dev package that should correspond to the latest stable Ruby) - working with Unicorn (latest stable from GEM), - web2py (latest stable) - uWSGI (I think latest stable), start in Emperor mode - Nginx (Ubuntu default) - PostgreSQL (Ubuntu default) - Redmine database will be installed in PostgreSQL - Self Signed SSL Certificat I try to make the script asking all the question at the beginning of the installation process just after launch it, but there is a confirmation asked during execution where you have to choose which language to use for the Redmine default values. Just hit enter you will get English Redmine default values. At the end of the execution, you should access your sever like this : http://IPADSRESS/ # web2py Welcome should appear http://IPADSRESS/redmine # Redmine! Please report issue, submit improvement or post any comment here, and I will be glad to improve the script. Happy new year to all! Richard -- --
[web2py] Re: Can web2py be used for highly complex relational databases?
Right, all files won’t be joined at once; it’s the state’s accounting system. If it were my project, I would probably use Postgres as the database. Thanks, Alex On Friday, December 28, 2012 4:57:24 PM UTC-8, VP wrote: What is the level of dependency of this application? I bet you can factor this project into dozens of different apps, which communicate with each others through APIs if needed. It's hard to think of an app with 10,000 tables all interdependent. --
Re: [web2py] Re: session.flash not working?
I do not think it s a js issue, because there's no js error and after removing the js (my own, not web2py's), the problem is still there. Say I have a controller f def f(): form = if form.processes(onvalidation=...).accepted: session.flash = 'Test' redirect(URL('f', args=form.vars.id)) Session.flash does not work for this particular controller. For other controller, it seems fine. This also is related to what I think another web2py bug. The reason I had to redirect to the same controller after form submission, is because the model has some fields of type list:integer. The problem is that when you have a list of integers with duplicates values, web2py (probably form), does not process that properly; === Web2py essentially messes up everything when you have a list:integers with same values **and** you do not redirect. This is why I had to redirect, but when I redirect to the same update page, session flash does not seem to work (for this particular controller). On Thursday, December 27, 2012 11:39:31 PM UTC-6, Massimo Di Pierro wrote: Please post an example to reproduce the problem. Could it be a js issue? Do you get chrome errors? Is the flash in the page text? On Thursday, 27 December 2012 17:55:46 UTC-6, VP wrote: session.flash does not work properly for me either (latest web2py stable version). when i redirect to the same controller , it works for some controller and doesn't work for other controllers. Have no idea why. --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
Thanks, but that still isn't working for me. Interesting parts of the traceback: type 'exceptions.AttributeError'('Row' object has no attribute 'first_name') web2py\gluon\dal.py in __getitem__ at line 6453 code arguments variables Function argument list (self=Row {'interests': ['chocolate'], 'registration_...1, 'name': '', 'email': 'alectay...@gmail.com'}, key='first_name') Maybe there's some way to change the 'key' there? On Sat, Dec 29, 2012 at 7:03 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: {{=auth.navbar(user_identifier='%(email)s')}} --
[web2py] Server-side AngularJS execution?
Search spiders such as Google—though they now execute AJAX and parse the result—do not work as well with dynamic content as static content. So I was thinking if there was some way to execute the AngularJS as static files; for search-spiders and non-javascript enabled browsers; but when they have JavaScript support execute it client-side. It would also save the trouble of implementing each view twice; once in web2py views the other in AngularJS MVC. Would this be possible? If not, how would you recommend I go about doing this? Thanks for all suggestions, Alec Taylor --
Re: [web2py] Re: Unable to set is_active=True when record_versioning is enabled
OK. I will look into this. Massimo On Friday, 28 December 2012 18:35:10 UTC-6, Cliff Kachinske wrote: I agree this is the right way to do it. On Friday, December 28, 2012 2:03:13 AM UTC-5, Massimo Di Pierro wrote: If we allow setting is_active from False to True we would be able to re-cycle the record and there would be a record of the recycling (who deleted it, who restored it, and when). If we clone a deleted record we break references to it and it would be hard to track the consequences of the restoration. Massimo On Friday, 28 December 2012 00:19:54 UTC-6, Mandar Vaze wrote: You should be able to clone a deleted record however. I agree. An ability to clone the deleted record would be great. I assume no such feature exists (correct ? I didn't find any) If you are just using your auditing log like a recycle bin, then please name it as such. Minor nitpick - Current behavior isn't EXACTLY like a recycle bin. Recycle Bin indicates an object has gone FROM one location to recycle bin. But in this case, the older copy of record is copied to archive table and record itself is MODIFIED (is_active=False) In any case, you can count this as a vote for not allowing undeletes by changing the is_active flag. I'm OK with this as well. -Mandar --
Re: [web2py] Redmine beside web2py with Nginx deployment script
Would you suggest we include it in web2py/scripts/? On Friday, 28 December 2012 14:17:12 UTC-6, Richard wrote: Hello, This is a new year gift for the one who would use Redmine beside web2py... :) The script is largely base on new Niphold web2py nginx deployment script ( https://groups.google.com/forum/?fromgroups=#!searchin/web2py/nginx$20niphold/web2py/15J3T35_K_w/v_t1099dIf4J ). I spend many hours write it, test it and debug Redmine, so I copyright it and distribute it under CC without commercial use. Executing it in a fresh Ubuntu 12.04 server you will get : - Latest Redmine stable (2.2.0 from http://rubyforge.org), - Rails (3.2.9 from GEM) - Ruby (ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]) (Ubuntu ruby-dev package that should correspond to the latest stable Ruby) - working with Unicorn (latest stable from GEM), - web2py (latest stable) - uWSGI (I think latest stable), start in Emperor mode - Nginx (Ubuntu default) - PostgreSQL (Ubuntu default) - Redmine database will be installed in PostgreSQL - Self Signed SSL Certificat I try to make the script asking all the question at the beginning of the installation process just after launch it, but there is a confirmation asked during execution where you have to choose which language to use for the Redmine default values. Just hit enter you will get English Redmine default values. At the end of the execution, you should access your sever like this : http://IPADSRESS/ # web2py Welcome should appear http://IPADSRESS/redmine # Redmine! Please report issue, submit improvement or post any comment here, and I will be glad to improve the script. Happy new year to all! Richard --
[web2py] Re: Intro and my Web2py app
Welcome ..:) On Friday, December 28, 2012 11:11:46 PM UTC+3, Ilya wrote: Hello, I'm new to Web2py having used it for a few assignments and final project in our web frameworks class. Here's my app that I'm hoping to take a little further as I get a better handle on Web2py and Python. It's not deployed on any domain, so just posting the source: https://github.com/ilyabe/BillSplitter The basic idea is to give roommates an easy option to split bills, i.e. the main/responsible (admin) roommate pays, uploads the bills to the app, and roommates sign up to auto-pay their portions. Just wanted to introduce myself and say hello! Thanks, Ilya --
[web2py] RuntimeError: table appears corrupted
I have had an app running for a few months and recently could not connect to (nginx) server. Then after restart got this error: RuntimeError: table appears corrupted If I add migrate=False,fake_migrate=True to DAL then app works. But when remove this error returns. Any idea what is going wrong? --
[web2py] Re: Can web2py be used for highly complex relational databases?
I have some experience with a large peoplesoft system where they claims thousands of tables. Turns out almost everything I needed was in less than 10 tables. Basically most of the tables were lookup tables used simply as key:value store for the possible values of a field. For example table GENDER {'M':'Male','F':'Female','O':'Other'}. So 10 tables with 100 columns each and one lookup table for each column gives you more than 10,000 tables. I suspects that is your case too. All systems that claim an insane amount of tables belong to this category. The way to handle it is to load all lookup tables in cache and use cache instead of database access to convert key-value. In fact the values for lookup tables almost never change. I suggest before you embark in this venture do the following exercise: make a list of all table names. For each table make list of fields in the table and count the number of records (more or less). You will find many tables with less then 100 records and less then 10 columns. You will find a few tables with more than 10 columns and more then 10 records. You need to find out how many tables belong to one category and how many to the other. If this is the case, as I suspect, than you can use web2py but you need to setup some clever caching system to hable the lookup tables. It would be the same with other frameworks since you don't want to join everything all the time or your database will grind to a halt. It is also possible I am completely wrong in my assumption. In the case of the peoplesoft system I studied they also were storing all past versions of each record in the same table as the current record. Basically every record had had two dates (valid_from, valid_until). Current records had valid_until set to 2999-12-31. records would never be modified. The process for modifying a record consisted of creating a copy of the current record, editing the copy, setting the valid_until=now for the previous current record, updating all references pointing to the record. Af course all tables used the same mechanism for versioning thus making the update process very slow and cumbersome, and all tables un-necessary large. Yet this simplifies auditing because you can go back to any moment in time simply by filtering records in a query. The reason I am explaining all of this is that probably you are going to have to deal with something like this. The problem is not web2py vs other framework. The problems will be that you need special logic to handle those tables which is foreign to web2py and many modern frameworks which simply assume more moder database design practices. My suggestion is start small and see what happens. Find who are your primary target users. Find which tables they need to access and create a web interface for those tables. You will probably be able to factorize the interaction with the database in many small apps. Massimo On Friday, 28 December 2012 09:38:25 UTC-6, Alex Glaros wrote: Can web2py be used for highly complex relational databases for large fiscal projects? Example: California's Fi$cal project - http://www.fiscal.ca.gov/http://www.linkedin.com/redirect?url=http%3A%2F%2Fwww%2Efiscal%2Eca%2Egov%2Furlhash=DBJm_t=tracking_anet - with roughly 10,000 tables and many complex joins. What components of web2py would start to get slow or not work well when having so many tables? If web2py would instead be better used to prototype the Fi$cal system, what would be good production-version candidates to migrate to? Pure Python using sqlAlchemy? Java? Anything that would make migration easier such as Python-based frameworks? Thanks, Alex Glaros --
Re: [web2py] Re: session.flash not working?
I am now are of this problem. Can you please post a complete minimalist code example (model, controller, view) so we can try reproduce it? What web2py version are you using? On Friday, 28 December 2012 20:18:17 UTC-6, VP wrote: I do not think it s a js issue, because there's no js error and after removing the js (my own, not web2py's), the problem is still there. Say I have a controller f def f(): form = if form.processes(onvalidation=...).accepted: session.flash = 'Test' redirect(URL('f', args=form.vars.id)) Session.flash does not work for this particular controller. For other controller, it seems fine. This also is related to what I think another web2py bug. The reason I had to redirect to the same controller after form submission, is because the model has some fields of type list:integer. The problem is that when you have a list of integers with duplicates values, web2py (probably form), does not process that properly; === Web2py essentially messes up everything when you have a list:integers with same values **and** you do not redirect. This is why I had to redirect, but when I redirect to the same update page, session flash does not seem to work (for this particular controller). On Thursday, December 27, 2012 11:39:31 PM UTC-6, Massimo Di Pierro wrote: Please post an example to reproduce the problem. Could it be a js issue? Do you get chrome errors? Is the flash in the page text? On Thursday, 27 December 2012 17:55:46 UTC-6, VP wrote: session.flash does not work properly for me either (latest web2py stable version). when i redirect to the same controller , it works for some controller and doesn't work for other controllers. Have no idea why. --
[web2py] Re: `@service.json` works locally but not on Heroku?
Did you enable json generic view? response.generic_patterns=['api.json'] On Friday, 28 December 2012 22:34:03 UTC-6, Alec Taylor wrote: [appname/controllers/api.py] @service.json def v1(): return dict(version=0.5) curl -X GET http://localhost/api/v1.json {version: 0.5} curl -X GET http://appname.herokuapp.com/api/v1.json htmlbodyh1invalid view (api/v1.json)/h1/body/html!-- //-- -- The application itself is identical; to be specific I created a hard link from my heroku app to my local web2py folder. How do I get JSON services working remotely? Thanks for all suggestions, Alec Taylor --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
We can fix this but can't you just leave the first_name and last_name fields alone, as suggested in the book, but make them invisible? readable=False, writable=False. And just change the field used in the navbar as in the example? On Friday, 28 December 2012 21:12:01 UTC-6, Alec Taylor wrote: Thanks, but that still isn't working for me. Interesting parts of the traceback: type 'exceptions.AttributeError'('Row' object has no attribute 'first_name') web2py\gluon\dal.py in __getitem__ at line 6453 code arguments variables Function argument list (self=Row {'interests': ['chocolate'], 'registration_...1, 'name': '', 'email': 'alect...@gmail.com javascript:'}, key='first_name') Maybe there's some way to change the 'key' there? On Sat, Dec 29, 2012 at 7:03 AM, Massimo Di Pierro massimo@gmail.com javascript: wrote: {{=auth.navbar(user_identifier='%(email)s')}} --
[web2py] Re: RuntimeError: table appears corrupted
Try migrate=True, fake_migrate=True than (after it works) migrate=False,fake_migrate=False or (if you plan to change your tables) migrate=Migrate,fake_migrate=False and you should be fine. On Friday, 28 December 2012 22:33:11 UTC-6, Richard Penman wrote: I have had an app running for a few months and recently could not connect to (nginx) server. Then after restart got this error: RuntimeError: table appears corrupted If I add migrate=False,fake_migrate=True to DAL then app works. But when remove this error returns. Any idea what is going wrong? --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
On Sat, Dec 29, 2012 at 3:45 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: We can fix this but can't you just leave the first_name and last_name fields alone, as suggested in the book, but make them invisible? readable=False, writable=False. And just change the field used in the navbar as in the example? That's what I've been doing so far (just 'first_name' was needed). But if at all possible I would like as few fields as possible per table. I also wanted to set the primary key of that table to 'email', but it looks like you have to have the 'id' field no matter what. On Friday, 28 December 2012 21:12:01 UTC-6, Alec Taylor wrote: Thanks, but that still isn't working for me. Interesting parts of the traceback: type 'exceptions.AttributeError'('Row' object has no attribute 'first_name') web2py\gluon\dal.py in __getitem__ at line 6453 code arguments variables Function argument list (self=Row {'interests': ['chocolate'], 'registration_...1, 'name': '', 'email': 'alect...@gmail.com'}, key='first_name') Maybe there's some way to change the 'key' there? On Sat, Dec 29, 2012 at 7:03 AM, Massimo Di Pierro massimo@gmail.com wrote: {{=auth.navbar(user_identifier='%(email)s')}} -- --
[web2py] Conditional {{extend layout.html}}?
Wondering if it is possible to have a conditional {{extend layout.html}} similar to the following? {{if session.call:}} {{extend 'layout_XXX.html'}} {{pass}} {{if not session.call:}} {{extend 'layout.html'}} {{include 'YYY.html'}} {{pass}} Required for users with requiring different configurations. Have tried alternative approaches without success. TIA --
Re: [web2py] Re: RuntimeError: table appears corrupted
migrate=True, fake_migrate=True strangely that produces the same table corrupted error --
Re: [web2py] Re: RuntimeError: table appears corrupted
These work: DAL(uri, migrate=False, fake_migrate=False) DAL(uri, migrate=False, fake_migrate=True) These produce Runtime error: DAL(uri, migrate=True, fake_migrate=False) DAL(uri, migrate=True, fake_migrate=True) --
Re: [web2py] Conditional {{extend layout.html}}?
You can, but will not work if you compile your app. This can be done with. in models/anything.py response.layout_path = layout_XXX.html if session.call else 'layout.html' # this can also be changed in controller if needed def action(): if something: response.layout_path = otherfile.html So in view {{extend response.layout_path}} On Sat, Dec 29, 2012 at 3:15 AM, Simon Ashley gregs...@gmail.com wrote: Wondering if it is possible to have a conditional {{extend layout.html}} similar to the following? {{if session.call:}} {{extend 'layout_XXX.html'}} {{pass}} {{if not session.call:}} {{extend 'layout.html'}} {{include 'YYY.html'}} {{pass}} Required for users with requiring different configurations. Have tried alternative approaches without success. TIA -- --
Re: [web2py] setup-web2py-ubuntu.sh and Python 2.7
Thank you, but it did not solve the problem. Python 2.7.3 is the standard version: ~# python Python 2.7.3 (default, Dec 28 2012, 09:37:13) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. ~# python2.7 Python 2.7.3 (default, Dec 28 2012, 09:37:13) [GCC 4.4.5] on linux2 And in a test application I have: def index(): import sys, sqlite3 return dict(message=Python %s, SQlite %s % (sys.version, sqlite3.sqlite_version)) Python 2.6.6 (r266:84292, Dec 26 2010, 22:48:11) [GCC 4.4.5], SQlite 3.7.3 Any ideas? 2012/12/28 Khalil KHAMLICHI khamlichi.kha...@gmail.com root@N4050:~# which python /usr/bin/python root@N4050:~# root@N4050:~# file /usr/bin/python /usr/bin/python: symbolic link to `python2.7' root@N4050:~# ls /usr/bin/python /usr/bin/python root@N4050:~# ls -al /usr/bin/python lrwxrwxrwx 1 root root 9 Oct 10 20:51 /usr/bin/python - python2.7 root@N4050:~# which python2.7 /usr/bin/python2.7 looks better with colors :) but I hope you get the point that there is a default python for the operating system that you can change simple by creating a symbolic link using /usr/bin/python example: rm /usr/bin/python # its just a simple link ln /usr/bin/python2.7 /usr/bin/python this should do it On Fri, Dec 28, 2012 at 4:18 PM, Martin Weissenboeck mweis...@gmail.comwrote: I want to make a new Python installtion on a Debian computer. I have installed Python 2.7.3, because there are some new language constructs I want to use. Afterwards I have made a new installation of web2py using the script setup-web2py-ubuntu.sh. Works fine, but it uses Python 2.6 What changes should I make? Regards, Martin -- --
Re: [web2py] Re: RuntimeError: table appears corrupted
Can you try delete (backup first) all yourapp/database/*.table then try again. On Friday, 28 December 2012 23:48:51 UTC-6, Richard Penman wrote: These work: DAL(uri, migrate=False, fake_migrate=False) DAL(uri, migrate=False, fake_migrate=True) These produce Runtime error: DAL(uri, migrate=True, fake_migrate=False) DAL(uri, migrate=True, fake_migrate=True) --
Re: [web2py] Conditional {{extend layout.html}}?
Can be done but won't work if you try distribute your app bytecode compiled. On Friday, 28 December 2012 23:50:11 UTC-6, rochacbruno wrote: You can, but will not work if you compile your app. This can be done with. in models/anything.py response.layout_path = layout_XXX.html if session.call else 'layout.html' # this can also be changed in controller if needed def action(): if something: response.layout_path = otherfile.html So in view {{extend response.layout_path}} On Sat, Dec 29, 2012 at 3:15 AM, Simon Ashley greg...@gmail.comjavascript: wrote: Wondering if it is possible to have a conditional {{extend layout.html}} similar to the following? {{if session.call:}} {{extend 'layout_XXX.html'}} {{pass}} {{if not session.call:}} {{extend 'layout.html'}} {{include 'YYY.html'}} {{pass}} Required for users with requiring different configurations. Have tried alternative approaches without success. TIA -- --
Re: [web2py] Re: Auth.wiki() classes in tags
you just attach it to the textarea...: I don't quite follow. Can you expand please, do I add the script code to layout.html, do I need to actually download the plugin as the src points to the website ? This could be worth adding to the book as anyone using render='html' would want to add an editor. Thanks On Sunday, December 16, 2012 8:32:23 AM UTC+13, Massimo Di Pierro wrote: In default MAKRMIN mode you can create blocks with classes with ``hello``:classname (standard markmin class) To switch from markmin to HTML you do: auth.wiki(render='html') (assuming you don't have data already in db) Then if you have a wysiwyg plugin you just attach it to the textarea. For example assuming http://speckedit.com/demo this is done with: script src=http://speckedit.com/_library/2008/10/speck.js;http://speckedit.com/_library/2008/10/speck.js type=text/javascript/scriptlink href= http://speckedit.com/_library/2008/10/speck.css;http://speckedit.com/_library/2008/10/speck.css rel=stylesheet type=text/css /scriptspeckInit();/script That should be all. On Saturday, 15 December 2012 11:26:23 UTC-6, Andrew W wrote: On developers forum, Massimo mentioned: auth.wiki() supports html tags (float divs, tables, image uploading, etc.)? yes. How do I enter a generic tag like a div with a class? Also, Notice that auth.wiki() can use wysiwyg if you simply set it up that way and including an appropriate js editor. How ? --
Re: [web2py] Re: Auth.wiki() classes in tags
P.S. I'm talking about using it with auth.wiki On Saturday, December 29, 2012 8:35:34 PM UTC+13, Andrew W wrote: you just attach it to the textarea...: I don't quite follow. Can you expand please, do I add the script code to layout.html, do I need to actually download the plugin as the src points to the website ? This could be worth adding to the book as anyone using render='html' would want to add an editor. Thanks On Sunday, December 16, 2012 8:32:23 AM UTC+13, Massimo Di Pierro wrote: In default MAKRMIN mode you can create blocks with classes with ``hello``:classname (standard markmin class) To switch from markmin to HTML you do: auth.wiki(render='html') (assuming you don't have data already in db) Then if you have a wysiwyg plugin you just attach it to the textarea. For example assuming http://speckedit.com/demo this is done with: script src=http://speckedit.com/_library/2008/10/speck.js;http://speckedit.com/_library/2008/10/speck.js type=text/javascript/scriptlink href= http://speckedit.com/_library/2008/10/speck.css;http://speckedit.com/_library/2008/10/speck.css rel=stylesheet type=text/css /scriptspeckInit();/script That should be all. On Saturday, 15 December 2012 11:26:23 UTC-6, Andrew W wrote: On developers forum, Massimo mentioned: auth.wiki() supports html tags (float divs, tables, image uploading, etc.)? yes. How do I enter a generic tag like a div with a class? Also, Notice that auth.wiki() can use wysiwyg if you simply set it up that way and including an appropriate js editor. How ? --
Re: [web2py] Re: RuntimeError: table appears corrupted
Thanks - that did it. Any idea what happened and how to prevent this? If helpful I can send the previous and current .table files. On Sat, Dec 29, 2012 at 6:32 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you try delete (backup first) all yourapp/database/*.table then try again. On Friday, 28 December 2012 23:48:51 UTC-6, Richard Penman wrote: These work: DAL(uri, migrate=False, fake_migrate=False) DAL(uri, migrate=False, fake_migrate=True) These produce Runtime error: DAL(uri, migrate=True, fake_migrate=False) DAL(uri, migrate=True, fake_migrate=True) -- --