Re: [web2py] Re: wrapping long text lengths in grid/smartgrid
On 3 October 2011 20:02, Massimo Di Pierro massimo.dipie...@gmail.comwrote: maxtextlengths={'tablename.fieldname':20}, # per field maxtextlength=20, # default It would be nice to have a possibility to wrap text in a column. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: webfaction clean install unable to save any files in admin edit mode
On 5 October 2011 06:48, MidGe degreef.mic...@gmail.com wrote: Ah, ok, I thought this was a different branch and that I had to use a different repo name or branch to pull it. But now, uwsgi, doesn't seem to work again. So I am not sure about introducing another issue prior to fixing the main one.. to have uwsgi working. I also had some strange issues on Webfaction involving uwsgi and one of the possible causes that came to light was that the wrong ownership of some files that prevented admin from functioning properly. The suport people at Webfaction fixed that for me as some of the files had 'root' ownership. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: Why showing a log in option inside of the admin interface
hiya pbreit, Here ( http://i.imgur.com/7LZGP.png) is a screenshot in all its glory and yes, it is a brand new install. Is this normal?
Re: [web2py] Re: webfaction clean install unable to save any files in admin edit mode
Yes Johann, I also believe that there is something happening webfaction side and I think that they are fiddling something. It has happened before in my short experience and I am slightly weary. Your issue is probably different as in this case it was working and then stopped without any interference on my part. Thanks anyway Kind regards Michel
[web2py] Re: setting default values in dropdown and optimal method to select db with variables
Thanks Massimo !! On 5 oct, 00:07, Massimo Di Pierro massimo.dipie...@gmail.com wrote: NOOO. Do not abuse eval. there is no need. Instead you can do: query = db.aa.forcefield == request.vars.forcefield if request.vars.color != 'ALL: query = db.aa.color=request.vars.color if request.vars.weight !='ALL': query = db.aa.weight == request.vars.weigth query_results = db(query).select() It is also a little faster. On Oct 4, 1:09 pm, puercoespin jzaragoza.puercoes...@gmail.com wrote: In my app, i build a query for the 'all' value in a drop down form. For example: query = '(db.aa.forcefield == request.vars.forcefield)' if request.vars.color != 'ALL: query += ' (db.aa.color=request.vars.color) ' if request.vars.weight !='ALL': query += ' (db.aa.weight == request.vars.weigth) ' query_results = db(eval(query)).select() Hope this help... On 2 oct, 18:30, Will smits...@gmail.com wrote: Here is my goal. I have multiple drop down forms populated with the unique values available per field. I want to add a default ALL value to them. I then want to be able to take those values from the form and do a selection based off those variables. I can't seem to be able to select all values per given field oddly using the == query. i have to use the db.field.All selection. I get there by using if statements, if the variable is equal to ALL. I have come up with some workable code but it is very ugly and uses multiple if statements and the manual addition of an 'ALL' value in the sets. I know there has to be a better way. So how do I add default ALL selections to drop downs, and how can I do a multiple db selection using those variables. Here is example code. ##model db.define_table('aa', Field('name'), Field( 'color','string',label ='color'), Field('weight','integer') ) ##controller def searchdbanddisplay(): var1 = request.vars.col var2 = request.vars.weight ra = db(db.aa.color==var1).select() wa = db(db.aa.weight==var2).select() I want to insert one call to db here instead of the top 2 lines to search for both variables, I am presuming using AND and also incorporate the ALL variable if it is selected? return dict(message=T('Hello World'),var1 = var1,var2 = var2,ra=ra,wa=wa) def formtry(): from sets import Set ra = db().select(db.aa.color, distinct=True) SA = Set() for row in ra: SA.add(row.color) ##ra = db().select(db.aa.color, distinct=True) wa = db().select(db.aa.weight, distinct =True) WA = Set() for row in wa: WA.add(row.weight) ##form = SQLFORM.factory(SQLField('color', label='Select a service'), requires=IS_IN_DB(db,'aa.color')) form = SQLFORM.factory( Field('color', requires=IS_IN_SET(SA)), Field('weight',requires=IS_IN_SET(WA)) ) if form.accepts(request.vars, session): response.flash = 'form accepted' redirect(URL('index',vars ={'col' :request.vars.color,'weight' :request.vars.weight})) return dict(form = form,vabla = session.vars)- Ocultar texto de la cita - - Mostrar texto de la cita -
[web2py] Re: how to do db administration of default auth tables?
Hello, The auth tables should be visible from the db administration interface -- not from your models in design view but from the 'db' interface where you can view table contents and insert records directly into tables (in design view, you follow the database administration button just under the models heading and above the list of your model files.) That's indeed where I'm looking. something's wrong with your installation. It was a fresh 1.99.2 web2py src code, which I manually copied it over an old install. But login, registration, etc. work as expected - I just cannot see the auth tables.
[web2py] Re: how to do db administration of default auth tables?
I think he redefine the auth model and now can't see all column in the appadmin?! To be clear: I didn't redefine anything auth related. I just use the default auth provisions.
[web2py] sidebar bug in 1.99.1?
Hi Using left or right sidebars in layout.html doesn't render the page as intended. (Using both sidebars seems ok). layout.html sets the width of #content to 740px, but it should be 720px to handle the padding in #page. I've tried it on OSX, Chrome+FF5 cheers / jonas
[web2py] Re: AutocompleteWidget and unicode issue
Could you try the following plugin?http://dev.s-cubism.com/ plugin_suggest_widget This is an alternative autocomplete widget that I developed, and could handle unicode texts at least Japanese. On 10月4日, 午後10:42, white fox white.fox...@gmail.com wrote: hi, i use AutocompleteWidget for some of my field in db like this: dbMysql.qbp_video.game.widget = SQLFORM.widgets.autocomplete(request, dbMysql.qbp_gameindex.title, limitby=(0,30), min_length=4) everything is ok,till I search a none englis word like تست (this is a persian text) in this case autocomplete dose not work, because of escape function use in javascript, the input text converted to somthing like this %u0645%u06CC%u0631%u0645 a unicode text. to solve this issue i change some code in sqlhtml.py in gluon: in AutocompleteWidget function around the line of 526: def callback(self): if self.keyword in self.request.vars: field = self.fields[0] strSearch = self.request.vars[self.keyword] strSearch = unicode(strSearch.replace('%', '\\'), utf-8) strSearch = strSearch.decode('unicode_escape') rows = self.db(field.like(strSearch + '%'))\ .select(orderby=self.orderby,limitby=self.limitby,*self.fields) so i add strSearch variable and do some stuff to get it work correctly. now i want to know is this the only way to solve this issue? is it correct way or i have security issue by doing this? thanks p.s: sorry for my bad english
[web2py] Re: AutocompleteWidget and unicode issue
Could you try the following plugin? http://dev.s-cubism.com/plugin_suggest_widget This is an alternative autocomplete widget that I developed, and could handle unicode texts at least Japanese. On 10月4日, 午後10:42, white fox white.fox...@gmail.com wrote: hi, i use AutocompleteWidget for some of my field in db like this: dbMysql.qbp_video.game.widget = SQLFORM.widgets.autocomplete(request, dbMysql.qbp_gameindex.title, limitby=(0,30), min_length=4) everything is ok,till I search a none englis word like تست (this is a persian text) in this case autocomplete dose not work, because of escape function use in javascript, the input text converted to somthing like this %u0645%u06CC%u0631%u0645 a unicode text. to solve this issue i change some code in sqlhtml.py in gluon: in AutocompleteWidget function around the line of 526: def callback(self): if self.keyword in self.request.vars: field = self.fields[0] strSearch = self.request.vars[self.keyword] strSearch = unicode(strSearch.replace('%', '\\'), utf-8) strSearch = strSearch.decode('unicode_escape') rows = self.db(field.like(strSearch + '%'))\ .select(orderby=self.orderby,limitby=self.limitby,*self.fields) so i add strSearch variable and do some stuff to get it work correctly. now i want to know is this the only way to solve this issue? is it correct way or i have security issue by doing this? thanks p.s: sorry for my bad english
[web2py] Re: AutocompleteWidget and unicode issue
Could you try the following plugin? http://dev.s-cubism.com/plugin_suggest_widget This is an alternative autocomplete widget that I developed, and could handle unicode texts at least Japanese. On 10月4日, 午後10:42, white fox white.fox...@gmail.com wrote: hi, i use AutocompleteWidget for some of my field in db like this: dbMysql.qbp_video.game.widget = SQLFORM.widgets.autocomplete(request, dbMysql.qbp_gameindex.title, limitby=(0,30), min_length=4) everything is ok,till I search a none englis word like تست (this is a persian text) in this case autocomplete dose not work, because of escape function use in javascript, the input text converted to somthing like this %u0645%u06CC%u0631%u0645 a unicode text. to solve this issue i change some code in sqlhtml.py in gluon: in AutocompleteWidget function around the line of 526: def callback(self): if self.keyword in self.request.vars: field = self.fields[0] strSearch = self.request.vars[self.keyword] strSearch = unicode(strSearch.replace('%', '\\'), utf-8) strSearch = strSearch.decode('unicode_escape') rows = self.db(field.like(strSearch + '%'))\ .select(orderby=self.orderby,limitby=self.limitby,*self.fields) so i add strSearch variable and do some stuff to get it work correctly. now i want to know is this the only way to solve this issue? is it correct way or i have security issue by doing this? thanks p.s: sorry for my bad english
[web2py] Re: Why showing a log in option inside of the admin interface
Looks like it's related to your more general problem with logins not lasting on Webfaction with uwsgi: https://groups.google.com/d/msg/web2py/N3mHxZpSh5A/l1Ck9mW6QfYJ. That part of the admin home page involves an Ajax call to check whether the web2py version is current. Because it thinks you're not logged in, the Ajax call ends up getting redirected to the login page, so the login page gets inserted in the div that's supposed to include the version check. The image in the upper left just looks like a fixed positioning of the logo that's supposed to appear on the login page (i.e., it's floating outside the div). Anthony On Wednesday, October 5, 2011 2:46:40 AM UTC-4, MidGe wrote: hiya pbreit, Here ( http://i.imgur.com/7LZGP.png) is a screenshot in all its glory and yes, it is a brand new install. Is this normal?
Re: [web2py] Re: wrapping long text lengths in grid/smartgrid
I think if you specify a much longer maxtextlength, the text will ultimately wrap, but it may cause the column to be much wider than you want. Maybe all the th's and td's should include column-specific classes so we can use CSS to control the width and other attributes of each column. Anthony On Wednesday, October 5, 2011 2:26:49 AM UTC-4, spyker wrote: On 3 October 2011 20:02, Massimo Di Pierro massimo@gmail.com wrote: maxtextlengths={'tablename.fieldname':20}, # per field maxtextlength=20, # default It would be nice to have a possibility to wrap text in a column. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: Google Checkout Plugin Error
Thanks for your help. Your suggestion allowed me to get rid of the error. If I create an anchor with the source set you the URL, then I can click on it and get to a Google Checkout button, however, creating an image with the source set to the URL doesn't bring up any image. I just get a broken placeholder, and then I have to view the source to see and activate the link. I can make it work for my site as is, I just thought you should know what it is doing. You said it is a really old plugin. Is the plugin just old, or am I just using an old version? I found the link to download it in the Web2py Book, in chapter 12. Anyway, thanks for your help; I was pulling my hair out trying to figure out what the dict error was. On Oct 3, 9:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This is an oldplugin... ouch! Replace this: img src={{=URL(request.application,'plugin_google_checkout','button', dict(next='http://www.google.com'))}} / with this: img src={{=URL('plugin_google_checkout','button', vars=dict(next='http://www.google.com'))}} / On Oct 3, 9:18 pm, zukunftschauer zukunftsha...@gmail.com wrote: Thanks for responding. As I am just trying to test out theplugin, I have created a new application specifically for this. As such, my files reflect only what is shown in theplugin'smodel file. Here are the contents of /var/web2py/applications/ Sample_Google_Checkout/views/default/index.html: {{extend 'layout.html'}} img src={{=URL(request.application,'plugin_google_checkout','button', dict(next='http://www.google.com'))}} / Here are the contents of the controller: def index(): db.plugin_google_checkout_purchase.insert( cart_id = 'Sample_Checkout', # this your cart name item_id = 1234, # this your id for the item name=Sample Item 1, unit_price=135.25, quantity=1) return dict() Thanks again for your response. On Oct 2, 4:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: What's in /var/web2py/applications/Sample_Google_Checkout/views/ default/index.html ? On Oct 2, 1:26 pm, zukunftschauer zukunftsha...@gmail.com wrote: I am trying to evaluate theGoogleCheckoutPlugin, but keep running in the same error. I followed the instructions listed in the Model in theplugin. I am new to web2py, and so far love it, but it you need more information than I have provided, please let me know. I am just not experienced enough to track this down, and have tried searching everywhere for an answer to no avail. I am using the latest web2py (stable) version 1.99.2. Thanks. Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 194, in restricted exec ccode in environment File /var/web2py/applications/Sample_Google_Checkout/views/default/ index.html, line 101, in module File /var/web2py/gluon/html.py, line 221, in URL application = r.application AttributeError: 'dict' object has no attribute 'application' Error snapshot help type 'exceptions.AttributeError'('dict' object has no attribute 'application')
[web2py] Re: Why showing a log in option inside of the admin interface
Ah ah, But then it is very likely everything else odd I am experiencing is related. What next? Why does the admin home page thinks I am not logged in? I would dearly love to fix this and start trying using web2py and see what it really is all about! Being a newbie at web2py I don't quite have the knowledge to do that yet! :)
[web2py] Re: Web2py Lulu docs - Buy now or wait for the next release?
If you use the online book you and have a diigo account you can annotate it. On Oct 4, 11:07 pm, BrendanC bren...@gmail.com wrote: I'm considering building some demo apps in Web2py but I really prefer to work form hard copy docs that I can annotate and tag. I see that the current Lulu docs are almost 1 year old and may not be up to date. The app I have in mind is for a specialty online store with some online ordering - so I don't expect to push the envelop too much here. Any thoughts, TIA, BrendanC
[web2py] Re: how to do db administration of default auth tables?
Did you put this: auth.define_tables() in the controller instead of a model? Something is not executing that line when you visit appadmin. On Oct 4, 10:17 am, stefaan stefaan.hi...@gmail.com wrote: I've ported an old version of my application from T2 to the new crud/ auth/smartgrid...stuff. I'm using the default auth provisions as defined in the scaffolding application: auth.define_tables() Is it possible to inspect the auth tables from the administrative interface ? I only see my custom tables listed, but nothing created by auth. (The sql.log does contain references to auth tables, and registration/ login/logout/profile/password recovery all work as expected). I'm running web2py 1.99.2 from source on win32. Thanks, Stefaan.
[web2py] Re: sidebar bug in 1.99.1?
changed in trunk. On Oct 5, 4:58 am, Jonas Rundberg jo...@rundberg.com wrote: Hi Using left or right sidebars in layout.html doesn't render the page as intended. (Using both sidebars seems ok). layout.html sets the width of #content to 740px, but it should be 720px to handle the padding in #page. I've tried it on OSX, Chrome+FF5 cheers / jonas
[web2py] Re: AutocompleteWidget and unicode issue
Thank for your help. I do not understand this line: strSearch = unicode(strSearch.replace('%', '\\'), utf-8) On Oct 4, 8:42 am, white fox white.fox...@gmail.com wrote: hi, i use AutocompleteWidget for some of my field in db like this: dbMysql.qbp_video.game.widget = SQLFORM.widgets.autocomplete(request, dbMysql.qbp_gameindex.title, limitby=(0,30), min_length=4) everything is ok,till I search a none englis word like تست (this is a persian text) in this case autocomplete dose not work, because of escape function use in javascript, the input text converted to somthing like this %u0645%u06CC%u0631%u0645 a unicode text. to solve this issue i change some code in sqlhtml.py in gluon: in AutocompleteWidget function around the line of 526: def callback(self): if self.keyword in self.request.vars: field = self.fields[0] strSearch = self.request.vars[self.keyword] strSearch = unicode(strSearch.replace('%', '\\'), utf-8) strSearch = strSearch.decode('unicode_escape') rows = self.db(field.like(strSearch + '%'))\ .select(orderby=self.orderby,limitby=self.limitby,*self.fields) so i add strSearch variable and do some stuff to get it work correctly. now i want to know is this the only way to solve this issue? is it correct way or i have security issue by doing this? thanks p.s: sorry for my bad english
[web2py] Re: Google Checkout Plugin Error
It was written long ago. I do not believe there is a newer version but, since you are working on it and testing, we can make a newer one. ;-) On Oct 5, 7:20 am, zukunftschauer zukunftsha...@gmail.com wrote: Thanks for your help. Your suggestion allowed me to get rid of the error. If I create an anchor with the source set you the URL, then I can click on it and get to a Google Checkout button, however, creating an image with the source set to the URL doesn't bring up any image. I just get a broken placeholder, and then I have to view the source to see and activate the link. I can make it work for my site as is, I just thought you should know what it is doing. You said it is a really old plugin. Is the plugin just old, or am I just using an old version? I found the link to download it in the Web2py Book, in chapter 12. Anyway, thanks for your help; I was pulling my hair out trying to figure out what the dict error was. On Oct 3, 9:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This is an oldplugin... ouch! Replace this: img src={{=URL(request.application,'plugin_google_checkout','button', dict(next='http://www.google.com'))}} / with this: img src={{=URL('plugin_google_checkout','button', vars=dict(next='http://www.google.com'))}} / On Oct 3, 9:18 pm, zukunftschauer zukunftsha...@gmail.com wrote: Thanks for responding. As I am just trying to test out theplugin, I have created a new application specifically for this. As such, my files reflect only what is shown in theplugin'smodel file. Here are the contents of /var/web2py/applications/ Sample_Google_Checkout/views/default/index.html: {{extend 'layout.html'}} img src={{=URL(request.application,'plugin_google_checkout','button', dict(next='http://www.google.com'))}} / Here are the contents of the controller: def index(): db.plugin_google_checkout_purchase.insert( cart_id = 'Sample_Checkout', # this your cart name item_id = 1234, # this your id for the item name=Sample Item 1, unit_price=135.25, quantity=1) return dict() Thanks again for your response. On Oct 2, 4:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: What's in /var/web2py/applications/Sample_Google_Checkout/views/ default/index.html ? On Oct 2, 1:26 pm, zukunftschauer zukunftsha...@gmail.com wrote: I am trying to evaluate theGoogleCheckoutPlugin, but keep running in the same error. I followed the instructions listed in the Model in theplugin. I am new to web2py, and so far love it, but it you need more information than I have provided, please let me know. I am just not experienced enough to track this down, and have tried searching everywhere for an answer to no avail. I am using the latest web2py (stable) version 1.99.2. Thanks. Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 194, in restricted exec ccode in environment File /var/web2py/applications/Sample_Google_Checkout/views/default/ index.html, line 101, in module File /var/web2py/gluon/html.py, line 221, in URL application = r.application AttributeError: 'dict' object has no attribute 'application' Error snapshot help type 'exceptions.AttributeError'('dict' object has no attribute 'application')
[web2py] Re: Why showing a log in option inside of the admin interface
First time I see this. Looks like it logs you in and then when it does the ajax call it thinks you are not logged in. What browser? Does it work fine locally or is the problem only with webfaction? On Oct 5, 7:36 am, MidGe degreef.mic...@gmail.com wrote: Ah ah, But then it is very likely everything else odd I am experiencing is related. What next? Why does the admin home page thinks I am not logged in? I would dearly love to fix this and start trying using web2py and see what it really is all about! Being a newbie at web2py I don't quite have the knowledge to do that yet! :)
[web2py] SQLFORM.factory does not create the table in db, so how to query results?
form = SQLFORM.factory(*myFieldlist, table_name='OSSListFormTable', submit_button='Submit Query', formname='QueryForm', _method = 'POST') Problem: 'OSSListFormTable' is not registered as a table in the db, so myset = db(myquery) crashes Is this a bug in web2py? OR should 'OSSListFormTable' be created by the application first? If not, how to get the results from the form when the form was created by SQLFORM.factory I am trying find out which radio button was clicked in the SQLFORM.factory form. Please advise. Thanks.
[web2py] Re: Web2py Lulu docs - Buy now or wait for the next release?
I've bought version 3.0 and it's almost complete. but version 3.1 has many new stuff. I recommend you wait to next version.
Re: [web2py] spinejs with Web2py
that's what I thought too a Seb. alas, although my web2py controller function is called I can find no data from the Javascript (in request/vars or request/get_vars). I can return numbers (integers or numbers) but lists and dicts are not parsed and FF FireBug Net/XHR displays Failed to load source for: http://127.0.0.1:8000/init/default/get_buses Very frustrating. I can't find anyone who's using web2py with either spine or backbone (backbone inspired spine).
[web2py] Re: criticism of web2py
i bet they event didn't create a simple site with Web2py. Don't trust them. Just for test, use Django for a week and you'll be back to Web2py soon than we expected and with headaches!! Every day, I am creating a new website for my clients. When I was using Django, just initial setup took me hours. I am not saying other frameworks are not smart. Web2Py is just better.
[web2py] Form output format
I have simply form and it work, but in HTML source code it is one line, how i can get form i more lines i HTML source code. Source code for my form in one line: form action= enctype=multipart/form-data method=posttabletr id=poruke_poruka__rowtd class=w2p_fllabel for=poruke_poruka id=poruke_poruka__labelPoruka: /label/tdtd class=w2p_fwinput class=string id=poruke_poruka name=poruka type=text value= //tdtd class=w2p_fc/td/trtr id=poruke_post_author__rowtd class=w2p_fllabel for=poruke_post_author id=poruke_post_author__labelPost Author: / label/tdtd class=w2p_fwinput class=string id=poruke_post_author name=post_author type=text value= // tdtd class=w2p_fc/td/trtr id=submit_record__rowtd class=w2p_fl/tdtd class=w2p_fwinput type=submit value=Submit //tdtd class=w2p_fc/td/tr/tablediv class=hiddeninput name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d /input name=_formname type=hidden value=poruke/create //div/form And I need to get: form action= enctype=multipart/form-data method=post table tr id=poruke_poruka__row td class=w2p_fl label for=poruke_poruka id=poruke_poruka__label Poruka: /label /td td class=w2p_fw input class=string id=poruke_poruka name=poruka type=text value= / /td td class=w2p_fc /td /tr tr id=poruke_post_author__row td class=w2p_fl label for=poruke_post_author id=poruke_post_author__label Post Author: /label /td td class=w2p_fw input class=string id=poruke_post_author name=post_author type=text value= / /td td class=w2p_fc /td /tr tr id=submit_record__row td class=w2p_fl /td td class=w2p_fw input type=submit value=Submit / /td td class=w2p_fc /td /tr /table div class=hidden input name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d / input name=_formname type=hidden value=poruke/create / /div /form
[web2py] Re: Encryption/Decryption Modules
I am using Mcrypt with subprocess. Encryption is CPU hungry, so I prefer to use external program. you don't need to install Mcrypt on your server, just compile Mcrypt and put it is somewhere like application.folder/bin and execute it.
[web2py] Re: Dealing with UTC and converting to local time
Thank you Massimo, You solution is very good. I am using a javascript code that detects timezone and other things, but i should change it to your way for sure. Although this script does the job for me but it's more complicated. detect_timezone.js Description: JavaScript source
[web2py] Re: criticism of web2py
On Wed, 5 Oct 2011 07:07:37 -0700 (PDT) Farsheed Ashouri farsheed.asho...@gmail.com wrote: Just for test, use Django for a week and you'll be back to Web2py soon than we expected and with headaches!! I tried it and now I'm here. Every day, I am creating a new website for my clients. I just wonder if your client(s) want CMS, blog, forms...what do you use? Is one supposed to build everything from scratch or I'm simply not aware-enough of components ready to be used for CMS, building forms, blog... Sincerely, Gour -- “In the material world, conceptions of good and bad are all mental speculations…” (Sri Caitanya Mahaprabhu) http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] Re: Subdomain based on blog users in routes.py
ya, It works, but it's not was i expected. for example my own blog * rodmena.ourway.ir* http://rodmena.ourway.ir now redirects to it's correct path, but i wanted to stay at sub domain level while surfing. my code is simple: # Blogs subdomain redirection === host_parts = request.env.http_host.split('.') if len(host_parts) == 3: subdomain = host_parts[0] main_domain = '%s.%s' % (host_parts[1], host_parts[2]) red_link= '%s://%s/pages/blog?u=%s' % (request.env.wsgi_url_scheme, main_domain, subdomain) redirect(red_link) # Btw, thx all for their answer, but i still need to solve it in routes.
[web2py] Re: Form output format
If you're using the FORM or SQLFORM helper (or Crud), I don't think there's any way to control the way it is serialized in the response body. Why do you need that format? Anthony On Wednesday, October 5, 2011 10:06:25 AM UTC-4, miroslavgojic wrote: I have simply form and it work, but in HTML source code it is one line, how i can get form i more lines i HTML source code. Source code for my form in one line: form action= enctype=multipart/form-data method=posttabletr id=poruke_poruka__rowtd class=w2p_fllabel for=poruke_poruka id=poruke_poruka__labelPoruka: /label/tdtd class=w2p_fwinput class=string id=poruke_poruka name=poruka type=text value= //tdtd class=w2p_fc/td/trtr id=poruke_post_author__rowtd class=w2p_fllabel for=poruke_post_author id=poruke_post_author__labelPost Author: / label/tdtd class=w2p_fwinput class=string id=poruke_post_author name=post_author type=text value= // tdtd class=w2p_fc/td/trtr id=submit_record__rowtd class=w2p_fl/tdtd class=w2p_fwinput type=submit value=Submit //tdtd class=w2p_fc/td/tr/tablediv class=hiddeninput name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d /input name=_formname type=hidden value=poruke/create //div/form And I need to get: form action= enctype=multipart/form-data method=post table tr id=poruke_poruka__row td class=w2p_fl label for=poruke_poruka id=poruke_poruka__label Poruka: /label /td td class=w2p_fw input class=string id=poruke_poruka name=poruka type=text value= / /td td class=w2p_fc /td /tr tr id=poruke_post_author__row td class=w2p_fl label for=poruke_post_author id=poruke_post_author__label Post Author: /label /td td class=w2p_fw input class=string id=poruke_post_author name=post_author type=text value= / /td td class=w2p_fc /td /tr tr id=submit_record__row td class=w2p_fl /td td class=w2p_fw input type=submit value=Submit / /td td class=w2p_fc /td /tr /table div class=hidden input name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d / input name=_formname type=hidden value=poruke/create / /div /form
[web2py] Re: Why showing a log in option inside of the admin interface
On Wednesday, October 5, 2011 9:43:01 AM UTC-4, Massimo Di Pierro wrote: First time I see this. Looks like it logs you in and then when it does the ajax call it thinks you are not logged in. What browser? Does it work fine locally or is the problem only with webfaction? He has the problem with all logins, not just admin, and it seems specific to uwsgi on Webfaction (mentioned apache was OK): https://groups.google.com/d/msg/web2py/N3mHxZpSh5A/l1Ck9mW6QfYJ
Re: [web2py] Subdomain based on blog users in routes.py
On Oct 5, 2011, at 7:36 AM, Farsheed Ashouri wrote: ya, It works, but it's not was i expected. for example my own blog rodmena.ourway.ir now redirects to it's correct path, but i wanted to stay at sub domain level while surfing. my code is simple: # Blogs subdomain redirection === host_parts = request.env.http_host.split('.') if len(host_parts) == 3: subdomain = host_parts[0] main_domain = '%s.%s' % (host_parts[1], host_parts[2]) red_link= '%s://%s/pages/blog?u=%s' % (request.env.wsgi_url_scheme, main_domain, subdomain) redirect(red_link) # Btw, thx all for their answer, but i still need to solve it in routes. Try putting this in db.py (or your first model file, whatever it is). (This is strictly experimental, and I'm assuming that you have all your model files in the top level of the model directors.) host_parts = request.env.http_host.split('.') if len(host_parts) == 3: request.vars['u'] = host_parts[0] # subdomain request.controller = 'pages' request.function = 'blog' response.view = '%s/%s.%s' % (request.controller, request.function, request.extension)
Re: [web2py] Subdomain based on blog users in routes.py
Well it worked!! but with many problems in Ajax loading! Thank you, but any improvements??
Re: [web2py] Subdomain based on blog users in routes.py
On Oct 5, 2011, at 8:03 AM, Farsheed Ashouri wrote: Well it worked!! but with many problems in Ajax loading! Thank you, but any improvements?? You might want to look at request.controller (and .function and .extension) to detect Ajax requests and do something else with them (depending on what the Ajax problems are). Otherwise all your Ajax requests coming from the subdomain will be sent to pages/blog, which is probably wrong.
Re: [web2py] Subdomain based on blog users in routes.py
ya, I am trying to solve it. Let's see what'll come up with this night! :)) Thank you Jonathan! On Wed, Oct 5, 2011 at 6:38 PM, Jonathan Lundell jlund...@pobox.com wrote: On Oct 5, 2011, at 8:03 AM, Farsheed Ashouri wrote: Well it worked!! but with many problems in Ajax loading! Thank you, but any improvements?? You might want to look at request.controller (and .function and .extension) to detect Ajax requests and do something else with them (depending on what the Ajax problems are). Otherwise all your Ajax requests coming from the subdomain will be sent to pages/blog, which is probably wrong. -- Sincerely, Farsheed Ashouri, ourway.ir Tel: +98 9388801504
[web2py] Re: SQLFORM.factory does not create the table in db, so how to query results?
When the form is submitted, each field value is returned as a variable of the response object. So if you give a name to your radio button (foo) then all you have to do is access response.vars.foo to get the value. (I'm assuming that myFieldlist is a collection of field definitions in which you define and name the radio button field)
[web2py] Would there be an advantage to having more discussion on Stackoverflow?
I've been using web2py for about six weeks now and am loving the supportive community. I notice that there's a strong push to focus that community discussion here on the Google group. I wonder if this has some disadvantages, though: a) It seems difficult sometimes to find previous discussions of the same issue. So I suspect people are answering the same question more than they need to sometimes. Here it seems like Stackoverflow helps to streamline the support process. b) The focus on the Google group means that the web2py name isn't popping up as often in mixed forums like Stackoverflow. I think that creates the impression that web2py has fewer users than it really does. So would there be some value in encouraging people to direct specific support questions to Stackoverflow and reserving the Google group for things like announcements, open-ended discussion, threads about resources and hosting, etc? Ian
[web2py] Getting form via ajax/json returns JSON serialization error
When I try to access my action via myapp/statusbar/userEdit I see the form as expected. However, when I try it at myapp/statusbar/ userEdit.json I get a JSON serialization error. This is my controller: def user_widget(): # return table of all users incl. their roles output = T('No users found') rows = db().select(db.auth_user.id, db.auth_user.username, db.auth_membership.id, db.auth_membership.group_id, left=db.auth_membership.on(db.auth_membership.user_id==db.auth_user.id)) if len(rows) 0: table_rows = [] for row in rows: table_rows.append([row.auth_user.username, row.auth_membership.id, row.auth_membership.group_id, A(T('edit'), _href='#', _id='edit-user-' + str(row.auth_user.id), _class='edit- user')]) output = TABLE(THEAD(TR(TH(T('Username')), TH(T('Membership ID')), TH(T('Group ID')), TH(T('Edit', *[TR(*myrows) for myrows in table_rows], _id='user-widget-users-table') script = SCRIPT('$(function() { \ $(#user-widget-users-table a.edit- user).click(function() { \ jQuery.ajax({ \ type: POST, \ url: '+ URL(r=request,c='statusbar',f='userEdit') +', \ data: id= + $(this).attr(id), \ success: function(msg){ \ $(#settings- content).html(msg.html); \ $(#settings- title).html(msg.title); \ } \ }); \ }); \ });', _language='javascript') output.append(script) return {'html':str(output), 'title':T('User settings')} def userEdit(): # simplified - should return edit form a specific user later form=SQLFORM.factory(db.auth_user,db.auth_membership) return {'html':form, 'title':'test'} The form contains two textfields and two selection fields and a submit button. My statusbar/userEdit.json view ist the default one. Any suggestions?
[web2py] Re: Why showing a log in option inside of the admin interface
This is exactly the same problem I'm having with one project hosted on Fluxflex. Oddly, the same application code treats logins fine in one fluxflex project, while logins don't persist on another one. I don't know enough about the fluxflex server architecture to know how this would work (And they're not returning my support emails.)
[web2py] Re: Dealing with UTC and converting to local time
Thank you kindly Massimo. I am storing the data in OrientDB so will be unable to test the time shift field representation b it looks so clean and simple. However I think I can store everything as UTC with your first tip and use JS to detect the user's timezone and convert the UTC to local in JS returned in a view. Is that correct? -David On Oct 4, 11:36 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: request.now = request.utcnow on top of db.py will make sure internally you have request.utcnow everwhere. Then you can set shift=datetime.timedelta() db.table.field.represent = lambda d,r,s=shift: prettydate(d+s) for all tables and fields where shift is the localtion-uct time shift. To compute it you need to know where the visitor it. On Oct 4, 6:39 pm, TheSweetlink yanosh...@gmail.com wrote: I want to insert all posts in UTC and convert to local time with prettydates. Either the gluon.tools prettydate() or a JS script I got a hold of convert the time properly. How could I insert a record that is UTC timestamped in the db but converted to local timezone when retrieving and viewing the record? Thanks in advance. -David
[web2py] Re: Getting form via ajax/json returns JSON serialization error
The str() function helped: return {'html':str(form), 'title':'test'}
[web2py] Re: Dealing with UTC and converting to local time
Thank you too Farsheed. Didn't mean to leave you out there :) -David On Oct 5, 10:20 am, Farsheed Ashouri farsheed.asho...@gmail.com wrote: Thank you Massimo, You solution is very good. I am using a javascript code that detects timezone and other things, but i should change it to your way for sure. Although this script does the job for me but it's more complicated. detect_timezone.js 13KViewDownload
[web2py] Re: Web2py Lulu docs - Buy now or wait for the next release?
book 4th ed will be ~100 extra pages compared with 3rd ed. On Oct 5, 8:57 am, Farsheed Ashouri farsheed.asho...@gmail.com wrote: I've bought version 3.0 and it's almost complete. but version 3.1 has many new stuff. I recommend you wait to next version.
[web2py] Re: criticism of web2py
The people who criticize web2py the most have financial interest in a competing framework. Usually Django. They sell consulting services. You don't expect Microsoft developers to like Apple, do you? Or perhaps you do but they would be saying it in public. Massimo On Oct 5, 9:07 am, Farsheed Ashouri farsheed.asho...@gmail.com wrote: i bet they event didn't create a simple site with Web2py. Don't trust them. Just for test, use Django for a week and you'll be back to Web2py soon than we expected and with headaches!! Every day, I am creating a new website for my clients. When I was using Django, just initial setup took me hours. I am not saying other frameworks are not smart. Web2Py is just better.
[web2py] Installing under Linux
I have a problem getting web2py working in Ubuntu Linux (Lucid Lynx). Let me explain the situation... I am experimenting with a VirtualBox VM of Ubuntu. I follow the instructions in the Official web2py Book (sections: Apache setup and mod_wsgi). The VM has an address of 192.168.1.102. As per instruction, I created the /etc/apache2/sites-available/web2py Apache configuration file. Now, the book says, When you restart Apache, it should pass all the requests to web2py without going through the Rocket wsgiserver. I also followed the instructions in the section, Start as Linux Daemon. (I couldn't figure out how to start web2py as a background process, so my console was locked up when I type 'python web2py.py'.) Okay, so I've restarted Apache2. Presumably, if I enter: 192.168.1.102/welcome/default/index into the browser, it should take me to the Welcome app? Or am I being obtuse? I also tried: 192.168.1.102:8000/welcome/default/index but still cannot connect. What puzzles me is that httpd.conf in the original Apache2 installation remains unchanged (it's empty). How does Apache know to use the configuration file in sites-available? Perhaps someone can clarify this for me, please. Thanks, Richard
Re: [web2py] Re: Announcing another web2py-gae application
Thank you for trying out. I've noted down all of your suggestions. Will implement in the days to come. I am not planning to open source the app though I will post my experience in developing with code. Thanks again, Joseph On 10/4/11, guruyaya guruy...@gmail.com wrote: Nice. The list does not give you the name of it's creator You should enable editing Allow other users to suggest more options Instead of 3 lines, and a plus, create one, and onfocus, automaticly create another line. This will create a better flow. Are you planning to open source this app? On Oct 3, 3:10 am, Joseph Jude ceph...@gmail.com wrote: Thanks to forum members (Anthony Cliff), I was able to develop an application which I hope to serve as a repository of checklists. It is hosted athttp://123-check.appspot.com/. This is just a first version and I'm still learning. Your comments / suggestions are appreciated. Joseph Judehttp://www.jjude.com -- Joseph ceph...@jjude.com | +919899150573
[web2py] Re: Installing under Linux
Did you check web2py/scripts/setup-web2py-ubuntu.sh? It might be very helpful and will do the job for you automatically!
[web2py] Re: criticism of web2py
just wonder if your client(s) want CMS, blog, forms...what do you use? Yes, most of them want, and once you create your standard core, you can reuse those controllers and models or views simply in other projects!
Re: [web2py] Re: criticism of web2py
BOSSIE Award already Prove Them Wrong. Its one of the biggest if not Biggest award in opensource wrold. Way to go Massimo and web2pygroup! On 10/5/11, Massimo Di Pierro massimo.dipie...@gmail.com wrote: The people who criticize web2py the most have financial interest in a competing framework. Usually Django. They sell consulting services. You don't expect Microsoft developers to like Apple, do you? Or perhaps you do but they would be saying it in public. Massimo On Oct 5, 9:07 am, Farsheed Ashouri farsheed.asho...@gmail.com wrote: i bet they event didn't create a simple site with Web2py. Don't trust them. Just for test, use Django for a week and you'll be back to Web2py soon than we expected and with headaches!! Every day, I am creating a new website for my clients. When I was using Django, just initial setup took me hours. I am not saying other frameworks are not smart. Web2Py is just better.
[web2py] Re: Form output format
You may need to render it first and edit it again. But why do you want that kind of output? If you need to show o hide something, I recommend using jQuery.
[web2py] Re: criticism of web2py
We need to do this Actually I would like that be part of the book 4th ed and that is causing some delays. web2py.com/appliances is crap and should be disappear. The plugin sites should be merged into one that makes it easy for people to contribute. Instant-press is the de-fact CMS and I think it can be packaged with other apps (for example PyForum, pyStack, IssueTracker, etc) to build a suite of production tools perhaps using federated authentication. plugin_wiki needs modules for rss, ics, shopping cart and payments, and google maps. On Oct 5, 12:26 pm, Farsheed Ashouri farsheed.asho...@gmail.com wrote: just wonder if your client(s) want CMS, blog, forms...what do you use? Yes, most of them want, and once you create your standard core, you can reuse those controllers and models or views simply in other projects!
[web2py] Re: Form output format
When first starting out, it would be a lot easier to see what the html helpers are doing if the html were tidier. On Oct 5, 10:44 am, Anthony abasta...@gmail.com wrote: If you're using the FORM or SQLFORM helper (or Crud), I don't think there's any way to control the way it is serialized in the response body. Why do you need that format? Anthony On Wednesday, October 5, 2011 10:06:25 AM UTC-4, miroslavgojic wrote: I have simply form and it work, but in HTML source code it is one line, how i can get form i more lines i HTML source code. Source code for my form in one line: form action= enctype=multipart/form-data method=posttabletr id=poruke_poruka__rowtd class=w2p_fllabel for=poruke_poruka id=poruke_poruka__labelPoruka: /label/tdtd class=w2p_fwinput class=string id=poruke_poruka name=poruka type=text value= //tdtd class=w2p_fc/td/trtr id=poruke_post_author__rowtd class=w2p_fllabel for=poruke_post_author id=poruke_post_author__labelPost Author: / label/tdtd class=w2p_fwinput class=string id=poruke_post_author name=post_author type=text value= // tdtd class=w2p_fc/td/trtr id=submit_record__rowtd class=w2p_fl/tdtd class=w2p_fwinput type=submit value=Submit //tdtd class=w2p_fc/td/tr/tablediv class=hiddeninput name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d /input name=_formname type=hidden value=poruke/create //div/form And I need to get: form action= enctype=multipart/form-data method=post table tr id=poruke_poruka__row td class=w2p_fl label for=poruke_poruka id=poruke_poruka__label Poruka: /label /td td class=w2p_fw input class=string id=poruke_poruka name=poruka type=text value= / /td td class=w2p_fc /td /tr tr id=poruke_post_author__row td class=w2p_fl label for=poruke_post_author id=poruke_post_author__label Post Author: /label /td td class=w2p_fw input class=string id=poruke_post_author name=post_author type=text value= / /td td class=w2p_fc /td /tr tr id=submit_record__row td class=w2p_fl /td td class=w2p_fw input type=submit value=Submit / /td td class=w2p_fc /td /tr /table div class=hidden input name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d / input name=_formname type=hidden value=poruke/create / /div /form
[web2py] Re: How to start something when page rendering has completed?
Put something like this at the end of your page: div id=jsrun/div script ajax('../response_url', [''], 'jsrun'); /script create a function that returns data: def response_url(): return ''' YOUR DATA OR EVEN JSSCRIPT HERE '''
[web2py] grid signature
I have a controller that tailors the grid for a table - setting the fields, query, orderby and args parameters depending on the table requested. My problem is that the CSV and paginate request formats do not contain the tablename in request.args or request.vars. So I am unable to configure my grid when I get a CSV or paginate request. I could put the tablename in args but that seems a bit untidy. How does web2py know what to return from csv and paginate requests when it does not have the tablename? Is it accessible via the _signature fields? As I understand it these are the request formats used by grid: /tablename = produces initial grid /arg1/arg2/new/tablename = for add button /arg1/arg2/edit/tablename/1 = for edit button /arg1/arg2/csv?_signature=13d93655641 = for export button /arg1/arg2?page=2_signature=e2ad87f2 = for paginate button
[web2py] Re: How to start something when page rendering has completed?
Thank you so much Farsheed. I will test this and post my findings. Pubsub over polling would save me a ton of bandwidth. -David On Oct 5, 1:52 pm, Farsheed Ashouri farsheed.asho...@gmail.com wrote: Put something like this at the end of your page: div id=jsrun/div script ajax('../response_url', [''], 'jsrun'); /script create a function that returns data: def response_url(): return ''' YOUR DATA OR EVEN JSSCRIPT HERE '''
[web2py] Re: criticism of web2py
On Oct 6, 6:46 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: We need to do this ... Instant-press is the de-fact CMS I have been meaning to ask that question for a while. Does that mean that the plugin_wiki is not the recommended way forward, or do you see it as having a different purpose (wiki specifically, instead of general cms). I've got both installed and I'm converting an existing,hard coded web site that I built using both tools to see which I prefer. I started out with wordpress but I want to use web2py instead. The question is: plugin_wiki or instantpress. Finally, instantpress looks great, well done Martin, but I could certainly use some help from more documentation.
[web2py] Re: criticism of web2py
P.S. In my opinion, having a solid CMS solution running on web2py will be a huge boost to the adoption of web2py. If Instantpress is the recommended approach, perhaps it deserves a little space (at least a link) on the web2py website. It may be one of many plugin apps available, but I think CMS deserves a special mention.
[web2py] Building up a Query from nothing
Hi everybody, I'm building a page that will search for rows in a database table based on optional URL parameters, or return all rows if no parameters are given. However, I'm having trouble finding a good way to build up the query without having an existing Query object to start with. Web2py currently lets me do something like this: q = (db.person.height 5) q = q (db.person.height 6) db(q).select() But I'd like to be able to do something like this (in pseudocode): q = EmptyQuery(defaultTable=db.person) if request.vars.minheight: q = q (db.person.height request.vars.minheight) if request.vars.maxheight: q = q (db.person.height request.vars.maxheight) people = db(q).select() so that if no parameters are given, it will select all from db.person, but you can optionally filter by min and max height. Is there an easy way to do this in web2py? Thanks! Kevin
Re: [web2py] Building up a Query from nothing
queries=[] queries.append(db.table.id0) # this is the main query if arg1 == x: queries.append(db.table.field == x) if arg2 == y: queries.append(db.table.otherfield == y) # many conditions here query = reduce(lambda a,b:(ab),queries) db(query).select()
[web2py] Re: Building up a Query from nothing
A couple other notes: - I know I could start with a query that will return everything, like db.person.id 0, but I'm worried about how that will interact with queries that are optimized by an index that doesn't include the id column - An old trick when building up SQL WHERE statements as strings is to start with WHERE 1=1 (which should get optimized away by the SQL engine) and go from there. However, I couldn't find a way to make a Query that evaluated to the equivalent of 1=1. Cheers, Kevin On Oct 5, 1:39 pm, Kevin Ivarsen kivar...@gmail.com wrote: Hi everybody, I'm building a page that will search for rows in a database table based on optional URL parameters, or return all rows if no parameters are given. However, I'm having trouble finding a good way to build up the query without having an existing Query object to start with. Web2py currently lets me do something like this: q = (db.person.height 5) q = q (db.person.height 6) db(q).select() But I'd like to be able to do something like this (in pseudocode): q = EmptyQuery(defaultTable=db.person) if request.vars.minheight: q = q (db.person.height request.vars.minheight) if request.vars.maxheight: q = q (db.person.height request.vars.maxheight) people = db(q).select() so that if no parameters are given, it will select all from db.person, but you can optionally filter by min and max height. Is there an easy way to do this in web2py? Thanks! Kevin
[web2py] Problem with SQLFORM
I want to add an upload form to a page (allow users to add attachments) I've basically copied the comment example (appears in chapter 3) but use an upload field (instead of text) however I'm getting the following error which doesn't really makes sense : type 'exceptions.AttributeError'('SQLFORM' object has no attribute 'accepted') This is the code : @auth.requires_login() def show(): project = db(db.project.id==request.args(0)).select().first() form = SQLFORM(db.file) form.project = project.id if form.process().accepted: session.flash = 'form accepted' return dict(project=project, form=form) Can't figure out what I'm missing, this should be quite straight forward the . accepted appears in quite a few examples using this exact code
[web2py] Re: Form output format
It is not ease to reed to long lines of HTML code and it is practical when you need to find some id or class of HTML tag element. And for form I see that is used table can I and how make my output for form, forms, ... with div tag instead table tag. On Oct 5, 7:48 pm, Cliff cjk...@gmail.com wrote: When first starting out, it would be a lot easier to see what the html helpers are doing if the html were tidier. On Oct 5, 10:44 am, Anthony abasta...@gmail.com wrote: If you're using the FORM or SQLFORM helper (or Crud), I don't think there's any way to control the way it is serialized in the response body. Why do you need that format? Anthony On Wednesday, October 5, 2011 10:06:25 AM UTC-4, miroslavgojic wrote: I have simply form and it work, but in HTML source code it is one line, how i can get form i more lines i HTML source code. Source code for my form in one line: form action= enctype=multipart/form-data method=posttabletr id=poruke_poruka__rowtd class=w2p_fllabel for=poruke_poruka id=poruke_poruka__labelPoruka: /label/tdtd class=w2p_fwinput class=string id=poruke_poruka name=poruka type=text value= //tdtd class=w2p_fc/td/trtr id=poruke_post_author__rowtd class=w2p_fllabel for=poruke_post_author id=poruke_post_author__labelPost Author: / label/tdtd class=w2p_fwinput class=string id=poruke_post_author name=post_author type=text value= // tdtd class=w2p_fc/td/trtr id=submit_record__rowtd class=w2p_fl/tdtd class=w2p_fwinput type=submit value=Submit //tdtd class=w2p_fc/td/tr/tablediv class=hiddeninput name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d /input name=_formname type=hidden value=poruke/create //div/form And I need to get: form action= enctype=multipart/form-data method=post table tr id=poruke_poruka__row td class=w2p_fl label for=poruke_poruka id=poruke_poruka__label Poruka: /label /td td class=w2p_fw input class=string id=poruke_poruka name=poruka type=text value= / /td td class=w2p_fc /td /tr tr id=poruke_post_author__row td class=w2p_fl label for=poruke_post_author id=poruke_post_author__label Post Author: /label /td td class=w2p_fw input class=string id=poruke_post_author name=post_author type=text value= / /td td class=w2p_fc /td /tr tr id=submit_record__row td class=w2p_fl /td td class=w2p_fw input type=submit value=Submit / /td td class=w2p_fc /td /tr /table div class=hidden input name=_formkey type=hidden value=92194098-9cae-46c7-92d5-6f084a47536d / input name=_formname type=hidden value=poruke/create / /div /form
Re: [web2py] Re: criticism of web2py
+1 2011/10/5 Andrew awillima...@gmail.com: P.S. In my opinion, having a solid CMS solution running on web2py will be a huge boost to the adoption of web2py. If Instantpress is the recommended approach, perhaps it deserves a little space (at least a link) on the web2py website. It may be one of many plugin apps available, but I think CMS deserves a special mention.
[web2py] Re: Form output format
Hi miroslavgojic: To see html and other things like css, javascript I recomend you use firebug (a firefox addon) or similar in chrome (getfirebug.com) Other firefox addon (only useful to see html only) is: view source chart. Both firebug and view source chart can be found in addons.mozilla.com To change the table of the form (generated) please see this (from the book:[SQLForm Chapter] http://www.web2py.com/book/default/chapter/07?search=form+style): formstyle determines the style to be used when serializing the form in html. It can be table3cols (default), table2cols (one row for label and comment, and one row for input), ul (makes an unordered list of input fields), divs (represents the form using css friendly divs, for arbitrary customization). formstyle can also be a function that takes (record_id, field_label, field_widget, field_comment) as attributes and returns a TR() object. HTH Bye
[web2py] Re: Problem with SQLFORM
Are you using the current version of web2py? That syntax was only introduced in the most recent version. On Wednesday, October 5, 2011 4:55:14 PM UTC-4, Guy Nesher wrote: I want to add an upload form to a page (allow users to add attachments) I've basically copied the comment example (appears in chapter 3) but use an upload field (instead of text) however I'm getting the following error which doesn't really makes sense : type 'exceptions.AttributeError'('SQLFORM' object has no attribute 'accepted') This is the code : @auth.requires_login() def show(): project = db(db.project.id==request.args(0)).select().first() form = SQLFORM(db.file) form.project = project.id if form.process().accepted: session.flash = 'form accepted' return dict(project=project, form=form) Can't figure out what I'm missing, this should be quite straight forward the . accepted appears in quite a few examples using this exact code
[web2py] Re: how to do db administration of default auth tables?
Massimo Di Pierro wrote: Did you put this: auth.define_tables() in the controller instead of a model? Something is not executing that line when you visit appadmin. I left it where it was in the simple application i created using the web interface. I just added a table of my own at the bottom of db.py. I will try to insert some print statements tomorrow to see if something is printed on the console. Thanks for this insight. Stefaan.
[web2py] OpenLayers and Web2Py
Has anyone created a Web2Py Python wrapper for OpenLayers? I searched in the slices, and in the plugins, and in the discussions. And the last activity was a couple years ago. I'd like to not have to pay the Google Tax.\ Rufus
[web2py] Re: How to start something when page rendering has completed?
No errors but no running of the listener.next() either. I tried to put the function declaration above the {{extend...}} statement as per the book but still no go. I get up to subscribing to the channel just fine (but that's from controller and passed to the view) verified via telnet to Redis but can't seem to tell the listener to wait for new messages without mucking everything up. Thank you for your help anyway Farsheed. I'll fiddle with it a bit more but if I cannot produce meaningful results I'll be doomed to poll. Not the end of the world but less than ideal. So it goes. -David On Oct 5, 1:52 pm, Farsheed Ashouri farsheed.asho...@gmail.com wrote: Put something like this at the end of your page: div id=jsrun/div script ajax('../response_url', [''], 'jsrun'); /script create a function that returns data: def response_url(): return ''' YOUR DATA OR EVEN JSSCRIPT HERE '''
[web2py] Re: manual file upload using SQLFORM.factory
Hello Alex, Two things I've found when manually uploading via SQLFORM.factory: 1) You need to specify a table_name='...' to avoid the no_table_newfilename.extension issue like this: form = SQLFORM.factory(...Field definitions..., table_name='some_table_name') 2) Additionally you must specify an uploadfolder in your upload Field definition similar to this: form = SQLFORM.factory(..., Field('invoice_logo', type='upload', uploadfolder=os.path.join(request.folder,'static/uploads/')), ..., table_name='whatever_you_like') **NOTE** 'static/uploads' is just an example, you can upload to wherever it will be appropriate. In this case the newly uploaded and renamed file to your_application's_dir/static/uploads/your_new_filename_here One gotcha to look out for following your field name as an example without the quotation marks: In your form.accepts(...): request.vars.invoice_logo will contain the original filename of your upload whereas form.vars.invoice_logo_newfilename will contain the newly renamed file like yourtablename.9203842903.thaoeu09gu023hgda3p.ext No need to call store() directly as SQLFORM.factory will take care of that for you. I hope that this helps you. -David Bloom On Oct 4, 7:53 pm, Alex mrauc...@gmail.com wrote: Hi, I've already spent quite some time with the following problem which I think should be fairly easy. I hope someone can help me. # model db.define_table('admin_setting', Field('name', 'string', notnull=True), Field('value', 'string', notnull=True)) in the controller I'm creating a form for various admin settings. form = SQLFORM.factory( Field('invoice_logo', 'upload'), ...) the view works well and displays all fields. When uploading a file for the logo the file should be handled like always (file uploaded to uploads folder, renamed to uuid filename). in the table admin_setting I want to store the filename of the uploaded file in a row where name='invoice_logo' (the filename should be stored in the value field). How can I achieve this? currently I have this code (the update is performed later and not shown here): if form.accepts(request.vars, formname='admin_setting_form', dbio=False): if request.vars.invoice_logo != None: if type(request.vars.invoice_logo) != str: request.vars.invoice_logo_filename = request.vars.invoice_logo.filename field = Field('invoice_logo', 'upload') # field.store fails because field does not have a _tablename uploaded_file = field.store(request.vars.invoice_logo.file, request.vars.invoice_logo.filename) else: del request.vars.invoice_logo # do not delete existing logo
[web2py] Re: Installing under Linux
Never mind. I figured it out. You have to use https:, not http: as in the Welcome app. Richard On Oct 5, 4:48 pm, horridohobbyist horrido.hobb...@gmail.com wrote: Son of a gun! That worked! The main reason for my Linux experiment is to determine how to make web2py coexist with an existing web app (which is not written in Python) on the target Linux server. Currently, Apache2 is fully configured within httpd.conf. It would seem that web2py does not touch httpd.conf at all, so coexistence should be straightforward. What a relief! I do have one important question, though. The admin apps are blocked, ostensibly for security reasons. How do I run admin for web2py? Don't I need to access admin so that I can upload apps? Thanks, Richard On Oct 5, 1:23 pm, Farsheed Ashouri farsheed.asho...@gmail.com wrote: Did you check web2py/scripts/setup-web2py-ubuntu.sh? It might be very helpful and will do the job for you automatically!
[web2py] Automatic data import and export in web2py application
Hi , i am developing an application for online booking system.i have come across a requirement where i nedd to automatically import and and export data to/from google datastore i know this is possible from command line...but i wanted to have this automizedcan i have a link or a button in my application on click of which i can call import/exportif there is any pre existing code for this please paste that here ..and if there are any other suggestion please post a reply
[web2py] Re: Would there be an advantage to having more discussion on Stackoverflow?
I believe the community would be better served by using Stackoverflow for QA and using the newsgroups for non QA freeform discussions/ news. I think this would seperate and emphasize the highly reusable information, QA, from the often transient/limited use information/ discussion. There is alot of activity on this newsgroup, which can make it challenging to find answers to previously asked questions... signal to noise mismatch. On Oct 5, 8:26 am, monotasker scotti...@gmail.com wrote: I've been using web2py for about six weeks now and am loving the supportive community. I notice that there's a strong push to focus that community discussion here on the Google group. I wonder if this has some disadvantages, though: a) It seems difficult sometimes to find previous discussions of the same issue. So I suspect people are answering the same question more than they need to sometimes. Here it seems like Stackoverflow helps to streamline the support process. b) The focus on the Google group means that the web2py name isn't popping up as often in mixed forums like Stackoverflow. I think that creates the impression that web2py has fewer users than it really does. So would there be some value in encouraging people to direct specific support questions to Stackoverflow and reserving the Google group for things like announcements, open-ended discussion, threads about resources and hosting, etc? Ian
[web2py] Re: criticism of web2py
I like web2py. I think it's the best web framework out there... Let me explain where I'm coming from. My first experience as a web developer was with Smalltalk/Seaside in 2007. It came highly recommended to me by a friend. He told me that Seaside was very powerful, very flexible, and most importantly, really easy to learn. I value productivity and ease of use above all else when it comes to software development. I don't care about ideology or the ultimate in power and performance. My Seaside project was completed in record time. I was a happy camper. My attitude is definitely non-geek-like. I am not a geek. I only care about getting the job done in the shortest time, with the least effort and the least pain. This has been my guiding principle over a 20-year career in IT (ranging from Fortran to C, from mainframe to PC). A year ago, I took a whack at Django, but I did not like it. I also tried Java-based Wicket. But neither passed the acid test of being really easy to learn and use. When I came across web2py a couple of months ago, I was utterly astonished. For a newbie, it's fall-off-the-log easy to pick up. That's important to me. And being easy to use doesn't mean that it's lacking in power. I can be phenomenally productive with web2py. My conclusion is that web2py is actually easier than Seaside (heresy!). It's also easier than Django, and it's definitely much easier than Wicket. I can't understand why programmers don't want the easiest tools. I prefer to enjoy my life, take it easy, rather than expose myself to aggravation and headache, regardless of how much power you gain. But that's just me. Richard On Oct 5, 10:07 am, Farsheed Ashouri farsheed.asho...@gmail.com wrote: i bet they event didn't create a simple site with Web2py. Don't trust them. Just for test, use Django for a week and you'll be back to Web2py soon than we expected and with headaches!! Every day, I am creating a new website for my clients. When I was using Django, just initial setup took me hours. I am not saying other frameworks are not smart. Web2Py is just better.
[web2py] GAE BULK UPLOAD AND DOWNLOAD
Hi , i am developing an application for GAE in python using web2py frameworki have come across a requirement where i need to import and export the data from CSV or XML files into the google datastorei was able import and export the data from the command line..but i want this to be done on click of a link or a button ...can i have a link or a button in my application to automatically import and export the data when clickedif yes ..please guide me how to go further with this..
[web2py] Re: manual file upload using SQLFORM.factory
Suggestions to make the behaviour better? On Oct 5, 5:55 pm, TheSweetlink yanosh...@gmail.com wrote: Hello Alex, Two things I've found when manually uploading via SQLFORM.factory: 1) You need to specify a table_name='...' to avoid the no_table_newfilename.extension issue like this: form = SQLFORM.factory(...Field definitions..., table_name='some_table_name') 2) Additionally you must specify an uploadfolder in your upload Field definition similar to this: form = SQLFORM.factory(..., Field('invoice_logo', type='upload', uploadfolder=os.path.join(request.folder,'static/uploads/')), ..., table_name='whatever_you_like') **NOTE** 'static/uploads' is just an example, you can upload to wherever it will be appropriate. In this case the newly uploaded and renamed file to your_application's_dir/static/uploads/your_new_filename_here One gotcha to look out for following your field name as an example without the quotation marks: In your form.accepts(...): request.vars.invoice_logo will contain the original filename of your upload whereas form.vars.invoice_logo_newfilename will contain the newly renamed file like yourtablename.9203842903.thaoeu09gu023hgda3p.ext No need to call store() directly as SQLFORM.factory will take care of that for you. I hope that this helps you. -David Bloom On Oct 4, 7:53 pm, Alex mrauc...@gmail.com wrote: Hi, I've already spent quite some time with the following problem which I think should be fairly easy. I hope someone can help me. # model db.define_table('admin_setting', Field('name', 'string', notnull=True), Field('value', 'string', notnull=True)) in the controller I'm creating a form for various admin settings. form = SQLFORM.factory( Field('invoice_logo', 'upload'), ...) the view works well and displays all fields. When uploading a file for the logo the file should be handled like always (file uploaded to uploads folder, renamed to uuid filename). in the table admin_setting I want to store the filename of the uploaded file in a row where name='invoice_logo' (the filename should be stored in the value field). How can I achieve this? currently I have this code (the update is performed later and not shown here): if form.accepts(request.vars, formname='admin_setting_form', dbio=False): if request.vars.invoice_logo != None: if type(request.vars.invoice_logo) != str: request.vars.invoice_logo_filename = request.vars.invoice_logo.filename field = Field('invoice_logo', 'upload') # field.store fails because field does not have a _tablename uploaded_file = field.store(request.vars.invoice_logo.file, request.vars.invoice_logo.filename) else: del request.vars.invoice_logo # do not delete existing logo
[web2py] Re: Automatic data import and export in web2py application
Why not run the app directly there? Perhaps an app that simply exposes the service. On Oct 5, 6:29 pm, Saurabh S ggtestlo...@gmail.com wrote: Hi , i am developing an application for online booking system.i have come across a requirement where i nedd to automatically import and and export data to/from google datastore i know this is possible from command line...but i wanted to have this automizedcan i have a link or a button in my application on click of which i can call import/exportif there is any pre existing code for this please paste that here ..and if there are any other suggestion please post a reply
[web2py] Re: Why showing a log in option inside of the admin interface
Yes, Massimo, as Anthony said, the problem seems to be webfaction/uwsgi related.
[web2py] Re: Automatic data import and export in web2py application
sorry i didnt get youcould you please elaborate this ... On Oct 6, 6:47 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Why not run the app directly there? Perhaps an app that simply exposes the service. On Oct 5, 6:29 pm, Saurabh S ggtestlo...@gmail.com wrote: Hi , i am developing an application for online booking system.i have come across a requirement where i nedd to automatically import and and export data to/from google datastore i know this is possible from command line...but i wanted to have this automizedcan i have a link or a button in my application on click of which i can call import/exportif there is any pre existing code for this please paste that here ..and if there are any other suggestion please post a reply
[web2py] Re: Issue Tracking System Survey
Bug 1 is a web2py bug, not an issue tracker bug, and it is fixed in trunk. On Oct 4, 9:10 pm, Tsize tsiz...@gmail.com wrote: On Oct 4, 2:29 pm, petrasadi petras...@gmail.com wrote: I am currently working on a project meant to improve the current Web2Py Issue Tracking System. Are there any features that could use touch-ups or new features that should be implemented? Looking forward to your suggestions. I assume your are referring to the recently posted issue tracking app. I have found one bug and a have a couple of other smaller requests. Bug 1. When I entered multiple projects with multiple issues each I had a problem with the export to csv function. From the main page if I use this it gives me a listing of projects but no other data or options (say just open items or items closed in a given time frame). If I request a csv be exported from within a project the csv is empty which is a defect to me. I want to be able to specify the exported csv provide only select data at all levels. Wishes 1. Some comments were made about being able to pull over web2py projects automatically. While this is OK I work as an electrical engineer and only a few of my issues are program related. I would like to be able to use this both for my web2py project as well as for a general issue tracker. 2. Like quite a few people using an issue tracker I will need to start with the program as released and then make a couple of modifications. In my case I will need to add a couple more fields that will be used to help with tracking my projects and setting priorities. Documentation released with this program covering common modifications would be nice. I actually need something similar to the roundup default interface. If I think of anything else over the next couple of days I will add some more comments. Best regards, Thomas 3.
[web2py] Re: criticism of web2py
+1 or more I looked at several Python frameworks 1.5 years ago. Half of them are dead projects now glad I wasn't on any of those bandwagons. It came down to Web2py and Django and every time I looked at Django I went back to Web2py because it felt so well designed and set up for getting things done. The true test for a framework for me is how much it helps you. I spent 6 years in the Java world and know about things that require a lot of work to appease them so they will work for you. Web2py is clearly my best experience ever for software development in web environments. I have been a developer since 1977. Ron
[web2py] Sending Email Under Linux
Under Windows, I have no problem sending emails from my web2py app. I import gluon.tools.Mail and perform a send to the server 'smtp.broadband.rogers.com:25'. Easy peasy. However, under Linux, it just doesn't work. The Mail send operation always fails. If the error is being logged, I don't know where the log file is. It seems to me that, under Linux, web2py installs Postfix. I presume it's used for sending emails. When I ran setup-web2py-ubuntu.sh, I was asked for a server name. I entered 'smtp.broadband.rogers.com'. I don't know if this was a mistake. Can anybody shed any light on this? Thanks, Richard
[web2py] new feature - need help
There is a new feature in trunk. When you make a searchable grid, it will now show a button before the search input field. It says Query. Hover over it and it will create a popup menu so that you can build the query with the mouse. It works but the css is horrible and I could use some help fixing it. The code is generated by a single function in sqlhtml.py build_search() Massimo
[web2py] Re: Sending Email Under Linux
Check /var/log/mail.log You might want to review Postfix install instructions for your version of Linux. The Linode help docs are usually really good: http://library.linode.com/email/postfix/gateway-ubuntu-10.10-maverick But I think this Ubuntu one might be more helpful: https://help.ubuntu.com/community/Postfix The server name is going to be your server's name. As suggested, try running: sudo dpkg-reconfigure postfix