Re: [web2py] Re: Two questions: 1. empty SQLFORM.grid 2. Represent question
On 13 December 2011 16:05, Cliff wrote: > Johann, > > Does grid work if you comment out that left join? > It is not possible with that query. It is the essence of the query. I do not have a problem with the grid using more general queries. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
Re: [web2py] Re: Two questions: 1. empty SQLFORM.grid 2. Represent question
Thanks Anthony, db[tabel].id.represents > > should be: > > db[tabel].id.represent > > Maybe I am becoming tired. I should have seen that. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: Register user - Issue
By default, auth.settings.password_min_length = 4, which is passed to the default CRYPT validator for the password field, so a minimum 4-character password should be required. Have you defined a custom auth_user table without specifying a CRYPT validator (or a min_length arg to CRYPT)? You can also add the IS_STRONG validator to the password field (should come before the CRYPT validator, since you need to check the password strength in plain text before CRYPT does any hashing). Anthony On Wednesday, December 14, 2011 12:09:36 AM UTC-5, Viren Patel wrote: > > Hi all, > > In register screen if i do not provide password and verify-password still > the user does gets registered. > Thereafter i am also able to login with the registered user without > providing the password > How can we make the password field mandatory both in register and login > > Thanks, > Viren >
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Dec 13, 2011, at 6:20 PM, Anthony wrote: > The original example was for "url of some web page", which I assume is not in > the same app (or necessarily even a web2py app at all). If it's in the same > app, or any web2py app under your control, there should be better ways to > return the output of a particular function/view. > Here's Peter's example: > Here is a simple example of what I mean: > > If I type > > http://127.0.0.1:8000/admin/default/site > > at my browser when I am logged in, I get the installed applications > page. > > However if I do it by calling the test routine below > > > def test(): >import urllib >url="http://127.0.0.1:8000/admin/default/site"; >f = urllib.urlopen(url) >s = f.read() >return s > > I have to login again even though I am logged in on my computer. So > the question is, can I somehow add the 'context' to s so that it > recognises that I am already logged in? > > I am using web2py's admin as an example, but the solution should work > for any website. If the urllib access is to the current (web2py) app, then the caller (test) is in a special position WRT the browser: it has possession of the relevant cookies. If the urllib access is to some arbitrary (third-party) website that the client browser happens to be logged in to, then this does not apply.
[web2py] Register user - Issue
Hi all, In register screen if i do not provide password and verify-password still the user does gets registered. Thereafter i am also able to login with the registered user without providing the password How can we make the password field mandatory both in register and login Thanks, Viren
[web2py] Re: How to translate Django+GAE project for deferred.defer in web2py
Actually the error I get is here: request = current.request AttributeError: 'local' object has no attribute 'request' So there is 'current' but there is not a 'request'
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Tuesday, December 13, 2011 8:36:47 PM UTC-5, pbreit wrote: > > Oh, I see. If the person logs in to a web2py app and then hits a page > which is going to do the urlopen that calls the same app, then I suppose > you could grab the cookie and send it along. Is that really what id being > contemplated? The original example was for "url of some web page", which I assume is not in the same app (or necessarily even a web2py app at all). If it's in the same app, or any web2py app under your control, there should be better ways to return the output of a particular function/view.
[web2py] Re: How to translate Django+GAE project for deferred.defer in web2py
good - if I go through this - you will get deferred too. ;) I am very close.
[web2py] Re: request reset password
I guess technically the left side of of an email address is supposed to be case sensitive so might break somewhere.
[web2py] Re: request reset password
How does Web2py work with login emails and case? Seems to me it should be case INsensitive. Best way to do that I suspect is always converting emails to lower upon entry.
Re: [web2py] Re: Rocket vs mod_wsgi
You can get free CDN from CloudFlare.
Re: [web2py] Re: Redirecting to a URL, but with changed html
Oh, I see. If the person logs in to a web2py app and then hits a page which is going to do the urlopen that calls the same app, then I suppose you could grab the cookie and send it along. Is that really what id being contemplated? I wonder if a LOAD() would suffice?
[web2py] Re: MARKMIN indentation
Markmin should work well with unicode. The TAG(...) html parser, based on HTMLParser has problems with non- utf8 encodings and non well-formatted html. Massmo On Dec 13, 6:10 pm, Vasile Ermicioi wrote: > I am trying to convert a bunch of html files to markmin, but I got strange > results > I think html to markmin doesn't work well with unicode (utf8 my case) > attached are an example > > and this is my controller to do that > > def mmtest(): > from gluon.html import markmin_serializer > #markmin = TAG(html).flatten(markmin_serializer) > for row in db(db.articles).select(): > html = row.content > markmin = TAG(html).flatten(markmin_serializer) > open('d:/mmtest/'+str(row.id)+'.html', 'w').write(html) > open('d:/mmtest/'+str(row.id)+'.mm', 'w').write(markmin) > return "ok" > > Also at some point I am getting this error > > Traceback (most recent call last): > File "D:\web2py\gluon\restricted.py", line 194, in restricted > exec ccode in environment > File "D:/web2py/applications/fermer/controllers/tests.py", line 79, in > > File "D:\web2py\gluon\globals.py", line 149, in > self._caller = lambda f: f() > File "D:/web2py/applications/fermer/controllers/tests.py", line 6, in > mmtest > markmin = TAG(html).flatten(markmin_serializer) > File "D:\web2py\gluon\html.py", line 1054, in __call__ > return web2pyHTMLParser(decoder.decoder(html)).tree > File "D:\web2py\gluon\html.py", line 2172, in __init__ > self.feed(text) > File "C:\Python27\lib\HTMLParser.py", line 108, in feed > self.goahead(0) > File "C:\Python27\lib\HTMLParser.py", line 148, in goahead > k = self.parse_starttag(i) > File "C:\Python27\lib\HTMLParser.py", line 229, in parse_starttag > endpos = self.check_for_whole_start_tag(i) > File "C:\Python27\lib\HTMLParser.py", line 304, in > check_for_whole_start_tag > self.error("malformed start tag") > File "C:\Python27\lib\HTMLParser.py", line 115, in error > raise HTMLParseError(message, self.getpos()) > HTMLParseError: malformed start tag, at line 1, column 4219 > > 1.html > 1KViewDownload > > 1.mm > < 1KViewDownload
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Dec 13, 2011, at 5:22 PM, pbreit wrote: > Yeah, he's going to need to first script a login so he can grab and store the > cookie which he is then going to need to present on each urllib.urlopen(). > > Being logged in on your browser is not going to help since your browser and > your web2py code are totally separate. Is that true? I was thinking that if the urllib2 request is being made off a browser request, the existing cookie could be used to effectively run the urllib2 request under the existing authentication umbrella. If the whole sequence is triggered from a post-authentication browser request... > > He could possibly make it easier by not protecting the functions with > Web2py's authentication and instead inserting a secret header or cookie > variable or arg/var.
[web2py] Re: error downloading 1.99.3
P.S. I downloaded using aria2 and wget. Same result. On Wednesday, December 14, 2011, Nik Go wrote: > Yeah, probably. I just ignored the file, and it seems to be working. > > On Wednesday, December 14, 2011, kasapo wrote: > >> I downloaded the 1.99.3 source today and unzipped it with no issues. >> Maybe it was the crappy mobile connection or just some hiccup in the >> interwebs. I'd try again from another connection or just clear your >> cache and try downloading again... or use wget >> >> On Dec 13, 6:04 am, Nik Go wrote: >> > I'm not sure if it's my crappy mobile Internet connection or something >> else >> > but I couldn't seem to download a good copy of the version 1.99.3. >> > >> > When testing the zip file, I get this error: "error: invalid compressed >> > data to inflate web2py/applications/examples/static/artwork.tar.gz". I >> > already tried this three times today, without any success, and the same >> > error. >> >
Re: [web2py] Re: Redirecting to a URL, but with changed html
Yeah, he's going to need to first script a login so he can grab and store the cookie which he is then going to need to present on each urllib.urlopen(). Being logged in on your browser is not going to help since your browser and your web2py code are totally separate. He could possibly make it easier by not protecting the functions with Web2py's authentication and instead inserting a secret header or cookie variable or arg/var.
[web2py] Re: Web2py in pypi outdate.
Probably should make sure that stays up to date but cannot emphasize enough that it is best to use the source with version control.
Re: [web2py] Re: MARKMIN indentation
I am trying to convert a bunch of html files to markmin, but I got strange results I think html to markmin doesn't work well with unicode (utf8 my case) attached are an example and this is my controller to do that def mmtest(): from gluon.html import markmin_serializer #markmin = TAG(html).flatten(markmin_serializer) for row in db(db.articles).select(): html = row.content markmin = TAG(html).flatten(markmin_serializer) open('d:/mmtest/'+str(row.id)+'.html', 'w').write(html) open('d:/mmtest/'+str(row.id)+'.mm', 'w').write(markmin) return "ok" Also at some point I am getting this error Traceback (most recent call last): File "D:\web2py\gluon\restricted.py", line 194, in restricted exec ccode in environment File "D:/web2py/applications/fermer/controllers/tests.py", line 79, in File "D:\web2py\gluon\globals.py", line 149, in self._caller = lambda f: f() File "D:/web2py/applications/fermer/controllers/tests.py", line 6, in mmtest markmin = TAG(html).flatten(markmin_serializer) File "D:\web2py\gluon\html.py", line 1054, in __call__ return web2pyHTMLParser(decoder.decoder(html)).tree File "D:\web2py\gluon\html.py", line 2172, in __init__ self.feed(text) File "C:\Python27\lib\HTMLParser.py", line 108, in feed self.goahead(0) File "C:\Python27\lib\HTMLParser.py", line 148, in goahead k = self.parse_starttag(i) File "C:\Python27\lib\HTMLParser.py", line 229, in parse_starttag endpos = self.check_for_whole_start_tag(i) File "C:\Python27\lib\HTMLParser.py", line 304, in check_for_whole_start_tag self.error("malformed start tag") File "C:\Python27\lib\HTMLParser.py", line 115, in error raise HTMLParseError(message, self.getpos()) HTMLParseError: malformed start tag, at line 1, column 4219 Взято из Книга рекордов ГиннесаАвгуст – пора поедания сочных арбузов. Самый большой арбуз в мире вырастила семья из Арканзас, США. Летом 2005 года они вырастили невероятный арбуз весом целых 122 кг. Это средний вес двух взрослых людей. В 2006 году этот рекорд был занесен в Книгу рекордов Гиннеса.Источник:http://skuky.net 1.mm Description: Binary data
[web2py] Web2py in pypi outdate.
Hi guys the web2py packages in pypi (http://pypi.python.org/pypi/ web2py) is out date. Already been forgotten for a few months. can anyone update this? Regards!
[web2py] Re: How to translate Django+GAE project for deferred.defer in web2py
we are at the edge of my knowledge here, but the things that might be important to you from gae_handler.py: path = os.path.dirname(os.path.abspath(__file__)) sys.path = [path]+[p for p in sys.path if not p==path] from gluon.settings import global_settings global_settings.web2py_runtime_gae = True global_settings.db_sessions = True if os.environ.get('SERVER_SOFTWARE', '').startswith('Devel'): (global_settings.web2py_runtime, DEBUG) = \ ('gae:development', True) else: (global_settings.web2py_runtime, DEBUG) = \ ('gae:production', False) import gluon.main env['PATH_INFO'] = env['PATH_INFO'].encode('utf8') #this deals with a problem where GAE development server seems to forget # the path between requests if global_settings.web2py_runtime == 'gae:development': gluon.admin.create_missing_folders() from gluon.custom_import import custom_import_install web2py_path = global_settings.applications_parent # backward compatibility custom_import_install(web2py_path) those lines (or some combination thereof) setup the web2py path and environment. you might also need to call gluon.main to get request and response setup. perhaps you will need to do that as a wsgi middleware? good luck! sorry i don't have the experience to be more helpful. cfh
[web2py] Re: error downloading 1.99.3
Yeah, probably. I just ignored the file, and it seems to be working. On Wednesday, December 14, 2011, kasapo wrote: > I downloaded the 1.99.3 source today and unzipped it with no issues. > Maybe it was the crappy mobile connection or just some hiccup in the > interwebs. I'd try again from another connection or just clear your > cache and try downloading again... or use wget > > On Dec 13, 6:04 am, Nik Go > wrote: > > I'm not sure if it's my crappy mobile Internet connection or something > else > > but I couldn't seem to download a good copy of the version 1.99.3. > > > > When testing the zip file, I get this error: "error: invalid compressed > > data to inflate web2py/applications/examples/static/artwork.tar.gz". I > > already tried this three times today, without any success, and the same > > error. >
[web2py] Re: How to save the 'current' object to database?
in deferred I don't have a direct access to *request.** *Usually I use request = current.request, that is why I need an access to 'current'. But this is a no go. So I have to provide the path to web2py for deferred somehow. import os from gluon.settings import global_settings web2py_path = os.path.join(global_settings.applications_parent, *request* .folder)
[web2py] Re: MARKMIN indentation
+1 Markmin rocks
[web2py] Re: How to save the 'current' object to database?
And here is why GAE loses the path (sometimes) http://code.google.com/p/googleappengine/issues/detail?id=772#c11 All, this is now an officially acknowledged bug. The cause is a "feature" which resets sys.path to a fixed default at the start of each request. Due to where we are in the QA cycle for the next push it's not going to be fixed until the push after that one, but here is a work-around. The work-around saves a copy of sys.path in a global variable when main() is called for the first time, and resets sys.path to this value on each subsequent call. Here is sample code: import sys . . (code that modifies sys.path goes here) . ultimate_sys_path = None def main(): global ultimate_sys_path if ultimate_sys_path is None: ultimate_sys_path = list(sys.path) else: sys.path[:] = ultimate_sys_path ... (rest of main goes here) ... if __name__ == '__main__': main()
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Dec 13, 2011, at 1:40 PM, Anthony wrote: > I think it's easier than that, if you're already logged in, which I think is > the case here. The session cookie is already in request.cookies. > > It sounded like he wanted to do this with external websites, not necessarily > the current app (or even a web2py app). > If that's the case, then yes, he'd have to imitate the browser sequence for a login.
[web2py] Re: How to save the 'current' object to database?
Here is how Google described it: http://code.google.com/appengine/articles/deferred.html Handling import path manipulation Some applications, or the frameworks they use, rely on manipulating the Python import path in order to make all the libraries they need available. While this is a perfectly legitimate technique, the deferred library has no way of knowing what path manipulations you've engaged in, so if the task you're deferring relies on modules that aren't on the import path by default, you need to give it a helping hand. Failing to do this can result in your tasks failing to run - or worse, only failing intermittently. Fortunately, handling this is easy. Make sure your code that changes the import path is in a module all of its own, such as 'fix_path.py'. Such a module might look like this: import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), 'lib')) Then, import the 'fix_path' module along with your usual imports, anywhere you rely on the modified path, such as in the module you defined the functions you're calling with deferred.defer in.
Re: [web2py] Re: Redirecting to a URL, but with changed html
> > I think it's easier than that, if you're already logged in, which I think > is the case here. The session cookie is already in request.cookies. > It sounded like he wanted to do this with external websites, not necessarily the current app (or even a web2py app).
Re: [web2py] generate multiple form from a query
On Tuesday, December 13, 2011 4:33:38 PM UTC-5, Richard wrote: > > Hello Anthony, > > Since my "row" come from a query may I can do something like this (pseudo > code) : > > rows = db((db.lotns_lot_number.id == request.args(1))&\ > (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)&\ > (db[request.args(0)].sample_id == > db.lotns_sample.sample_id)).select\ > (db[request.args(0)].ALL, *HASH_FUNC(db[request.args(0)].ALL)* > orderby=db.lotns_sample.sample_code) > > > In SQL it is pretty common to use Alias for computed field on the fly... I > just don't know if web2py can handle it that way... > Maybe use a virtual field, which can be applied to a join: http://web2py.com/book/default/chapter/06#Virtual-Fields
Re: [web2py] generate multiple form from a query
Hello Anthony, Since my "row" come from a query may I can do something like this (pseudo code) : rows = db((db.lotns_lot_number.id == request.args(1))&\ (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)&\ (db[request.args(0)].sample_id == db.lotns_sample.sample_id)).select\ (db[request.args(0)].ALL, *HASH_FUNC(db[request.args(0)].ALL)* orderby=db.lotns_sample.sample_code) In SQL it is pretty common to use Alias for computed field on the fly... I just don't know if web2py can handle it that way... Thanks Richard On Tue, Dec 13, 2011 at 4:05 PM, Anthony wrote: > What I would like to have that is not actually possible I think is a way >> to "detect_record_change" with SQLFORM.factory... >> >> Do you have any idea how I could achieve that? >> > > You could create a hash of each row and store the hash value in a hidden > field. Then on form submission, hash the current version of the same row, > and make sure it matches the hash in the hidden field of the submitted form > -- if not, the record changed in between form creation and submission. > Actually, rather than creating a separate hidden field, you could even set > the record hash as the form's _formkey value (which is what > 'detect_record_change' actually does). > > Anthony >
[web2py] Re: error downloading 1.99.3
I downloaded the 1.99.3 source today and unzipped it with no issues. Maybe it was the crappy mobile connection or just some hiccup in the interwebs. I'd try again from another connection or just clear your cache and try downloading again... or use wget On Dec 13, 6:04 am, Nik Go wrote: > I'm not sure if it's my crappy mobile Internet connection or something else > but I couldn't seem to download a good copy of the version 1.99.3. > > When testing the zip file, I get this error: "error: invalid compressed > data to inflate web2py/applications/examples/static/artwork.tar.gz". I > already tried this three times today, without any success, and the same > error.
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Dec 13, 2011, at 12:54 PM, Anthony wrote: > On Tuesday, December 13, 2011 3:45:34 PM UTC-5, Jonathan Lundell wrote: > On Dec 13, 2011, at 12:28 PM, peter wrote: > > So in my example above. How does web2py's admin know I am logged in? > > Does it do this by accessing a cookie on my computer, if so how does > > it do that behind the scenes? Could urllib2.urlopen really handle > > this? > > Ordinarily it knows you're logged in because: > > 1. When you first log in, remembers it in a session and returns a cookie to > your browser. > > 2. On subsequent requests, your browser includes that cookie, and web2py uses > it to find the session (and its login state). (That's why you can find the > cookie in request.cookies.) > > So you need to take the session cookie and (like the browser) send it along > with the urllib2 request. (I could be missing something, but I don't think > you need basic auth here.) > > Sounds about right. So, basically, you would post the login form values to > the login URL, get back the session cookie, and then send the session cookie > back with the subsequent page request so the app would recognize you as > authenticated. I think it's easier than that, if you're already logged in, which I think is the case here. The session cookie is already in request.cookies.
Re: [web2py] generate multiple form from a query
> > What I would like to have that is not actually possible I think is a way > to "detect_record_change" with SQLFORM.factory... > > Do you have any idea how I could achieve that? > You could create a hash of each row and store the hash value in a hidden field. Then on form submission, hash the current version of the same row, and make sure it matches the hash in the hidden field of the submitted form -- if not, the record changed in between form creation and submission. Actually, rather than creating a separate hidden field, you could even set the record hash as the form's _formkey value (which is what 'detect_record_change' actually does). Anthony
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Tuesday, December 13, 2011 3:45:34 PM UTC-5, Jonathan Lundell wrote: > > On Dec 13, 2011, at 12:28 PM, peter wrote: > > > So in my example above. How does web2py's admin know I am logged in? > > Does it do this by accessing a cookie on my computer, if so how does > > it do that behind the scenes? Could urllib2.urlopen really handle > > this? > > Ordinarily it knows you're logged in because: > > 1. When you first log in, remembers it in a session and returns a cookie > to your browser. > > 2. On subsequent requests, your browser includes that cookie, and web2py > uses it to find the session (and its login state). (That's why you can find > the cookie in request.cookies.) > > So you need to take the session cookie and (like the browser) send it > along with the urllib2 request. (I could be missing something, but I don't > think you need basic auth here.) > Sounds about right. So, basically, you would post the login form values to the login URL, get back the session cookie, and then send the session cookie back with the subsequent page request so the app would recognize you as authenticated. >
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Dec 13, 2011, at 12:28 PM, peter wrote: > So in my example above. How does web2py's admin know I am logged in? > Does it do this by accessing a cookie on my computer, if so how does > it do that behind the scenes? Could urllib2.urlopen really handle > this? Ordinarily it knows you're logged in because: 1. When you first log in, remembers it in a session and returns a cookie to your browser. 2. On subsequent requests, your browser includes that cookie, and web2py uses it to find the session (and its login state). (That's why you can find the cookie in request.cookies.) So you need to take the session cookie and (like the browser) send it along with the urllib2 request. (I could be missing something, but I don't think you need basic auth here.) > > Thanks > Peter > > On Dec 13, 7:27 pm, Anthony wrote: >> On Tuesday, December 13, 2011 2:09:31 PM UTC-5, peter wrote: >> >>> def test(): >>> import urllib >>> url="http://127.0.0.1:8000/admin/default/site"; >>> f = urllib.urlopen(url) >>> s = f.read() >>> return s >> >>> I have to login again even though I am logged in on my computer. So >>> the question is, can I somehow add the 'context' to s so that it >>> recognises that I am already logged in? >> >>> I am using web2py's admin as an example, but the solution should work >>> for any website. >> >> Are you saying you want to programmatically login to a website and then >> retrieve a particular page that requires a login on that site? Look into >> urllib2:http://docs.python.org/howto/urllib2.html. I think it's pretty >> easy if the site supports basic authentication, otherwise a little more >> complex (requires posting form data and managing cookies). >> >> Anthony
[web2py] Re: Redirecting to a URL, but with changed html
So in my example above. How does web2py's admin know I am logged in? Does it do this by accessing a cookie on my computer, if so how does it do that behind the scenes? Could urllib2.urlopen really handle this? Thanks Peter On Dec 13, 7:27 pm, Anthony wrote: > On Tuesday, December 13, 2011 2:09:31 PM UTC-5, peter wrote: > > > def test(): > > import urllib > > url="http://127.0.0.1:8000/admin/default/site"; > > f = urllib.urlopen(url) > > s = f.read() > > return s > > > I have to login again even though I am logged in on my computer. So > > the question is, can I somehow add the 'context' to s so that it > > recognises that I am already logged in? > > > I am using web2py's admin as an example, but the solution should work > > for any website. > > Are you saying you want to programmatically login to a website and then > retrieve a particular page that requires a login on that site? Look into > urllib2:http://docs.python.org/howto/urllib2.html. I think it's pretty > easy if the site supports basic authentication, otherwise a little more > complex (requires posting form data and managing cookies). > > Anthony
[web2py] Re: smartgrid: events and callbacks downstream?
This kind of answers my question: http://comments.gmane.org/gmane.comp.python.web2py/72424 but I'll add just to weigh in on Massimo's question re: requirements for this feature and a use case. My scenario is relatively easy to describe: I have a database of various tables representing different object types. Each of these object types has a REST web service associated with it that needs to be called relative to CRUD functions around the database. So all I want is to be able to hook or get a callback on the database trigger that allows me to do something like: import requests def on_insert_success_callback(row): # url and auth omitted for brevity r = requests.post(insert_api_url, data=row) if r.status_code == 200: # yay else: # the second parameter would be needed to prevent the potential # for endless tight loops between failed insert and delete callbacks delete_row(row, no_cascade_callback) def on_delete_success_callback(row): r = request.post(delete_api_url, data=row) if r.status_code == 200: # yay else: print 'orphaned object deleted from database but not webservice' Given the complexity that Massimo describes, I'd argue for a very simple CRUD trigger callback set as most all of my web service usage patterns map to that directly. Hope this helps. David On Dec 13, 2:44 pm, David Watson wrote: > I am using smartgrid to generate some table and form interfaces to my > database. Is there a way to use something like the process function > with smartgrid to get callbacks? It's not clear to me how I can hook > into the downstream click-generated events from the edit form, for > instance. I just want to be able to hook some code into the event > stream after the successul creation of the database object described > by a row in the smart grid. I'm hoping there's a way, but if not, > having that kind of event chaining would be really useful. > > Thanks, > David
Re: [web2py] Re: Fwd: [PyCon-Organizers] Web2py is Out Pycon2012
Hello Massimo, Study hard, live intensely studying about Python and web2py and when you're offthe big event, it hurts a lot, I'm sad too, but I will not give up because I know that you've created is the best, I'll study more because I'll try to do a product that is recognized world wide. Very sad, but not give up. thank's Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil Apóio 2011/12/13 Massimo Di Pierro > Hello Ovidio, > > I understand you and others are not happy with not having a web2py > tutorial at Pycon. I am too. Nevertheless, I want to clarify a few > things. > > - The main reason I posted the list of tutorials was to inform you > about the excellent tutorials that will be offered. The fact that > there will not be a web2py tutorial should not overshadow the other > good things about this conference. > > - Steve is right that last year the web2py tutorials was not well > attended. Perhaps that was a motivation for the rejection? I have not > yet received an official letter about the motivation for the rejection > and I will share that this group. Whatever the reason, I trust the > people involved in this decision and I trust the explanation will be > satisfactory. > > - Of course I am a bit upset that the tutorial was rejected but this > fact is not that that important. > > - I am still hoping we will get a web2py talk at PyCon since that > never happened but now we need it less than we needed three hears ago. > At that time it was important for us to outreach the python community > and tell them about our cool new project. Today everybody knows about > it and everybody had made up his/her mind. > > - If anything, I would like PyCon to give more time to new and > emergent projects and less time to existing well established projects > that have their own conferences. Yet this discussion does not belong > here. We are one of those project that "almost" has its own > conference. Not including web2py in PyCon hurts PyCon more than web2py > since they exclude a large part of the community who may choose choose > not to attend or donate. I personally will try attend (family matter > permitting) and hope to see many of you there. > > - I believe that (although I may disagree with some of their decisions > and procedures) the PyCon organizers and the PSF board act in the best > interest of Python and they put a lot of effort and time in what they > do. > > - I would rather not continue this discussion since I do not see any > benefit from it. > > - I am a member of the Python Software Foundation so if you have > opinions or suggestions, you can email them to me and I will be happy > to convey them. > > - I thank you, Ovidio, for standing on the web2py side. > > Massimo > > > > > > On Dec 13, 10:17 am, Ovidio Marinho wrote: > > expalanation for me fault. > > > >Ovidio Marinho Falcao Neto > > Web Developer > > ovidio...@gmail.com > > ovidiomari...@itjp.net.br > > ITJP - itjp.net.br > >83 8826 9088 - Oi > >83 9334 0266 - Claro > > Brasil > > > > Apóio > > > > > > > > > > > > > > > > -- Forwarded message -- > > From: Jesse Noller > > Date: 2011/12/13 > > Subject: Re: [PyCon-Organizers] Web2py is Out Pycon2012 > > To: Ovidio Marinho > > > > Cc: pycon-organiz...@python.org > > > > Ovidio: > > > > Just to be clear; web2py is in no way "banned" from PyCon - neither in > the > > tutorial or the talk tracks. When tutorials are selected we have to take > > into account past popularity and performance. > > > > PyCon loses money on every attendee - we do this on purpose to keep costs > > low for attendees as a whole. This is why it's important that when > > selecting tutorials we keep an eye out for potential losses. If a > tutorial > > in the past did not reach a "break even" number of attendees, that fact > has > > to be accounted for when selecting tutorials in the future. > > > > We also select tutorials based on community feedback - we have data that > we > > consult from past conferences as well as surveys we perform to gauge the > > relative interest the community has in a given subject. > > > > Regular track talks are vetted just as hard - competition is tough > between > > selected talks, but budget issues do not come into play. Instead, talks > can > > focus on the much broader view of the community and all of its groups, > > tools and aspects. > > > > Once again, thank you for the feedback. I hope to see you in Santa Clara > in > > March. > > > > Jesse Noller > > > > On Tuesday, December 13, 2011 at 6:22 AM, Ovidio Marinho wrote: > > > > > A great honor to receive your e-mail, with t
Re: [web2py] generate multiple form from a query
Thanks for the tips Anthony... Here an other test I made : def bulk_update(): rows = db((db.lotns_lot_number.id == request.args(1))&\ (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)&\ (db[request.args(0)].sample_id == db.lotns_sample.sample_id)).select\ (db[request.args(0)].ALL, orderby=db.lotns_sample.sample_code) not_to_show = ['input_date', 'data_grade', 'valid', 'reviewed', \ 'reviewed_by', 'revision_date', 'revision_comment', 'approved', \ 'approval_date', 'approved_by', 'approval_comment', 'last_action_by', \ 'sdate', 'update_record', 'delete_record'] form = SQLFORM.factory(*[Field(f+'_%s'%r.id, default=r[f]) for r in rows for f in r if f not in not_to_show]) form.process(detect_record_change=True) if form.record_changed: redirect(URL(request.application,c=request.controller,f='bulk_update',args=(request.args(0),request.args(1 session.flash = T('form have changed between the time you edited and submitted it, please have a look on the data again') elif form.accepted: #for key,value in form.vars.items(): # db(db[request.args(0)].id==key[3:]).update(reviewed_by = 1) # HERE I NEED TO IMPROVE... session.flash = T('form accepted').capitalize() else: response.flash = T('please correct the form') return dict(form=form) What I would like to have that is not actually possible I think is a way to "detect_record_change" with SQLFORM.factory... Do you have any idea how I could achieve that? Thanks Richard On Mon, Dec 12, 2011 at 5:52 PM, Anthony wrote: > forms = [] >> flag = 0 >> for i in rows: >> > > Python tip -- instead of the above, try: > > for flag, i in enumerate(rows): > > >> forms.append(SQLFORM(db[**request.args(0)], >> i[request.args(0)].id)) >> > > It looks like your rows are actually the result of a multi-table join, so > you might need to use SQLFORM.factory -- see > http://web2py.com/book/default/chapter/07#One-form-for-multiple-tables. > > >> {{for i in range(0,len(forms)):}} >> {{=forms[i]}} >> > > Another Python tip: > > {{for form in forms:}} > {{=form}} > > > >> I am confuse and I am not sure if my controller can works independently >> with each form embeded into forms the way I wrote my controller function... >> What's the way you were telling me to do?? >> > > At this point, I'm a bit confused too. :-) Maybe consider putting each > form in a separate LOAD component -- see > http://web2py.com/book/default/chapter/13#Components. > >> >> PS.: Is there any way I can make a multiple lines update with SQLFORM or >> .grid or .smartgrid?? >> > > I don't think so. > > Anthony >
[web2py] smartgrid: events and callbacks downstream?
I am using smartgrid to generate some table and form interfaces to my database. Is there a way to use something like the process function with smartgrid to get callbacks? It's not clear to me how I can hook into the downstream click-generated events from the edit form, for instance. I just want to be able to hook some code into the event stream after the successul creation of the database object described by a row in the smart grid. I'm hoping there's a way, but if not, having that kind of event chaining would be really useful. Thanks, David
Re: [web2py] error gluon/sqlhtml.py?
> > message = error or T('%(nrows)s records found') % dict(nrows=nrows) > > > I think we cannot do the above (unless things have changed) > > T(..) gives us a LazyT object which cannot be interpolated as a string, > because o that we need to interpolate the string before passing it to T(..) > > For me the right is > T("a placeholder %(key)s" % dict(key=value) ) > > because for me this raises an error: > > T("a placeholder %(key)s") % dict(key=value) > > *TypeError: unsupported operand type(s) for %:* Hmm, the book says we can do that (as well as including the dict as a second argument to T): http://web2py.com/book/default/chapter/04#T-and-Internationalization. When I try it in the shell it works. Anthony > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > >
[web2py] Re: Redirecting to a URL, but with changed html
On Tuesday, December 13, 2011 2:09:31 PM UTC-5, peter wrote: > > def test(): > import urllib > url="http://127.0.0.1:8000/admin/default/site"; > f = urllib.urlopen(url) > s = f.read() > return s > > I have to login again even though I am logged in on my computer. So > the question is, can I somehow add the 'context' to s so that it > recognises that I am already logged in? > > I am using web2py's admin as an example, but the solution should work > for any website. > Are you saying you want to programmatically login to a website and then retrieve a particular page that requires a login on that site? Look into urllib2: http://docs.python.org/howto/urllib2.html. I think it's pretty easy if the site supports basic authentication, otherwise a little more complex (requires posting form data and managing cookies). Anthony
Re: [web2py] Re: Redirecting to a URL, but with changed html
On Dec 13, 2011, at 11:09 AM, peter wrote: > Here is a simple example of what I mean: > > If I type > > http://127.0.0.1:8000/admin/default/site > > at my browser when I am logged in, I get the installed applications > page. > > However if I do it by calling the test routine below > > > def test(): >import urllib >url="http://127.0.0.1:8000/admin/default/site"; >f = urllib.urlopen(url) >s = f.read() >return s > > I have to login again even though I am logged in on my computer. So > the question is, can I somehow add the 'context' to s so that it > recognises that I am already logged in? > > I am using web2py's admin as an example, but the solution should work > for any website. Generally speaking, you need to include a cookie with your request so that the server (web2py in this case) can associate the request with the proper session. I can't help you much with the coding details, but you might want to look at using urllib2 instead of urllib. The cookie you want is somewhere in request, I think.
Re: [web2py] error gluon/sqlhtml.py?
On Wed, Dec 7, 2011 at 12:40 PM, Martin Weissenboeck wrote: > message = error or T('%(nrows)s records found') % dict(nrows=nrows) I think we cannot do the above (unless things have changed) T(..) gives us a LazyT object which cannot be interpolated as a string, because o that we need to interpolate the string before passing it to T(..) For me the right is T("a placeholder %(key)s" % dict(key=value) ) because for me this raises an error: T("a placeholder %(key)s") % dict(key=value) *TypeError: unsupported operand type(s) for %:* -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: How to save the 'current' object to database?
Would os.path.abspath(request.folder) work as well? It works on Windows (actually, request.folder itself appears to be the absolute path on Windows). Anthony On Tuesday, December 13, 2011 2:04:09 PM UTC-5, Ross Peoples wrote: > > I've never used GAE before, but you would normally get the absolute path > to web2py using something like this: > > import os > from gluon.settings import global_settings > > web2py_path = os.path.join(global_settings.applications_parent, > request.folder) > > Hope that helps. >
[web2py] Re: Fwd: [PyCon-Organizers] Web2py is Out Pycon2012
Hello Ovidio, I understand you and others are not happy with not having a web2py tutorial at Pycon. I am too. Nevertheless, I want to clarify a few things. - The main reason I posted the list of tutorials was to inform you about the excellent tutorials that will be offered. The fact that there will not be a web2py tutorial should not overshadow the other good things about this conference. - Steve is right that last year the web2py tutorials was not well attended. Perhaps that was a motivation for the rejection? I have not yet received an official letter about the motivation for the rejection and I will share that this group. Whatever the reason, I trust the people involved in this decision and I trust the explanation will be satisfactory. - Of course I am a bit upset that the tutorial was rejected but this fact is not that that important. - I am still hoping we will get a web2py talk at PyCon since that never happened but now we need it less than we needed three hears ago. At that time it was important for us to outreach the python community and tell them about our cool new project. Today everybody knows about it and everybody had made up his/her mind. - If anything, I would like PyCon to give more time to new and emergent projects and less time to existing well established projects that have their own conferences. Yet this discussion does not belong here. We are one of those project that "almost" has its own conference. Not including web2py in PyCon hurts PyCon more than web2py since they exclude a large part of the community who may choose choose not to attend or donate. I personally will try attend (family matter permitting) and hope to see many of you there. - I believe that (although I may disagree with some of their decisions and procedures) the PyCon organizers and the PSF board act in the best interest of Python and they put a lot of effort and time in what they do. - I would rather not continue this discussion since I do not see any benefit from it. - I am a member of the Python Software Foundation so if you have opinions or suggestions, you can email them to me and I will be happy to convey them. - I thank you, Ovidio, for standing on the web2py side. Massimo On Dec 13, 10:17 am, Ovidio Marinho wrote: > expalanation for me fault. > > Ovidio Marinho Falcao Neto > Web Developer > ovidio...@gmail.com > ovidiomari...@itjp.net.br > ITJP - itjp.net.br > 83 8826 9088 - Oi > 83 9334 0266 - Claro > Brasil > > Apóio > > > > > > > > -- Forwarded message -- > From: Jesse Noller > Date: 2011/12/13 > Subject: Re: [PyCon-Organizers] Web2py is Out Pycon2012 > To: Ovidio Marinho > > Cc: pycon-organiz...@python.org > > Ovidio: > > Just to be clear; web2py is in no way "banned" from PyCon - neither in the > tutorial or the talk tracks. When tutorials are selected we have to take > into account past popularity and performance. > > PyCon loses money on every attendee - we do this on purpose to keep costs > low for attendees as a whole. This is why it's important that when > selecting tutorials we keep an eye out for potential losses. If a tutorial > in the past did not reach a "break even" number of attendees, that fact has > to be accounted for when selecting tutorials in the future. > > We also select tutorials based on community feedback - we have data that we > consult from past conferences as well as surveys we perform to gauge the > relative interest the community has in a given subject. > > Regular track talks are vetted just as hard - competition is tough between > selected talks, but budget issues do not come into play. Instead, talks can > focus on the much broader view of the community and all of its groups, > tools and aspects. > > Once again, thank you for the feedback. I hope to see you in Santa Clara in > March. > > Jesse Noller > > On Tuesday, December 13, 2011 at 6:22 AM, Ovidio Marinho wrote: > > > A great honor to receive your e-mail, with their explanation, and as said > beforePyCon is the most important event for the Python community. Somehow > we cooperate with it or creating something new or reusing things that > already exist in the Python world. We are so upset and not understand how a > tool is featured in ayear for a single performance in 2010, this can be > banned from the big event, things evolve and in the case of web2py effort > has been an evolution for the better.But I understand the hard work of > selection because I'm sure that much good may have been left out even > web2py. But I would like presentations on the Agenda ofthe Committee to > this reservation of jobs that they could not join the Pycon2012, I hope > that the event is more a spectacle to the world of Python. > > > Ovidio Marinho Falcao Neto > > Web Developer > > ovidio...@gmail.com (mailto:ovidio...@gmail.com) > > ovidiomari...@itjp.net.b
[web2py] Re: Redirecting to a URL, but with changed html
Here is a simple example of what I mean: If I type http://127.0.0.1:8000/admin/default/site at my browser when I am logged in, I get the installed applications page. However if I do it by calling the test routine below def test(): import urllib url="http://127.0.0.1:8000/admin/default/site"; f = urllib.urlopen(url) s = f.read() return s I have to login again even though I am logged in on my computer. So the question is, can I somehow add the 'context' to s so that it recognises that I am already logged in? I am using web2py's admin as an example, but the solution should work for any website. Thanks Peter On Dec 13, 1:51 pm, Anthony wrote: > On Tuesday, December 13, 2011 4:15:22 AM UTC-5, peter wrote: > > > Thanks for your answers. I guess editing the html and replacing the > > relative URLs with absolute ones is not too bad. The problem I am left > > with is this: > > Can one 'call' a URL from web2py as if the URL were called from the > > users browser?, but capture the html result? > > Not sure what you mean. Are you talking about something other > than urllib.urlopen(url)?
[web2py] Re: How to save the 'current' object to database?
I've never used GAE before, but you would normally get the absolute path to web2py using something like this: import os from gluon.settings import global_settings web2py_path = os.path.join(global_settings.applications_parent, request.folder) Hope that helps.
[web2py] Re: migrate passwords from phpBB
On Tuesday, December 13, 2011 10:50:15 AM UTC-5, greenguerilla wrote: > > > Hi, > > I have also been trying to migrate existing user accounts from phpbb > to a web2py system. > The below solution works well for registering new users, however in > order to successfully validate these passwords during the login > process > I made some changes to the framework itself: > > I have added into gluon/tools.py at line 1753 (latest stable version > of web2py) at the end of the 'user is > in db' clause of the login method of the Auth class. > > if self.phpbb_checkpw(temp_user[passfield], request.vars[passfield]): > user = temp_user > > This phpbb_checkpw function returns True or False depending on whether > or not the plaintext passwords (from form) matches the stored hash. > This is an awkward way to do things and I am wondering if there are > any hooks I can avail of in order to validate a user entered plaintext > password against the stored hash and thus keep my custom code outside > of the framework? > As suggested earlier, can you just create a custom validator for the password field that hashes it, so it will match the stored hash? Another option is using auth.settings.login_onvalidation, which is a function that takes the login form (and can manipulate the form vars) right after validation (but before the rest of the login logic). Anthony >
[web2py] Fwd: [PyCon-Organizers] Web2py is Out Pycon2012
expalanation for me fault. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil Apóio -- Forwarded message -- From: Jesse Noller Date: 2011/12/13 Subject: Re: [PyCon-Organizers] Web2py is Out Pycon2012 To: Ovidio Marinho Cc: pycon-organiz...@python.org Ovidio: Just to be clear; web2py is in no way "banned" from PyCon - neither in the tutorial or the talk tracks. When tutorials are selected we have to take into account past popularity and performance. PyCon loses money on every attendee - we do this on purpose to keep costs low for attendees as a whole. This is why it's important that when selecting tutorials we keep an eye out for potential losses. If a tutorial in the past did not reach a "break even" number of attendees, that fact has to be accounted for when selecting tutorials in the future. We also select tutorials based on community feedback - we have data that we consult from past conferences as well as surveys we perform to gauge the relative interest the community has in a given subject. Regular track talks are vetted just as hard - competition is tough between selected talks, but budget issues do not come into play. Instead, talks can focus on the much broader view of the community and all of its groups, tools and aspects. Once again, thank you for the feedback. I hope to see you in Santa Clara in March. Jesse Noller On Tuesday, December 13, 2011 at 6:22 AM, Ovidio Marinho wrote: > A great honor to receive your e-mail, with their explanation, and as said beforePyCon is the most important event for the Python community. Somehow we cooperate with it or creating something new or reusing things that already exist in the Python world. We are so upset and not understand how a tool is featured in ayear for a single performance in 2010, this can be banned from the big event, things evolve and in the case of web2py effort has been an evolution for the better.But I understand the hard work of selection because I'm sure that much good may have been left out even web2py. But I would like presentations on the Agenda ofthe Committee to this reservation of jobs that they could not join the Pycon2012, I hope that the event is more a spectacle to the world of Python. > > > > > > > > > > > > Ovidio Marinho Falcao Neto > Web Developer > ovidio...@gmail.com (mailto:ovidio...@gmail.com) > ovidiomari...@itjp.net.br (mailto:ovidiomari...@itjp.net.br) > ITJP - itjp.net.br (http://itjp.net.br) > 83 8826 9088 - Oi > 83 9334 0266 - Claro > Brasil > > Apóio > > > > 2011/12/12 Jesse Noller mailto:jnol...@gmail.com)> > > Hello Mr. Marinho; > > > > I'm Jesse Noller - chair of the PyCon 2012 and 2013 conferences. First, I'd like to thank you for your feedback - the entire team appreciates hearing from the community about the the decisions we make. PyCon is first, and foremost a conference community, managed by volunteers and community members. > > > > As for the matter you mention - the lack of a web2py tutorial this year is not a slight against web2py. I understand that it has been gaining popularity, and that it has a vociferous and robust community. In the case of PyCon - we did have a web2py tutorial last year (2010) and it was not well attended. That, in and of itself is not a terrible thing - as we have all seen web2py grow in the last year. > > > > However, coupled with the fact we had over 80 tutorials competing for spots on a schedule that only allows us to have a fraction of that number on it meant that competition was tight between the tutorials. The team did their best striking a balance between interesting subjects, and subject that are of mass appeal and usefulness for a majority of the tutorial students. > > > > As you know, tutorials are paid-for by the students - each one costs 150$ to attend - and therefore we aim to target tutorials to the widest parts of the Python community and ecosystem. > > > > I understand Massimo - and other web2py users are upset: I saw the email sent to the web2py users list by Massimo [1]. Please understand that we do our best not to focus on a single framework, or library, but rather a wide cross section of the Python community as a whole. > > > > I encourage you to keep in mind that the main conference talk schedule is still pending - this represents some 90+ talks over three days on a large number of topics. > > > > If you have any questions, feel free to ask. > > > > Jesse Noller > > Chair, PyCon 2012 > > > > [1] http://groups.google.com/group/web2py/browse_thread/thread/eec9815ea024d208# > > > > > > On Monday, December 12, 2011 at 5:34 PM, Ovidio Marinho wrote: > > > > > > > > Gentlemen, > > > The world list web2py We're wondering why the Framework be out of the cycle of tutorials. The web2py framew
[web2py] Re: How to save the 'current' object to database?
It is related to deferred.defer in GAE: https://groups.google.com/forum/#!topic/web2py/Fp7B477Db8c I made it work but I am using 'current' object to get request/response/mail. It works but sometimes does not. It seems deferred library loses the path of web2py sometimes. I am investigating how to make the path always available when deferred is executed. The other way is to send the 'current' object but it is not practical. Deferred accepts parameters but not objects. 'current' cannot be serialized (pickled) so it cannot be send as a parameter. The other option remains is to store the 'current' temporarily in a database blob related to the user_id, and pass thee user_id as a parameter, then when deferred function is executed to get back the blob 'current' by user_id. But 'current' cannot be serialized to be stored in a blob. So this is a brainstorming and obviously does not works. The only other option is to make the path to web2py available to the deferred function, which is tricky.
[web2py] Re: migrate passwords from phpBB
Hi, I have also been trying to migrate existing user accounts from phpbb to a web2py system. The below solution works well for registering new users, however in order to successfully validate these passwords during the login process I made some changes to the framework itself: I have added into gluon/tools.py at line 1753 (latest stable version of web2py) at the end of the 'user is in db' clause of the login method of the Auth class. if self.phpbb_checkpw(temp_user[passfield], request.vars[passfield]): user = temp_user This phpbb_checkpw function returns True or False depending on whether or not the plaintext passwords (from form) matches the stored hash. This is an awkward way to do things and I am wondering if there are any hooks I can avail of in order to validate a user entered plaintext password against the stored hash and thus keep my custom code outside of the framework? Thanks! John On Dec 12, 3:24 pm, Massimo Di Pierro wrote: > yes. > > On Dec 12, 5:56 am, thodoris wrote: > > > > > > > I am trying to migrate users fromphpBBwhose passwords have been encrypted > > with php_pass. There is a python module that mimics the functionality of > > php_pass and i am wondering what is the best way to override the default > > encryption of web2py. > > > Is it sufficient to override CRYPT() using something like: > > > db.auth_user.password.requires = MyCrypt() > > > Thanks
[web2py] Re: web2py 1.99.3 is OUT
Ok, sounds good. I'll convert the code to use hidden argument explained in Chapter 7. Thanks for the explanation, Anthony.
[web2py] Re: How to save the 'current' object to database?
I don't think you can because "current" is a threaded object. It contains 3 things: request, response, session. You could probably serialize much of the data contained in those three objects, however, this will be difficult because they contain functions. Web2py does a lot of this when it generates an error ticket. So maybe you could look into how those tickets are generated. Also, I have to ask: Why would you want to do this? Web2py does it to provide debugging information when something bad happens and that's about the only reason this type of thing should be done. If there is something else you are trying to accomplish, maybe we can find a better way.
[web2py] Re: Two questions: 1. empty SQLFORM.grid 2. Represent question
Johann, Does grid work if you comment out that left join? On Dec 13, 5:37 am, Johann Spies wrote: > Please help me to understand the behaviour of the following controller. It > receives a name of a table and that table's title-field from a form. > > def lys_vermiste_titels(): > """ > tt = title-field > tabel = tabelname > """ > tabel = request.vars.tabel > tt = request.vars.tt > db[tabel].id.represents = lambda id, row: A(T('check'), > _href = URL(r = request, c = 'default', > f = 'hanteer_vermiste_titels', > vars = dict(id = str(id), tabel = > tabel, tt = tt))) > > query = db.akb_articles.title==None > fields = [db[tabel].id, db[tabel][tt]] > # tb = SQLFORM.grid(query, fields = fields, > # left = db.akb_articles.on(db.akb_articles.ltitle > == db[tabel].ltitle), > # editable = False, searchable = False, create = > False, > # deletable = False) > tb = SQLTABLE(db(query).select( > db[tabel].id, db[tabel][tt], > left = db.akb_articles.on(db.akb_articles.ltitle == > db[tabel].ltitle)), truncate = 150) > lengte = len(tb) > if lengte: > print tb > opskrif = H2(T("Titles in %s which are not in AKB") % tabel) > else: > opskrif = H2(T('All the article titles in %s are in AKB') % tabel) > tb = H3(P(T('No absent titles.'))) > return dict(vorm = tb, opskrif = opskrif) > > 1. If I use the SQLFORM.grid (commented out in this example) in this case: > the fields are all empty although the number of records for the query is > the same as in the second case where I use tb = SQLTABLE which presents the > expected data. Why would this be? > 2. My .represent definition has no effect. I get the bare id numbers in > the view. Why? > > Regards > Johann > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3)
[web2py] Re: Redirecting to a URL, but with changed html
On Tuesday, December 13, 2011 4:15:22 AM UTC-5, peter wrote: > > Thanks for your answers. I guess editing the html and replacing the > relative URLs with absolute ones is not too bad. The problem I am left > with is this: > Can one 'call' a URL from web2py as if the URL were called from the > users browser?, but capture the html result? Not sure what you mean. Are you talking about something other than urllib.urlopen(url)?
[web2py] Re: Two questions: 1. empty SQLFORM.grid 2. Represent question
> > 2. My .represent definition has no effect. I get the bare id numbers in > the view. Why? > db[tabel].id.represents should be: db[tabel].id.represent
[web2py] matplotlib plugin
using matplotlib plugin there http://web2py.com/plugins/static/web2py.plugin.matplotlib.w2p i get error RuntimeError: Failed to create /var/www/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data (it is on ubuntu+apache) (how) should i change the line os.environ['MPLCONfigureDIR'] = tempfile.mkdtemp() or which directory shoul i change (probably permissions) andrej
[web2py] error downloading 1.99.3
I'm not sure if it's my crappy mobile Internet connection or something else but I couldn't seem to download a good copy of the version 1.99.3. When testing the zip file, I get this error: "error: invalid compressed data to inflate web2py/applications/examples/static/artwork.tar.gz". I already tried this three times today, without any success, and the same error.
[web2py] Two questions: 1. empty SQLFORM.grid 2. Represent question
Please help me to understand the behaviour of the following controller. It receives a name of a table and that table's title-field from a form. def lys_vermiste_titels(): """ tt = title-field tabel = tabelname """ tabel = request.vars.tabel tt = request.vars.tt db[tabel].id.represents = lambda id, row: A(T('check'), _href = URL(r = request, c = 'default', f = 'hanteer_vermiste_titels', vars = dict(id = str(id), tabel = tabel, tt = tt))) query = db.akb_articles.title==None fields = [db[tabel].id, db[tabel][tt]] # tb = SQLFORM.grid(query, fields = fields, #left = db.akb_articles.on(db.akb_articles.ltitle == db[tabel].ltitle), #editable = False, searchable = False, create = False, #deletable = False) tb = SQLTABLE(db(query).select( db[tabel].id, db[tabel][tt], left = db.akb_articles.on(db.akb_articles.ltitle == db[tabel].ltitle)), truncate = 150) lengte = len(tb) if lengte: print tb opskrif = H2(T("Titles in %s which are not in AKB") % tabel) else: opskrif = H2(T('All the article titles in %s are in AKB') % tabel) tb = H3(P(T('No absent titles.'))) return dict(vorm = tb, opskrif = opskrif) 1. If I use the SQLFORM.grid (commented out in this example) in this case: the fields are all empty although the number of records for the query is the same as in the second case where I use tb = SQLTABLE which presents the expected data. Why would this be? 2. My .represent definition has no effect. I get the bare id numbers in the view. Why? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: How to save the 'current' object to database?
or how to serialize it?
[web2py] Re: Redirecting to a URL, but with changed html
Thanks for your answers. I guess editing the html and replacing the relative URLs with absolute ones is not too bad. The problem I am left with is this: Can one 'call' a URL from web2py as if the URL were called from the users browser?, but capture the html result? I imagine the answer to this question is no you cannot, because if you could it would open up a Pandora's box wrt to security etc. Peter On Dec 13, 1:05 am, Constantine Vasil wrote: > yes, redirect is little tricky ;) my solution is for ajax.
[web2py] How to save the 'current' object to database?
How to save the 'current' object to database?
Re: [web2py] Project Idea
+1 if it works it's a developer's dream! mic 2011/12/12 Massimo Di Pierro : > We could use this > > https://github.com/amoffat/Inspect-Shell/blob/master/inspect_shell.py > > together with a modified shell (from admin/controllers/shell.py) to > give a web based presence to any running python script.
[web2py] Re: CMS idea
keep in mind that CSS can import other CSS sheets and define background-image's. And other resources may be loaded dynamically with JavaScript. So will take some effort to work for non-trivial cases.