[web2py] Either this is a bug ... or I am!
#Created a new application 'charges' which utilizes MySQL Server with the following: #At the model file (produce_files.py): db.define_table('owner', Field('name','string'), Field('address','string'), format='%(name)s' ) db.define_table('dog', Field('dogname','string',length=15,label='Onoma Skylou'), Field('owner',db.owner, label='Idioktitis',readable=False), format='%(dogname)s' ) db.dog.id.readable = False #At the controller file (test.py): from gluon import * @auth.requires_login() def testStarter(): This is to explore SQLFORM.smartgrid capabilities grid = SQLFORM.smartgrid(db.owner,fields=[db.owner.name],linked_tables=['dog']) return locals() #At the view file (test/appStarter.py): {{extend 'layout.html'}} {{=grid}} I use the appadmin of the application to populate the 'owner' table with an owner, as well as the 'dog' table with a dog for that owner. Now, when I visit http://127.0.0.1/charges/test/testStarter.html I get to see the 'owner' table in the grid, as well as the 'dogs' link. Everything seems ok, BUT: when I click on the 'dogs' link for the sole owner I have already inserted, there is no dog there. The header of the fields for the dog grid is not shown, and the header for the 'owner' table is shown instead. Nevertheless, the application reports correctly that 1 dog record has been found... If I alter the controller like so: from gluon import * @auth.requires_login() def testStarter(): This is to explore SQLFORM.smartgrid capabilities grid = SQLFORM.smartgrid(db.owner,linked_tables=['dog']) return locals() that is, if I remove the fields=[db.owner.name] argument, everything (both owner and dog grids) works ok! ?? Thank you all in advance Tom. P.S.: OS: Windows XP professional, SP3 web2py version: 2.4.6-stable+timestamp.2013.04.06.17.37.38 (Running on Rocket 1.2.6) MySQL version: 5.1.41 from xampp 2.5.8 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Either this is a bug ... or I am!
Please remove this post I have already posted it Τη Παρασκευή, 12 Απριλίου 2013 9:36:26 π.μ. UTC+3, ο χρήστης t_gle...@yahoo.com έγραψε: #Created a new application 'charges' which utilizes MySQL Server with the following: #At the model file (produce_files.py): db.define_table('owner', Field('name','string'), Field('address','string'), format='%(name)s' ) db.define_table('dog', Field('dogname','string',length=15,label='Onoma Skylou'), Field('owner',db.owner, label='Idioktitis',readable=False), format='%(dogname)s' ) db.dog.id.readable = False #At the controller file (test.py): from gluon import * @auth.requires_login() def testStarter(): This is to explore SQLFORM.smartgrid capabilities grid = SQLFORM.smartgrid(db.owner,fields=[db.owner.name ],linked_tables=['dog']) return locals() #At the view file (test/appStarter.py): {{extend 'layout.html'}} {{=grid}} I use the appadmin of the application to populate the 'owner' table with an owner, as well as the 'dog' table with a dog for that owner. Now, when I visit http://127.0.0.1/charges/test/testStarter.html I get to see the 'owner' table in the grid, as well as the 'dogs' link. Everything seems ok, BUT: when I click on the 'dogs' link for the sole owner I have already inserted, there is no dog there. The header of the fields for the dog grid is not shown, and the header for the 'owner' table is shown instead. Nevertheless, the application reports correctly that 1 dog record has been found... If I alter the controller like so: from gluon import * @auth.requires_login() def testStarter(): This is to explore SQLFORM.smartgrid capabilities grid = SQLFORM.smartgrid(db.owner,linked_tables=['dog']) return locals() that is, if I remove the fields=[db.owner.name] argument, everything (both owner and dog grids) works ok! ?? Thank you all in advance Tom. P.S.: OS: Windows XP professional, SP3 web2py version: 2.4.6-stable+timestamp.2013.04.06.17.37.38 (Running on Rocket 1.2.6) MySQL version: 5.1.41 from xampp 2.5.8 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: upgrading appengine has broken web2py
If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: This must be a bug (or I am one!!!)
Anthony, you are right! I put fields=[db.owner.name,db.dog.dogname] and works OK Thank you !!! I might be a bug after all... Tom :) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Pyfpdf - How to fit long data descriptions in the table with proper text wrapping in rows/columns
Hi Ovidio, Thanks for this great resource. I have a few questions - Can we pass queries to this plugin? Can we select fields that we want for reporting? The wrapping thing works well with this plugin. Rahul. On Thursday, April 11, 2013 4:47:44 PM UTC+5:30, Ovidio Marinho wrote: PDF paths are hard, so we tried some practical solutions. See this appreport. https://github.com/lucasdavila/web2py-appreport After long searching found something that can permanently solve these problems that fpdf, pisa, geraldo bring us in doing pdf. I think you, as I found the solution. {{}}'s Ovidio Marinho Falcao Neto Web Developer ovid...@gmail.com javascript: 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/11 Rahul rahul@gmail.com javascript: Hi All, I am having a few problems with my code to generate proper PDF reports. Basically I have the same problems with reportlab so i am giving pyfpdf a try - *Problems:* 1. Long text (example *description *in below code) does not fit in the boundaries. It does not wrap to next line it just exceeds the page width - please see sample report attached. 2. I cant make zebra strips (alternate line/row color) to work properly here 3. The HTML output does not work (I have the view rep_open_issues.html - no data) [Live Demo for HTML pyfpdf does not work Ex - this url - http://www.web2py.com.ar/fpdf/default/listing ] Throws error - *invalid view (default/listing.html)* Here is my code - def rep_open_issues(): response.title = Open Issues head = THEAD(TR(TH(Ticket,_width=15%), TH(Sub Cateogry,_width=20%), TH(Severity,_width=15%), TH(Description,_width=50%), _bgcolor=#A0A0A0)) foot = TFOOT(TR(TH(Fair Price - Good Day,_width=100%), _bgcolor=#E0E0E0)) querysql = ( Select ticket_no, sub_category, severity, description from issues where status='Open' and created_by=' + logged_in_user ) try: allissues = db.executesql(querysql) except: pass rows = [] for issue in allissues: mycounter = [] mycounter.append(issue) i = len(mycounter) col = i % 2 and #F0F0F0 or #FF rows.append(issue) # make the table object body = TBODY(*rows) table = TABLE(*[head,foot, body], _border=1, _align=center, _width=100%) if request.extension==pdf: from gluon.contrib.pyfpdf import FPDF, HTMLMixin # define our FPDF class (move to modules if it is reused frequently) class MyFPDF(FPDF, HTMLMixin): def header(self): self.set_font('Arial','B',15) self.cell(0,10, response.title ,1,0,'C') self.ln(20) def footer(self): self.set_y(-15) self.set_font('Arial','I',8) txt = 'Page %s of %s' % (self.page_no(), self.alias_nb_pages()) self.cell(0,10,txt,0,0,'C') pdf=MyFPDF() # first page: pdf.add_page() pdf.write_html(str(XML(table, sanitize=False))) response.headers['Content-Type']='application/pdf' return pdf.output(dest='S') else: # normal html view: return dict(table=table) Not much is changed here- I know, i may be missing a few tricks. Please help me fill the same As a Ref - I checked this thread [Re: How to Generate the effective report by using web2py] in google groups but without much resolution. Please suggest. Thanks Rahul -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: some features I implemented
Login is an email, and got obfuscated.It is tester at the domain example.com: tester (a) example.com El viernes, 12 de abril de 2013 01:17:21 UTC+2, Anthony escribió: I'm getting an Invalid Login error with the login you provided. On Thursday, April 11, 2013 5:58:29 PM UTC-4, pa...@cancamusa.net wrote: Hello: I've written an application for database management with some features that might interest you: - RTable builds a kind of spreadsheet from any table. The columns are html input for fields of type string or number, selects for references or when the options are limited, and so on. There is also RSheet that is useful for relations of the type to each product and person, assign the quantity that the person has ordered of that product: it places products on the rows, person on the column, etcetera. Both are navigable with keyboard, and support paste from spreadsheet or csv, to some extent. They both admit parameters, which means some of the table fields have prescribed values. They are taylored to my needs, and I'd definitely call that work in progress. - The form for introducing new elements has links to introduce new fields of referenced tables. For example, I want to introduce a person, but her country is not in the list. I click the link country, fill the form for a new country, then I'm redirected to the form for a new person, but the field country is filled with the country I just introduced. This can be iterated as many times as needed. - Searching is derived from smartgrid, but extends smart_query for queries with parenthesis and joins, provides drop menus for joins, a menu to group results and allows to store and recall popular queries. The results of the query are displayed as a jquery fixheadertable, and can be downloaded as a pretty_csv in which references are not displayed as numbers, but with the table _format attribute. - It has a file manager that I got from the web2py appliance: https://github.com/mdipierro/web2py-appliances/tree/master/FileManager from the corefive file manager. I updated some javascript files to newer versions and added functionality to unzip zipped files, to save time when uploading many files. - plugin_wiki has a super-simple html5 video widget. - All the above, however, will crash if you ask for big data sets, there is no check for size of results, for example. The app that I adjoin (AnotherAdmin) shows most of the above, except for: - RSheet - RTable.factory - RTable with parameters I'll soon give an example for those, I wrote them for a different application. You can still read the code if you are curious. Everything in AnotherAdmin works with any database (except for some known bugs I'm fond of), so you should be able to upload it and change only the file db.py. The current example is in Spanish, hope you don't mind. You can try that at: https://rabia.mat.uam.es/AnotherAdmin/ with login: tes...@example.com javascript: testeramI Does any of the above interest you? Do you have suggestions for improvement? Thanks for your attention -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: upgrading appengine has broken web2py
actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\applications\init\models\db.py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: upgrading appengine has broken web2py
has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_gae: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\applications\init\models\db.py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: upgrading appengine has broken web2py
Removing the line from gluon.contrib.gql import * removed the error and allows my app to launch. I next run into this error: File F:\wp\TestEnvoy\web2py\gluon\main.py, line 555, in wsgibase session._try_store_in_db(request, response) File F:\wp\TestEnvoy\web2py\gluon\globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 256, in insert id = self._create_id() File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' One for me to investigate. On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote: has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_gae: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\applications\init\models\db.py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: upgrading appengine has broken web2py
Also in my db.py under if request.env.web2py_runtime_gae: I have: from gluon.contrib.gae_memcache import MemcacheClient from gluon.contrib.memdb import MEMDB cache.memcache = MemcacheClient(request) cache.ram = cache.disk = cache.memcache session.connect(request, response, MEMDB(cache.memcache)) Has this approach become out of date? On Friday, 12 April 2013 11:21:10 UTC+1, Carl wrote: Removing the line from gluon.contrib.gql import * removed the error and allows my app to launch. I next run into this error: File F:\wp\TestEnvoy\web2py\gluon\main.py, line 555, in wsgibase session._try_store_in_db(request, response) File F:\wp\TestEnvoy\web2py\gluon\globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 256, in insert id = self._create_id() File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' One for me to investigate. On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote: has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_gae: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\applications\init\models\db.py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] gmaps: ugly rendering
Hi all: I'm testing gmaps.js with the same code Omi published here: http://ochiba77.blogspot.com.es/2012/06/how-to-use-gmapsjs-on-web2py.html But there is a problem when the map is redendered: the slider is broken and when clicking in a mark the contents of the frame are not well diplayed too. The markers are shown in the right way, zoom or moving works. It's a very annoying problem. Any idea what can be happening? Thanks in advance -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: some features I implemented
El viernes, 12 de abril de 2013 01:51:33 UTC+2, Alan Etkin escribió: RTable builds a kind of spreadsheet from any table. The columns are html input for fields of type string or number, selects for references or when the options are limited, and so on. Unless I'm missing something, that's exactly what web2py/contrib/spreadsheet.py does. It seems that some web2py features are not so visible/documented as others and it results in the same functionality being reimplemented unnecessarily. I did know about contrib/spreadsheet, but I missed that it can work with a Table. I think RTable has quite some funcionatlity not present in contrib/spreadsheet. In particular, I cannot use it for my two latest apps. But hell, yes! it would have been great to know that. I'd have started from there instead if strating from scratch. If you think it can be helpful for other applications, consider converting it to a plugin, so it can be ported to any app instalation. Ho do I know if it's useful for other people, other than asking here?. I have some time that I'd love to use to make the improvements more useful, but it's limited. I'd work in those features that spark more interest. For example, I could rebuild the file manager plugin, with the addition for zip files, and update to the latest version of corefive FileManager. Is that more useful than a RTable plugin? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: routes in windows service not working??
possibly another reason to use nssm on windows -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] request.env.http_referrer
Hi, i am using request.env.http_referrer, and i always get None, is there something i did wrong? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: request.env.http_referrer
I have a typo :(, request.env.http_referer works. On Friday, April 12, 2013 1:27:10 PM UTC+2, Domagoj Kovač wrote: Hi, i am using request.env.http_referrer, and i always get None, is there something i did wrong? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
Forgive my lack of knowledge and experience with nssm but how would it help in this situation? On Apr 12, 2013 7:09 AM, Tim Richardson t...@growthpath.com.au wrote: possibly another reason to use nssm on windows -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/oWmanNSKxdc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
from web2py's standpoint, having someone else (the nssm process) to care for service integration is more straightforward, i.e. it runs exactly as if it was launched normally. Of course winservice.py can be patched and fixed etc etc etc but either someone takes care of testing it under every Windows OS, for every web2py release, for every web2py feature, or it will remain as something that sometimes work, sometimes doesn't. Given that for each job there's a best tool, and that the best tool for this job is: - free - available - requires no absolute time to set up I'd go for nssm all the times (and that's why a slice was posted at http://www.web2pyslices.com/slice/show/1614/nssm-webserver-and-scheduler-as-services-in-windows-oses on the matter) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
Interesting. However why call nssm the best way to do this but still ship the winservice.py file? If nssm was truly *the* way to do this then I would think the book (which was just updated) would have removed the section about the winservice.py and only talk about nssm or at least make an effort to promote nssm over the native script. This doesn't make a whole lot of sense from the standpoint of having everything in the box with web2py. As far as support goes, Massimo is intent on supporting ie 7 for web2py's editor because some people still use it. So supporting new/different versions of windows is already being done not to mention the method for setting up a system service has hardly changed since XP (12+years) Regardless I already have a 2 line patch that ill submit to fix this issue once the site is back up. from web2py's standpoint, having someone else (the nssm process) to care for service integration is more straightforward, i.e. it runs exactly as if it was launched normally. Of course winservice.py can be patched and fixed etc etc etc but either someone takes care of testing it under every Windows OS, for every web2py release, for every web2py feature, or it will remain as something that sometimes work, sometimes doesn't. Given that for each job there's a best tool, and that the best tool for this job is: - free - available - requires no absolute time to set up I'd go for nssm all the times (and that's why a slice was posted at http://www.web2pyslices.com/slice/show/1614/nssm-webserver-and-scheduler-as-services-in-windows-oseson the matter) -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/oWmanNSKxdc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: some features I implemented
The problem is that the last character of the password appears to be a lowercase l, when in fact it is an uppercase I (which appear the same in the Google Groups font). Thanks. Anthony On Friday, April 12, 2013 5:30:32 AM UTC-4, pa...@cancamusa.net wrote: Login is an email, and got obfuscated.It is tester at the domain example.com: tester (a) example.com El viernes, 12 de abril de 2013 01:17:21 UTC+2, Anthony escribió: I'm getting an Invalid Login error with the login you provided. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
However why call nssm the best way to do this but still ship the winservice.py file? Because things gets discussed and possibly overlooked. There are a few open issues with the way web2py handles services and absolutely no-one willing to take responsibility to test it more than the current once on a while. A full coverage in fact has never been tested (and probably never worked). That being said, sometimes it works without hiccups. The batteries included predicament stands as long as your implementation works, all the times. A very few users are using it (or a very few users just needed once and forgot it), and when this pops up once in a while, a patch is threw in and then the user disappears. The moment he needs to update web2py and finds that his previous patch didn't really solve the problem, there's another iteration on the matter. If nssm was truly *the* way to do this then I would think the book (which was just updated) would have removed the section about the winservice.py and only talk about nssm or at least make an effort to promote nssm over the native script. I would have done it and proposed in the past, but I'm not the boss and usually there are a few POVs to consider. This doesn't make a whole lot of sense from the standpoint of having everything in the box with web2py. On the other end, doesn't make real sense to continue supporting something that is clearly not tested and with a very little userbase (but with a lot of people complaining for it the moment they realize they fall into the sometime doesn't category). As far as support goes, Massimo is intent on supporting ie 7 for web2py's editor because some people still use it. So supporting new/different versions of windows is already being done not to mention the method for setting up a system service has hardly changed since XP (12+years) same as before. My POV is more or less if you have only IE7 as a browser, use notepad given that IE7 is currently being replaced in enterprises too (and is very well below the 5% on the browser's share). In any case, it's one thing to make a web page compatible with IE6(7,8,9,10) and is another making web2py hooking up into XP,Vista,Seven,8,2003,2008 (32 and 64 bits) service managers, with all the options working ok, with source and binary distributions, for python2.5, 2.6, 2.7 (someone with pypy necessities could come up as well) and have a proof of it (i.e. not saying this should work but this works). If you want it the way it is, i.e. sometime works, sometime doesn't, by all means continue to use it and send a patch every time it breaks, but please take into consideration that ditching it and using nssm will save you, angry users and developers a lot of headaches. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How do I combine @auth.requires_signature with @auth.requires_membership
Hello, I am relatively new to web2py. I think it's terrific, but I am still learning. Hopefully I will become expert enough to contribute answers:-) For now, despite research, I am still unclear on the use of the @auth decorators, and am seeking advice, please? I have built an application for multiple departments to use. Each department has 3 levels of user: 'User', 'Approver' and 'Admin'. Each level of user gets a different menu and accesses only function()s that they are authorized to use. The records for each department are to be kept totally separate (and invisible) from anyone in a different department (for security). I have built a sort of multi-tenant application, where users can add and edit records, but 1) they can ONLY access records for their department and 2) they can ONLY access function()s for their Level. A) To control access to the records, I have included a department field in each table and a department field in db.auth_user. Every query where there is a form (like an SQLFORM or SQLFORM.grid) includes: (mytable.department==auth.user.department). B) To control access to the functions()s, I have used these decorators: @auth.requires_login() #allowing any person logged in to access or @auth.requires(auth.has_membership('Approver') or auth.has_membership('Admin')) #allowing Admin or Approvers to access or @auth.requires_membership('Admin')#allowing only Admin people to access The decorators work fine - but created a small issue where (for example) to edit a record I pass the user to a function() with an ARG=record_ID e.g. to a page with a form; but the user could simply overtype the ARG in the URL with a different record_ID and be able to access that record (which may be outside of their department). So, I digitally signed all URLs, and replaced the decorators with @auth.requires_signature() This solved the issue. i.e. if a user fiddles with the ARG in the URL, they get not authorized. Although this might not be the explicit intention of @auth.requires_signature(), it works:-) Here is my problem: I have replaced the original group-membership decorators with @auth.requires_signature() Ideally, I need to combine @auth.requires_signature() with other decorators e.g. @auth.requires(auth.has_membership('Approver') or auth.has_membership('Admin')) However, because @auth.requires_signature() is itself a decorator, I cannot include this in an @auth.requires(.) decorator. So:- 1) How do I combine these decorators to include BOTH group membership and requires_signature() ? 2) Can I use multiple,separate decorators for a function()? (I am sure not) 3) It is also possible to add addtional conditions to @auth.requires() e.g. mytable.department==auth.user.department (for added security!) 4) Or maybe there is there is a better way to prevent manual fiddling with the URL/ARG ? BTW - I am running 2.3.2, and still a relative novice. Thanks for reading a long question:-) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: any good open courses with web2py?
Yes, but Movuca uses a modelless approach, that was nice when lazy tables wasn't implemented in web2py. Maybe Bruno Rocha, the Movuca creator, says more about that. On Thu, Apr 11, 2013 at 10:14 AM, samuel bonilla pythonn...@gmail.com wrote: the largest open source project I've seen in web2py is movuca, you can check out https://github.com/rochacbruno/Movuca is a social network demo: www.foxter.co 2013/4/11 jjg0 miahgor...@gmail.com The killer web app tutorial claims to be for people with no prior programming skills, is it strange to throw so much emphasis on testing in a course for people who have never programmed? I'm not sure if it is worth taking the time to get selenium working and learn how to use it, or if I should hold off on worrying about the testing side and keep looking for something better as far as learning materials go. Especially if a better testing method is being worked on. I'd like to be able to build more complicated sites, I just don't know how to get there. I see larger sites like amazon, facebook, or netflix and I think it would be really fun to be able to make one myself. I don't actually plan on starting my own business or anything, I just find it interesting. On Thursday, April 11, 2013 8:13:28 AM UTC-4, Niphlod wrote: we're working on having a better recommended (and documented, and simple) way to run tests. Until recently I didn't think about tests at all: this speeded up greatly the productivity but on the long run a lot of time has been wasted on worrying too much if, e.g., I can upgrade web2py (or for what matters, any other component inside my deployment, such as the db, redis, jquery, bootstrap, etc). This made me think that if what you're going to do needs to be (even seldomly) updated, you'd better find time to write those tests. If instead is something that you do just for you, and you know you're never going to touch it again, then you can continue to avoid writing tests alltogether. When the next jquery update will be out, I'll just slip it into my test server, run all the tests and see if something breaks. If I had no tests, I'd be forced to fire up all the features of my app by hand, probably missing something crucial (and I'll loose a few night sleeps) :P -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/75F_eT2b7eI/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: some features I implemented
How do I know if it's useful for other people, other than asking here?. ... Is that more useful than a RTable plugin? The RTable plugin is just a suggestion, it doesn't means you ought to have one. I tend to make plugins since when you need a new app, you can integrate different features without having to port and adapt chunks of code from one app to another. - plugin_wiki has a super-simple html5 video widget. If you are coding features that use plugin_wiki, note that It will be replaced with the built-in wiki feature (not abandoned if someone keeps it updated). -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] gmaps: ugly rendering
Hi hit this issue also and I fixed with: style .gmnoprint img {max-width: inherit;} /style in the end of the head Ricardo On Fri, Apr 12, 2013 at 11:47 AM, Jes M jjje...@gmail.com wrote: Hi all: I'm testing gmaps.js with the same code Omi published here: http://ochiba77.blogspot.com.es/2012/06/how-to-use-gmapsjs-on-web2py.html But there is a problem when the map is redendered: the slider is broken and when clicking in a mark the contents of the frame are not well diplayed too. The markers are shown in the right way, zoom or moving works. It's a very annoying problem. Any idea what can be happening? Thanks in advance -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How do I combine @auth.requires_signature with @auth.requires_membership
@auth.requires(auth.has_membership('Approver') or auth.has_membership('Admin')) #allowing Admin or Approvers to access The above will execute the has_membership queries every time the controller is called, even when not accessing the decorated function. To avoid the unnecessary database hits, you can put the condition inside a lambda (so it will only get called when the decorated function is actually accessed): @auth.requires(lambda: auth.has_membership('Approver') or auth. has_membership('Admin')) 1) How do I combine these decorators to include BOTH group membership and requires_signature() ? 2) Can I use multiple,separate decorators for a function()? (I am sure not) Yes, decorators can be stacked: @auth.requires_signature() @auth.requires(some_condition) def myfunc(): ... 3) It is also possible to add addtional conditions to @auth.requires() e.g. mytable.department==auth.user.department (for added security!) Yes, the first argument to @auth.requires() can be any expression -- its truthiness will be evaluated to determine whether access is granted. It can also be a callable, it which case, it will be called and the return value will be evaluated (hence the recommendation above to put the membership checks inside a lambda). 4) Or maybe there is there is a better way to prevent manual fiddling with the URL/ARG ? Digitally signing the URLs is a good method for this. The signature is actually a hash of the URL itself (minus the signature, of course). When the request is made, web2py re-hashes the requested URL and makes sure it matches the signature -- if not, that means the URL was modified, and access is denied. The other option would be to check for permission on the requested record, but the signature is probably the best approach, as it doesn't require another database query to check permission. Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Pyfpdf - How to fit long data descriptions in the table with proper text wrapping in rows/columns
Yes we can pass Paramenters. check this out. https://github.com/simpleservices/app_report-python/wiki/Using-the-AppReport-client-on-Web2py-Apps Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/12 Rahul rahul.dhak...@gmail.com Hi Ovidio, Thanks for this great resource. I have a few questions - Can we pass queries to this plugin? Can we select fields that we want for reporting? The wrapping thing works well with this plugin. Rahul. On Thursday, April 11, 2013 4:47:44 PM UTC+5:30, Ovidio Marinho wrote: PDF paths are hard, so we tried some practical solutions. See this appreport. https://github.com/**lucasdavila/web2py-appreporthttps://github.com/lucasdavila/web2py-appreport After long searching found something that can permanently solve these problems that fpdf, pisa, geraldo bring us in doing pdf. I think you, as I found the solution. {{}}'s Ovidio Marinho Falcao Neto Web Developer ovid...@gmail.com 83 8826 9088 - Oi 83 9336 3782 - Claro Brasil 2013/4/11 Rahul rahul@gmail.com Hi All, I am having a few problems with my code to generate proper PDF reports. Basically I have the same problems with reportlab so i am giving pyfpdf a try - *Problems:* 1. Long text (example *description *in below code) does not fit in the boundaries. It does not wrap to next line it just exceeds the page width - please see sample report attached. 2. I cant make zebra strips (alternate line/row color) to work properly here 3. The HTML output does not work (I have the view rep_open_issues.html - no data) [Live Demo for HTML pyfpdf does not work Ex - this url - http://www.web2py.com.ar/fpdf/**default/listinghttp://www.web2py.com.ar/fpdf/default/listing] Throws error - *invalid view (default/listing.html)* Here is my code - def rep_open_issues(): response.title = Open Issues head = THEAD(TR(TH(Ticket,_width=**15%), TH(Sub Cateogry,_width=20%), TH(Severity,_width=15%), TH(Description,_width=50%)**, _bgcolor=#A0A0A0)) foot = TFOOT(TR(TH(Fair Price - Good Day,_width=100%), _bgcolor=#E0E0E0)) querysql = ( Select ticket_no, sub_category, severity, description from issues where status='Open' and created_by=' + logged_in_user ) try: allissues = db.executesql(querysql) except: pass rows = [] for issue in allissues: mycounter = [] mycounter.append(issue) i = len(mycounter) col = i % 2 and #F0F0F0 or #FF rows.append(issue) # make the table object body = TBODY(*rows) table = TABLE(*[head,foot, body], _border=1, _align=center, _width=100%) if request.extension==pdf: from gluon.contrib.pyfpdf import FPDF, HTMLMixin # define our FPDF class (move to modules if it is reused frequently) class MyFPDF(FPDF, HTMLMixin): def header(self): self.set_font('Arial','B',15) self.cell(0,10, response.title ,1,0,'C') self.ln(20) def footer(self): self.set_y(-15) self.set_font('Arial','I',8) txt = 'Page %s of %s' % (self.page_no(), self.alias_nb_pages()) self.cell(0,10,txt,0,0,'C') pdf=MyFPDF() # first page: pdf.add_page() pdf.write_html(str(XML(table, sanitize=False))) response.headers['Content-**Type']='application/pdf' return pdf.output(dest='S') else: # normal html view: return dict(table=table) Not much is changed here- I know, i may be missing a few tricks. Please help me fill the same As a Ref - I checked this thread [Re: How to Generate the effective report by using web2py] in google groups but without much resolution. Please suggest. Thanks Rahul -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users
[web2py] dev_appserver session not running completely in 'gae' mode
I placed a clean copy of the latest web2py release and added my application to it (init) and linkedin library plus a couple of yaml files. If I run web2py all is fine. But when I run dev_appserver I can the following error when I try to login using LinkedIn. The error doesn't look like a valid route as the contrib\memdb.py shouldn't be used by dev_appserver. Any idea what I've done to pull in the wrong version of MemcacheClient? ERROR2013-04-12 13:37:22,867 restricted.py:161] Traceback (most recent call last): File F:\tmp\web2py\gluon\main.py, line 555, in wsgibase session._try_store_in_db(request, response) File F:\tmp\web2py\gluon\globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\tmp\web2py\gluon\contrib\memdb.py, line 256, in insert id = self._create_id() File F:\tmp\web2py\gluon\contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' INFO 2013-04-12 13:37:22,868 gaehandler.py:69] Request: 1547.00ms/1546.63ms (real time/cputime) INFO 2013-04-12 14:37:22,869 server.py:561] default: GET /init/default/user/login?agent=linkedin HTTP/1.1 500 719 INFO 2013-04-12 13:37:22,927 gaehandler.py:69] Request: 0.00ms/0.21ms (real time/cpu time) INFO 2013-04-12 14:37:22,930 server.py:561] default: GET /favicon.ico HTTP/1.1 400 50 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to create a doesn't belong query, is it possible?
It works here... at least for a SQLFORM.grid On Thu, Apr 11, 2013 at 10:26 PM, Alan Etkin spame...@gmail.com wrote: Is that the correct syntax? select() returns a Rows object, and I'm not sure that operation is supported, I tried it in a shell and it throws: TypeError: bad operand type for unary ~: 'Rows' This instead returns the complement of the record set: db(~db.log.severity.belongs((**1, 2))).select() I suppose it's a mistyped command. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How do I combine @auth.requires_signature with @auth.requires_membership
Anthony, Thanks so much for sharing the expertise, and so quickly. I had completely misunderstood about the decorators. Actually stacking them is the simplest and easiest answer, given that it is a valid thing to do. I hear what you say about the unnecessary database hits and the lambda. I had read the other string about this: Authorization decorators always generate db queries that you had kindly posted to. This was something else I misunderstood as I thought an update was applied to this on 11/18/11. Oops sorry, I will be sure to take your advice on this point also. So, answer is: stacking the decorators and adding lambda to @auth.requires(auth.has_membership. Thanks again Simon On Friday, April 12, 2013 2:34:06 PM UTC+1, Anthony wrote: @auth.requires(auth.has_membership('Approver') or auth.has_membership('Admin')) #allowing Admin or Approvers to access The above will execute the has_membership queries every time the controller is called, even when not accessing the decorated function. To avoid the unnecessary database hits, you can put the condition inside a lambda (so it will only get called when the decorated function is actually accessed): @auth.requires(lambda: auth.has_membership('Approver') or auth. has_membership('Admin')) 1) How do I combine these decorators to include BOTH group membership and requires_signature() ? 2) Can I use multiple,separate decorators for a function()? (I am sure not) Yes, decorators can be stacked: @auth.requires_signature() @auth.requires(some_condition) def myfunc(): ... 3) It is also possible to add addtional conditions to @auth.requires() e.g. mytable.department==auth.user.department (for added security!) Yes, the first argument to @auth.requires() can be any expression -- its truthiness will be evaluated to determine whether access is granted. It can also be a callable, it which case, it will be called and the return value will be evaluated (hence the recommendation above to put the membership checks inside a lambda). 4) Or maybe there is there is a better way to prevent manual fiddling with the URL/ARG ? Digitally signing the URLs is a good method for this. The signature is actually a hash of the URL itself (minus the signature, of course). When the request is made, web2py re-hashes the requested URL and makes sure it matches the signature -- if not, that means the URL was modified, and access is denied. The other option would be to check for permission on the requested record, but the signature is probably the best approach, as it doesn't require another database query to check permission. Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to create a doesn't belong query, is it possible?
in a grid either you pass a table or a query, so passing db(...) won't work. Are you totally sure ? Alan's syntax is the correct one. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How do I combine @auth.requires_signature with @auth.requires_membership
@auth.requires_membership() was changed so it only does its query when the decorated function is actually called. However, you are using the more generic @auth.requires(), which can take any condition. There's no way to automatically make the evaluation of that condition lazy, so you are responsible for putting it inside a callable (e.g., a lambda) yourself. On Friday, April 12, 2013 10:08:35 AM UTC-4, SimonD wrote: Anthony, Thanks so much for sharing the expertise, and so quickly. I had completely misunderstood about the decorators. Actually stacking them is the simplest and easiest answer, given that it is a valid thing to do. I hear what you say about the unnecessary database hits and the lambda. I had read the other string about this: Authorization decorators always generate db queries that you had kindly posted to. This was something else I misunderstood as I thought an update was applied to this on 11/18/11. Oops sorry, I will be sure to take your advice on this point also. So, answer is: stacking the decorators and adding lambda to @auth.requires(auth.has_membership. Thanks again Simon On Friday, April 12, 2013 2:34:06 PM UTC+1, Anthony wrote: @auth.requires(auth.has_membership('Approver') or auth.has_membership('Admin')) #allowing Admin or Approvers to access The above will execute the has_membership queries every time the controller is called, even when not accessing the decorated function. To avoid the unnecessary database hits, you can put the condition inside a lambda (so it will only get called when the decorated function is actually accessed): @auth.requires(lambda: auth.has_membership('Approver') or auth. has_membership('Admin')) 1) How do I combine these decorators to include BOTH group membership and requires_signature() ? 2) Can I use multiple,separate decorators for a function()? (I am sure not) Yes, decorators can be stacked: @auth.requires_signature() @auth.requires(some_condition) def myfunc(): ... 3) It is also possible to add addtional conditions to @auth.requires() e.g. mytable.department==auth.user.department (for added security!) Yes, the first argument to @auth.requires() can be any expression -- its truthiness will be evaluated to determine whether access is granted. It can also be a callable, it which case, it will be called and the return value will be evaluated (hence the recommendation above to put the membership checks inside a lambda). 4) Or maybe there is there is a better way to prevent manual fiddling with the URL/ARG ? Digitally signing the URLs is a good method for this. The signature is actually a hash of the URL itself (minus the signature, of course). When the request is made, web2py re-hashes the requested URL and makes sure it matches the signature -- if not, that means the URL was modified, and access is denied. The other option would be to check for permission on the requested record, but the signature is probably the best approach, as it doesn't require another database query to check permission. Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to create a doesn't belong query, is it possible?
Alan was referring to the placement of the ~ operator -- it prepends the Query, not the Set. You probably submitted the following to the grid, right? SQLFORM.grid(~db.log.severity.belongs((1, 2)), ...) Anthony On Friday, April 12, 2013 9:51:38 AM UTC-4, Tito Garrido wrote: It works here... at least for a SQLFORM.grid On Thu, Apr 11, 2013 at 10:26 PM, Alan Etkin spam...@gmail.comjavascript: wrote: Is that the correct syntax? select() returns a Rows object, and I'm not sure that operation is supported, I tried it in a shell and it throws: TypeError: bad operand type for unary ~: 'Rows' This instead returns the complement of the record set: db(~db.log.severity.belongs((**1, 2))).select() I suppose it's a mistyped command. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
A lot of valid points however as i stated it is only a 2 line fix. The reason this fix is needed is because of the On Apr 12, 2013 8:53 AM, Niphlod niph...@gmail.com wrote: However why call nssm the best way to do this but still ship the winservice.py file? Because things gets discussed and possibly overlooked. There are a few open issues with the way web2py handles services and absolutely no-one willing to take responsibility to test it more than the current once on a while. A full coverage in fact has never been tested (and probably never worked). That being said, sometimes it works without hiccups. The batteries included predicament stands as long as your implementation works, all the times. A very few users are using it (or a very few users just needed once and forgot it), and when this pops up once in a while, a patch is threw in and then the user disappears. The moment he needs to update web2py and finds that his previous patch didn't really solve the problem, there's another iteration on the matter. A few open issues? WindowsXP scripts still work on VIsta/7/8 because it is nothing more than a simple registry entry. As far as maintaining the code, did you look at the two lines I proposed to add? from rewrite import load load() What is to maintain? the load() function in rewrite is the same one that gluon.main.py uses. If you would like to propose a better place to call the load() function in gluon.main.py such that it is always galled before launching an HttpServer then that would actually be useful and then we would not need to call load separately in the winservice.py file. If nssm was truly *the* way to do this then I would think the book (which was just updated) would have removed the section about the winservice.py and only talk about nssm or at least make an effort to promote nssm over the native script. I would have done it and proposed in the past, but I'm not the boss and usually there are a few POVs to consider. The other issue with this is the fact that it is *another* thing to install rather than just being included. Makes it a lot harder to get web2py approved by corporate IT/Sys-addmins if you have to install a whole bunch of separate apps and each app has to be vetted. This doesn't make a whole lot of sense from the standpoint of having everything in the box with web2py. On the other end, doesn't make real sense to continue supporting something that is clearly not tested and with a very little userbase (but with a lot of people complaining for it the moment they realize they fall into the sometime doesn't category). Clearly you are already supporting it by shipping a winservice.py file and someone just forgot to call the load() function to read the routes.py file. I don't understand what you are so against? As far as support goes, Massimo is intent on supporting ie 7 for web2py's editor because some people still use it. So supporting new/different versions of windows is already being done not to mention the method for setting up a system service has hardly changed since XP (12+years) same as before. My POV is more or less if you have only IE7 as a browser, use notepad given that IE7 is currently being replaced in enterprises too (and is very well below the 5% on the browser's share). In any case, it's one thing to make a web page compatible with IE6(7,8,9,10) and is another making web2py hooking up into XP,Vista,Seven,8,2003,2008 (32 and 64 bits) service managers, with all the options working ok, with source and binary distributions, for python2.5, 2.6, 2.7 (someone with pypy necessities could come up as well) and have a proof of it (i.e. not saying this should work but this works). If you want it the way it is, i.e. sometime works, sometime doesn't, by all means continue to use it and send a patch every time it breaks, but please take into consideration that ditching it and using nssm will save you, angry users and developers a lot of headaches. -- Again, all the version of windows that are currently supported XP, Vista, 7, and 8 it makes no difference how you register a service. Even when 64 bit. Do yourself a favour and take a look at gluon.main.py and notice how out of place the call to load() is. That file is a bit of a hodgepodge, a global variable, a bunch of global functions, a class definition and a call to load(). It is clear that to make web2py more modular that the call to load() should not just be thrown in there. That being said, I do not have enough experience with the code base to propose a better place within the main.py file other than possibly just before the call to server.start in the start method of the HttpClass. I however am not certain this would always be called even when using different web-servers (e.g. calling anyserver.py and using rocket, cherrypy, gunicorn, tornado, etc.) This caused me to go a safer route and add this call to the winservice.py file instead. Are you saying this
Re: [web2py] gmaps: ugly rendering
Thank you very much Pedro. That works! I put it in the view, right after {{extend 'layout.html'}} and it works too. Gracias otra vez, saludos Jes El viernes, 12 de abril de 2013 15:19:21 UTC+2, Ricardo Pedroso escribió: Hi hit this issue also and I fixed with: style .gmnoprint img {max-width: inherit;} /style in the end of the head Ricardo On Fri, Apr 12, 2013 at 11:47 AM, Jes M jjj...@gmail.com javascript: wrote: Hi all: I'm testing gmaps.js with the same code Omi published here: http://ochiba77.blogspot.com.es/2012/06/how-to-use-gmapsjs-on-web2py.html But there is a problem when the map is redendered: the slider is broken and when clicking in a mark the contents of the frame are not well diplayed too. The markers are shown in the right way, zoom or moving works. It's a very annoying problem. Any idea what can be happening? Thanks in advance -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: The MENU helper and id
This can change if we backport the MENU helper from web3py. On Thursday, 11 April 2013 10:11:52 UTC-5, Anthony wrote: ul = menu.element(ul) items = ul.elements(li) for item in items: item.atttributes[_id] = new id Won't work -- the MENU() helper doesn't generate the UL's and LI's until it is serialized. Also, note that .element('ul') returns only the first UL element. To get all the LI elements, all you have to do is menu.elements('li') (though, again, that won't really work in this case). Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: upgrading appengine has broken web2py
I proposed in web2py 2.5 we remove the gql module. On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote: Removing the line from gluon.contrib.gql import * removed the error and allows my app to launch. I next run into this error: File F:\wp\TestEnvoy\web2py\gluon\main.py, line 555, in wsgibase session._try_store_in_db(request, response) File F:\wp\TestEnvoy\web2py\gluon\globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 256, in insert id = self._create_id() File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' One for me to investigate. On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote: has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_gae: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\applications\init\models\db.py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: some features I implemented
Will check this asap. Can you post some screenshots? On Thursday, 11 April 2013 16:58:29 UTC-5, pa...@cancamusa.net wrote: Hello: I've written an application for database management with some features that might interest you: - RTable builds a kind of spreadsheet from any table. The columns are html input for fields of type string or number, selects for references or when the options are limited, and so on. There is also RSheet that is useful for relations of the type to each product and person, assign the quantity that the person has ordered of that product: it places products on the rows, person on the column, etcetera. Both are navigable with keyboard, and support paste from spreadsheet or csv, to some extent. They both admit parameters, which means some of the table fields have prescribed values. They are taylored to my needs, and I'd definitely call that work in progress. - The form for introducing new elements has links to introduce new fields of referenced tables. For example, I want to introduce a person, but her country is not in the list. I click the link country, fill the form for a new country, then I'm redirected to the form for a new person, but the field country is filled with the country I just introduced. This can be iterated as many times as needed. - Searching is derived from smartgrid, but extends smart_query for queries with parenthesis and joins, provides drop menus for joins, a menu to group results and allows to store and recall popular queries. The results of the query are displayed as a jquery fixheadertable, and can be downloaded as a pretty_csv in which references are not displayed as numbers, but with the table _format attribute. - It has a file manager that I got from the web2py appliance: https://github.com/mdipierro/web2py-appliances/tree/master/FileManager from the corefive file manager. I updated some javascript files to newer versions and added functionality to unzip zipped files, to save time when uploading many files. - plugin_wiki has a super-simple html5 video widget. - All the above, however, will crash if you ask for big data sets, there is no check for size of results, for example. The app that I adjoin (AnotherAdmin) shows most of the above, except for: - RSheet - RTable.factory - RTable with parameters I'll soon give an example for those, I wrote them for a different application. You can still read the code if you are curious. Everything in AnotherAdmin works with any database (except for some known bugs I'm fond of), so you should be able to upload it and change only the file db.py. The current example is in Spanish, hope you don't mind. You can try that at: https://rabia.mat.uam.es/AnotherAdmin/ with login: tes...@example.com javascript: testeramI Does any of the above interest you? Do you have suggestions for improvement? Thanks for your attention -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: routes in windows service not working??
Thanks! In trunk. On Thursday, 11 April 2013 10:55:43 UTC-5, Stephen Tanner wrote: I Think I tracked down the issue. In the windows service, it just imports the HttpServer class from main, and then creates one using the options.py for its settings. However, when starting a web2py not as a service, it makes a call to main.py In gluon.main.py we can see that rewrite.load is imported and then later just run with global file scope as a call to load() This however is not done in association to creating or starting a web-server so when the windows service creates the HttpServer object no call is made to load() To fix this edit gluon.winservice.py, and add the following lines to the try block in the start function ... try: from rewrite import load load() self.server.start() except: This causes it to read the routes.py file before starting the server and should cause the desired action. On Monday, August 20, 2012 12:15:25 AM UTC-4, Dave wrote: I generally am not the person to be monkeying around with things on Windows. That said, one of my customers is about to take over management and ownership of a web2py application I have written for them. I seem to be having an issue testing the deployment for them. I created an options.py file and the service installs and starts properly. Unfortunately, for some reason it does not appear the routes.py file is being parsed on startup though. Even though the default app is set, a request to / still attempts to go to /welcome/... If I go in to the admin interface and choose reload routes, everything works... until the service is restarted that is. If I run web2py from the command line .. ie python web2py.py -p 80 -a 'password', the routes.py file gets parsed on startup. Any ideas? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
I agree that perhaps we should remove winservice. I would like to hear more opinions on the matter form windows users. removing winservice requires adding some steps (namely downloading and using nssm). On Friday, 12 April 2013 07:53:24 UTC-5, Niphlod wrote: However why call nssm the best way to do this but still ship the winservice.py file? Because things gets discussed and possibly overlooked. There are a few open issues with the way web2py handles services and absolutely no-one willing to take responsibility to test it more than the current once on a while. A full coverage in fact has never been tested (and probably never worked). That being said, sometimes it works without hiccups. The batteries included predicament stands as long as your implementation works, all the times. A very few users are using it (or a very few users just needed once and forgot it), and when this pops up once in a while, a patch is threw in and then the user disappears. The moment he needs to update web2py and finds that his previous patch didn't really solve the problem, there's another iteration on the matter. If nssm was truly *the* way to do this then I would think the book (which was just updated) would have removed the section about the winservice.py and only talk about nssm or at least make an effort to promote nssm over the native script. I would have done it and proposed in the past, but I'm not the boss and usually there are a few POVs to consider. This doesn't make a whole lot of sense from the standpoint of having everything in the box with web2py. On the other end, doesn't make real sense to continue supporting something that is clearly not tested and with a very little userbase (but with a lot of people complaining for it the moment they realize they fall into the sometime doesn't category). As far as support goes, Massimo is intent on supporting ie 7 for web2py's editor because some people still use it. So supporting new/different versions of windows is already being done not to mention the method for setting up a system service has hardly changed since XP (12+years) same as before. My POV is more or less if you have only IE7 as a browser, use notepad given that IE7 is currently being replaced in enterprises too (and is very well below the 5% on the browser's share). In any case, it's one thing to make a web page compatible with IE6(7,8,9,10) and is another making web2py hooking up into XP,Vista,Seven,8,2003,2008 (32 and 64 bits) service managers, with all the options working ok, with source and binary distributions, for python2.5, 2.6, 2.7 (someone with pypy necessities could come up as well) and have a proof of it (i.e. not saying this should work but this works). If you want it the way it is, i.e. sometime works, sometime doesn't, by all means continue to use it and send a patch every time it breaks, but please take into consideration that ditching it and using nssm will save you, angry users and developers a lot of headaches. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: routes in windows service not working??
you're overreaching. Of course your 2 line fix will be accepted: my point was more or less if I were you (handing over the management to my customer) I'd go for the safer route of nssm. If you search in the group you'll see a few issues reported already and almost one other is still open in the bugtracker. That being said, me is not supporting winservice. me just sees a lot of potential problems continuing to ship it with web2py. There's a strong possibility that nssm is yet in your sysadmin toolbelt (and if not, he'll like it.) All the rest of the post is FUD. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How do I specify my display field here in IS_IN_DB?
requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs(currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId) (db.product.productId==db.productSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: upgrading appengine has broken web2py
Perhaps 2.5 isn't far away given 2.4.6 is out. I'll be happy to a version of web2py with it removed. On 12 April 2013 16:17, Massimo Di Pierro massimo.dipie...@gmail.comwrote: I proposed in web2py 2.5 we remove the gql module. On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote: Removing the line from gluon.contrib.gql import * removed the error and allows my app to launch. I next run into this error: File F:\wp\TestEnvoy\web2py\gluon\**main.py, line 555, in wsgibase session._try_store_in_db(**request, response) File F:\wp\TestEnvoy\web2py\gluon\**globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py, line 256, in insert id = self._create_id() File F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' One for me to investigate. On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote: has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_**gae: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\**applications\init\models\db.**py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\**custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\**contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How do I specify my display field here in IS_IN_DB?
Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs(currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId) (db.product.productId==db.productSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abasta...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**productSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.** productSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Belongs with empty list fails on postgres
Hello, I fall on (1=0) with this query : There is these belongs : db(... (db.table.field.belongs(('item',))).select(...) Richard On Thu, Nov 8, 2012 at 12:29 PM, Cliff Kachinske cjk...@gmail.com wrote: I've been working around this Postgres/psycopg2 feature for ages. Something like this: query = db.sometable.somefield==somevalue avoid = [id1, id2, id3] #could be an empty list if len(avoid): query = ~(db.sometable.id.belongs(avoid)) On Tuesday, November 6, 2012 12:06:22 PM UTC-5, Niphlod wrote: really don't know (but probably to ckeck for nulls) the complete code is def BELONGS(self, first, second): if isinstance(second, str): return '(%s IN (%s))' % (self.expand(first), second[:-1]) elif second==[] or second==(): return '(1=0)' items = ','.join(self.expand(item, first.type) for item in second) return '(%s IN (%s))' % (self.expand(first), items) Il giorno martedì 6 novembre 2012 18:01:59 UTC+1, Marin Pranjić ha scritto: Done: http://code.google.com/p/**web2py/issues/detail?id=1147http://code.google.com/p/web2py/issues/detail?id=1147 Is there a reason for elif second==[] or second==() while it could easily be elif not second ? This should fix it. -- -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Belongs with empty list fails on postgres
Seems I can work around this like that : db(... (db.table.field.belongs(('item', ''))).select(...) Richard On Fri, Apr 12, 2013 at 12:39 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello, I fall on (1=0) with this query : There is these belongs : db(... (db.table.field.belongs(('item',))).select(...) Richard On Thu, Nov 8, 2012 at 12:29 PM, Cliff Kachinske cjk...@gmail.com wrote: I've been working around this Postgres/psycopg2 feature for ages. Something like this: query = db.sometable.somefield==somevalue avoid = [id1, id2, id3] #could be an empty list if len(avoid): query = ~(db.sometable.id.belongs(avoid)) On Tuesday, November 6, 2012 12:06:22 PM UTC-5, Niphlod wrote: really don't know (but probably to ckeck for nulls) the complete code is def BELONGS(self, first, second): if isinstance(second, str): return '(%s IN (%s))' % (self.expand(first), second[:-1]) elif second==[] or second==(): return '(1=0)' items = ','.join(self.expand(item, first.type) for item in second) return '(%s IN (%s))' % (self.expand(first), items) Il giorno martedì 6 novembre 2012 18:01:59 UTC+1, Marin Pranjić ha scritto: Done: http://code.google.com/p/**web2py/issues/detail?id=1147http://code.google.com/p/web2py/issues/detail?id=1147 Is there a reason for elif second==[] or second==() while it could easily be elif not second ? This should fix it. -- -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com javascript: wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**productSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.** productSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abasta...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p**roductSiteId.belongs(* *currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/vb0268kC_mc/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] .belongs failed on ('item',) to make sure 'item' get interpret as a tuple and not a string
Hello, I revive this threads : https://groups.google.com/forum/?fromgroups=#!topic/web2py/Qk2LJsEU4Lg And open this one to make sure this one doesn't get lost... You can see my other posts to get more details, but breifely I fall on DAL issue I think with .belongs if for example I only pass a single item to the belongs inside a query... I use postgres 9.1 with pgcog2 and web2py 2.3.2 To me .belongs should not failed on a query like this : db(... (db.table.field.belongs(request.vars.items)).select(...) Where request.vars.items may content 1 or more items... So in case there is only one item I could use this work around : if len(request.vars.items) == 1: request.vars.items = (request.vars.items, '') That work... But I think DAL need to be fix... Thanks Richard -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] .belongs failed on ('item',) to make sure 'item' get interpret as a tuple and not a string
It seems that my work around those not work as I expect... :( Richard On Fri, Apr 12, 2013 at 1:14 PM, Richard ml.richard.vez...@gmail.comwrote: Hello, I revive this threads : https://groups.google.com/forum/?fromgroups=#!topic/web2py/Qk2LJsEU4Lg And open this one to make sure this one doesn't get lost... You can see my other posts to get more details, but breifely I fall on DAL issue I think with .belongs if for example I only pass a single item to the belongs inside a query... I use postgres 9.1 with pgcog2 and web2py 2.3.2 To me .belongs should not failed on a query like this : db(... (db.table.field.belongs(request.vars.items)).select(...) Where request.vars.items may content 1 or more items... So in case there is only one item I could use this work around : if len(request.vars.items) == 1: request.vars.items = (request.vars.items, '') That work... But I think DAL need to be fix... Thanks Richard -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs(currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId) (db.product.productId==db.productSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.py, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato.st...@gmail.com wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abasta...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p**roductSiteId.belongs( **currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/vb0268kC_mc/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
What I really want to do is to use a syntax like this for the IS_IN_DB for the LEFT JOIN. requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs( currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId)). _select(left=db.product.on(db.product.productId==db.productSite.productId), orderby=[db.product.productName]), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...because I'd like to control the order of the items in the list. But, this method gives me the following traceback. Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/applications.pyhttp://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py , line 4292, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/applications.pyhttp://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py , line 865, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.py, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\validators.py, line 518, in build_set table = self.dbset.db[self.ktable] AttributeError: 'str' object has no attribute 'db' I'm assuming because I'm now returning SQL instead of a query object. Can I do LEFT JOIN in IS_IN_DB? -Jim On Friday, April 12, 2013 12:56:34 PM UTC-5, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs(currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId) (db.product.productId==db.productSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.py, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato.st...@gmail.com wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abasta...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote:
[web2py] Access control advice
Hey guys, We have multiple users and a couple of locales in which to enter data. I wonder what's a good strategy to setup access control in a way that gives each user control over a specific subset of locales (usually one user handles one language, but there are exceptions). What I initially came up with: Add groups for each language, like 'admin_en_EN', 'admin_nl_NL', but we also need groups like 'operator_en_EN' and 'operator_nl_NL' for users with slightly more restricted access. (Potentially more restriction levels too) But it's clunky because now I need decorators that contain a long list of groups (NL, EN, AU, etc.). The alternative I can think of is defining my own tables that link users to languages and stuff and handle authorization manually in each controller, but then I loose a lot of built-in functionality. Am I making things complicated? Anyone got any pointers? I cannot really change the requirements, there are users that can have access to one or more locales in at least two different levels (admin can CRUD, operators can just read and update for example) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] .belongs failed on ('item',) to make sure 'item' get interpret as a tuple and not a string
uhm. I think that this particular case should be retained as it is: belongs accepts either a list or a set, but not a string, and **should** fail when you pass to it a string instead of a list. either way your code should do possible_items = request.vars.items if isinstance(possible_items, str): possible_items = [possible_items] results = db(db.table.belongs(possible_items)) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: request.env.http_referrer
ah, you don't have a typo, you spelled the word right. unfortunately, in the spec it's spelled wrong! On Friday, April 12, 2013 4:38:18 AM UTC-7, Domagoj Kovač wrote: I have a typo :(, request.env.http_referer works. On Friday, April 12, 2013 1:27:10 PM UTC+2, Domagoj Kovač wrote: Hi, i am using request.env.http_referrer, and i always get None, is there something i did wrong? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: gluon.contrib.stripe not working: No JSON object could be decoded
Got word back from pythonanywhere. They tried adding it to the whitelist, but it still had bugs because there were issues with whatever Python API was being used (probably on the end of both pythonanywhere and stripe) to handle https requests, since the pythonanywhere free user account goes through a proxy server. If I were to purchase a paid account with them, it wouldn't go through the proxy server and it works fine (they tested it). I have seen issues mentioned elsewhere of Python libraries mishandling https through proxy servers (see this topic in StackOverflow, for examplehttp://stackoverflow.com/questions/14390605/python-requests-ssl-issue). Pythonanywhere seems to want to close this issue, but I will see if something better can be worked out. On Thursday, April 11, 2013 10:29:34 PM UTC-4, David Ripplinger wrote: I found the message from the u.read(). It is an html message: --- ERROR The requested URL could not be retrieved -- The following error was encountered while trying to retrieve the URL: https://sk_test_osybducdtvurcbryb6lv7...@api.stripe.com/v1/charges *Unsupported Request Method and Protocol* Squid does not support all request methods for all access protocols. For example, you can not POST a Gopher request. Your cache administrator is webmaster webmaster%25W. -- Generated Fri, 12 Apr 2013 02:17:10 GMT by harry-liveproxy (squid/2.7.STABLE9) --- This is the same message I was getting before when I was using stripe the conventional way (i.e., using their API and tokens instead of Massimo's module) while running on pythonanywhere. Although this message was difficult for me to understand, it looks like your suspicions about the host blocking certain communications are correct. I just got feedback on the pythonanywhere forum stating that there is a whitelist of domains that free users of pythonanywhere (that's me) can communicate with. So it looks like all I have to do is convince them to add api.stripe.com to the whitelist, which they probably will do. On Thursday, April 11, 2013 9:12:29 PM UTC-4, Alan Etkin wrote: Here's the traceback ... File /home/davidrip/web2py/gluon/contrib/stripe.py, line 46, in charge According to the simplejson error, the u object pulled from the url is returning mangled json input (or not json at all). Maybe you could examine the u.read() output of line 46 in stripe.py to check if there's any issue related to server-side requests (perhaps some hosting network restriction?). -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] .belongs failed on ('item',) to make sure 'item' get interpret as a tuple and not a string
I could do that, but I pass a tuple... I know that an hard parsing since most of the time trailing comma is just strip out I think... I saw a tuple in the DAL : https://code.google.com/p/web2py/source/detail?r=6eed7c7e3ab5 So, I thougth it could take a tuple as well... Your solution seems cleaner then a tuple anyway. Thanks Richard On Fri, Apr 12, 2013 at 3:16 PM, Niphlod niph...@gmail.com wrote: uhm. I think that this particular case should be retained as it is: belongs accepts either a list or a set, but not a string, and **should** fail when you pass to it a string instead of a list. either way your code should do possible_items = request.vars.items if isinstance(possible_items, str): possible_items = [possible_items] results = db(db.table.belongs(possible_items)) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: smartgrid - limit which fields are editable after creation of record
you're not doing the right checks. I posted a reply directly on the issue. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: some features I implemented
db.define_table('pais', Field('nombre', unique=True), Field('continente', 'string', requires=IS_IN_SET(CONTINENTES)), Field('es_UE', 'boolean', default=False), format='%(nombre)s',) and the controller: @auth.requires_login() def sheet(): tablename = request.args[0] table = db[tablename] try: t = (k for k in request.vars if k.startswith('_table_name_')).next () id_t = t[12:] except StopIteration: id_t = None sheet = ERTable(table, id=id_t) if sheet.accepts(request.vars): session.flash=T('Datos modificados') redirect(URL(f='sheet', args = request.args)) return dict(sheet=sheet) produce the screenshot attached. The other features are hard to screnshoot... El viernes, 12 de abril de 2013 17:19:16 UTC+2, Massimo Di Pierro escribió: Will check this asap. Can you post some screenshots? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. attachment: Captura de pantalla - 120413 - 23:19:59.png
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
Well, a change was just made in trunk to allow '%(tablename.fieldname)s' notation, but it looks like the query retains only the fields in the main table (db.productSite in this case) anyway, so I guess that won't help. So instead, maybe: lambda r: db(db.product.productId == r.productId).select().first(). productName Anthony On Friday, April 12, 2013 1:56:34 PM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs(currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId) (db.product.productId==db.productSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.py, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.comjavascript: wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com javascript: wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p** roductSiteId.belongs(**currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/vb0268kC_mc/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
Not sure there's a way to do a left join, but seems like that could be enabled. If you can't get what you want, you might consider handling the queries to generate the items separately, and then pass them to IS_IN_SET. Anthony On Friday, April 12, 2013 2:23:37 PM UTC-4, Jim S wrote: What I really want to do is to use a syntax like this for the IS_IN_DB for the LEFT JOIN. requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs( currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId)). _select(left=db.product.on(db.product.productId==db.productSite.productId ), orderby=[db.product.productName]), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...because I'd like to control the order of the items in the list. But, this method gives me the following traceback. Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/applications.pyhttp://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py , line 4292, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/applications.pyhttp://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py , line 865, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.py, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\validators.py, line 518, in build_set table = self.dbset.db[self.ktable] AttributeError: 'str' object has no attribute 'db' I'm assuming because I'm now returning SQL instead of a query object. Can I do LEFT JOIN in IS_IN_DB? -Jim On Friday, April 12, 2013 12:56:34 PM UTC-5, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.productSiteId.belongs(currentItems)) (db.productSite.availableAddon==True) (db.productSite.siteId==workorder.siteId) (db.product.productId==db.productSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.py, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/infocenter/controllers/applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.comjavascript: wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com javascript: wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error.
Re: [web2py] Re: How to create a doesn't belong query, is it possible?
Yes Anthony On Fri, Apr 12, 2013 at 11:33 AM, Anthony abasta...@gmail.com wrote: Alan was referring to the placement of the ~ operator -- it prepends the Query, not the Set. You probably submitted the following to the grid, right? SQLFORM.grid(~db.log.severity.belongs((1, 2)), ...) Anthony On Friday, April 12, 2013 9:51:38 AM UTC-4, Tito Garrido wrote: It works here... at least for a SQLFORM.grid On Thu, Apr 11, 2013 at 10:26 PM, Alan Etkin spam...@gmail.com wrote: Is that the correct syntax? select() returns a Rows object, and I'm not sure that operation is supported, I tried it in a shell and it throws: TypeError: bad operand type for unary ~: 'Rows' This instead returns the complement of the record set: db(~db.log.severity.belongs((**1**, 2))).select() I suppose it's a mistyped command. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: upgrading appengine has broken web2py
i'm not having any problems with GAE + web2py.though i'm not fully upgraded on my web2py versions...perhaps i should do a test upgrade and see if i hit the same issues. On Friday, April 12, 2013 9:10:10 AM UTC-7, Carl wrote: Perhaps 2.5 isn't far away given 2.4.6 is out. I'll be happy to a version of web2py with it removed. On 12 April 2013 16:17, Massimo Di Pierro massimo@gmail.comjavascript: wrote: I proposed in web2py 2.5 we remove the gql module. On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote: Removing the line from gluon.contrib.gql import * removed the error and allows my app to launch. I next run into this error: File F:\wp\TestEnvoy\web2py\gluon\**main.py, line 555, in wsgibase session._try_store_in_db(**request, response) File F:\wp\TestEnvoy\web2py\gluon\**globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py, line 256, in insert id = self._create_id() File F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' One for me to investigate. On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote: has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_**gae: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\**applications\init\models\db.**py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\**custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\**contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
So, that should allow me to sort though shouldn't it? On Apr 12, 2013 4:38 PM, Anthony abasta...@gmail.com wrote: Well, a change was just made in trunk to allow '%(tablename.fieldname)s' notation, but it looks like the query retains only the fields in the main table (db.productSite in this case) anyway, so I guess that won't help. So instead, maybe: lambda r: db(db.product.productId == r.productId).select().first(). productName Anthony On Friday, April 12, 2013 1:56:34 PM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**productSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.** productSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.**py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py**, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.**py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.**py, line 1113, in __init__ inp = self.widgets.options.widget(fi**eld, default) File C:\dev\web2py\gluon\sqlhtml.**py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\**validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\**validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.com wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p roductSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.**pro ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** to**pic/web2py/vb0268kC_mc/**unsubsc**ribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/vb0268kC_mc/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to
[web2py] Python 3 compatibility?
Hi, I'm interested (very interested) in a Python web framework that works with Python 3.x (3.3+, in particular). What is the status of web2py's py3 support? I found a late-2011 thread in this group where Massimo was betting that there would be a Python 2.8 and hence no pressing need to even care about 3.x. Me, I have no interest in 2.y, and if web2py doesn't support the current and in fact better version of Python then I will reluctantly have to look elsewhere. Thanks in advance, -- B -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Javascript - Python - Session communication.
Hi everyone, I'm new to just about everything in the web2py stack, so I'm struggling with the best way to approach a problem I'm having. I have a game written in Flash. A user clicks a purchase button, which directs Flash to run a Javascript method. The Javascript calls a 3rd party purchase API to buy the product. The API posts back to web2py, but it doesn't include any identifying information about the user. Web2Py then fires a Javascript method telling the Flash game the product is purchased. This all works fine. The problem I have is that the user might not be logged in to web2py when they make a purchase. When the purchase postback comes through, I'd like some way to figure out who the user is. Some restrictions - I don't want to force users to log in to play the game. I also don't want to force them to log in before purchasing, but maybe after the purchase? I've tried a lot of Javascript wrangling and I just can't get it to work with the Python code getting evaluated before the page is rendered. Do you have any opinion on these possibilities: 1.) Set a sessions variable when the postback comes in and store the order number (would that session be the postback's and not the user's?). Ask the user to log in after the purchase and associate the order number with their web2py account. 2.) Ask the user to log in before purchase, but do it with a model window. I don't want to pull the user away from the game's window. Drawbacks - I have absolutely no idea how to do this using Janrain. 3.) Javascript redirect after a successful purchase. Somehow get information passed in the redirect? Maybe the order number so the purchase and user can be connected. Can you do this in a url? Still have the issue of communicating with the postback and the current session. 4.) Only associate the purchase if the user was logged in before purchasing. This would be a support problem though. Players play on a separate computer wouldn't have their purchases. How does anyone do web development? There are so many technologies to learn! :) Thanks! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] this would be nice for wizard 2.0
http://minikomi.github.io/Bootstrap-Form-Builder/# -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
You can specify an orderby for the query. Anthony On Friday, April 12, 2013 8:20:38 PM UTC-4, Jim S wrote: So, that should allow me to sort though shouldn't it? On Apr 12, 2013 4:38 PM, Anthony abas...@gmail.com javascript: wrote: Well, a change was just made in trunk to allow '%(tablename.fieldname)s' notation, but it looks like the query retains only the fields in the main table (db.productSite in this case) anyway, so I guess that won't help. So instead, maybe: lambda r: db(db.product.productId == r.productId).select().first(). productName Anthony On Friday, April 12, 2013 1:56:34 PM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**productSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.** productSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.**py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py**, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.**py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.**py, line 1113, in __init__ inp = self.widgets.options.widget(fi**eld, default) File C:\dev\web2py\gluon\sqlhtml.**py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\**validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\**validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.com wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p roductSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.**pro ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** to**pic/web2py/vb0268kC_mc/**unsubsc**ribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/**
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
In the _select() ? On Apr 12, 2013 8:41 PM, Anthony abasta...@gmail.com wrote: You can specify an orderby for the query. Anthony On Friday, April 12, 2013 8:20:38 PM UTC-4, Jim S wrote: So, that should allow me to sort though shouldn't it? On Apr 12, 2013 4:38 PM, Anthony abas...@gmail.com wrote: Well, a change was just made in trunk to allow '%(tablename.fieldname)s' notation, but it looks like the query retains only the fields in the main table (db.productSite in this case) anyway, so I guess that won't help. So instead, maybe: lambda r: db(db.product.productId == r.productId).select().first().** productName Anthony On Friday, April 12, 2013 1:56:34 PM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p**roductSiteId.belongs(* *currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\**restricte**d.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/**in**focenter/controllers/**applicati**ons.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.**p**y, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/**in**focenter/controllers/**applicati**ons.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.**p**y, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.**p**y, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.**p**y, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\**validator**s.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\**validator**s.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/**in**focenter/controllers/**applicati**ons.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.com wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p** roductSiteId.belongs(**currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/* *topic/web2py/vb0268kC_mc/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/vb0268kC_mc/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**grou ps/opt_out https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to a topic in the Google Groups
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
No, you can't do the ._select(). However, IS_IN_DB takes orderby, groupby, and distinct arguments (though not left, which presumably could be added) and uses them in the .select() that it does. You don't expect all this stuff to be documented, do you? We have to have something to talk about on Google Groups. ;-) Anthony On Friday, April 12, 2013 9:41:58 PM UTC-4, Jim S wrote: In the _select() ? On Apr 12, 2013 8:41 PM, Anthony abas...@gmail.com javascript: wrote: You can specify an orderby for the query. Anthony On Friday, April 12, 2013 8:20:38 PM UTC-4, Jim S wrote: So, that should allow me to sort though shouldn't it? On Apr 12, 2013 4:38 PM, Anthony abas...@gmail.com wrote: Well, a change was just made in trunk to allow '%(tablename.fieldname)s' notation, but it looks like the query retains only the fields in the main table (db.productSite in this case) anyway, so I guess that won't help. So instead, maybe: lambda r: db(db.product.productId == r.productId).select().first().** productName Anthony On Friday, April 12, 2013 1:56:34 PM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p**roductSiteId.belongs( **currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\**restricte**d.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/**in**focenter/controllers/**applicati**ons.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.**p**y, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/**in**focenter/controllers/**applicati**ons.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.**p**y, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.**p**y, line 1113, in __init__ inp = self.widgets.options.widget(field, default) File C:\dev\web2py\gluon\sqlhtml.**p**y, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\**validator**s.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\**validator**s.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/**in**focenter/controllers/**applicati**ons.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.com wrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p** roductSiteId.belongs(**currentIt**ems)) (db.productSite.**availableAddo**n==True) (db.productSite.siteId==**worko**rder.siteId) (db.product.productId==db.**pro** ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/
Re: [web2py] Re: How do I specify my display field here in IS_IN_DB?
That perfect. I'll get it going next week. Thanks for the help with this. Jim On Apr 12, 2013 8:57 PM, Anthony abasta...@gmail.com wrote: No, you can't do the ._select(). However, IS_IN_DB takes orderby, groupby, and distinct arguments (though not left, which presumably could be added) and uses them in the .select() that it does. You don't expect all this stuff to be documented, do you? We have to have something to talk about on Google Groups. ;-) Anthony On Friday, April 12, 2013 9:41:58 PM UTC-4, Jim S wrote: In the _select() ? On Apr 12, 2013 8:41 PM, Anthony abas...@gmail.com wrote: You can specify an orderby for the query. Anthony On Friday, April 12, 2013 8:20:38 PM UTC-4, Jim S wrote: So, that should allow me to sort though shouldn't it? On Apr 12, 2013 4:38 PM, Anthony abas...@gmail.com wrote: Well, a change was just made in trunk to allow '%(tablename.fieldname)s' notation, but it looks like the query retains only the fields in the main table (db.productSite in this case) anyway, so I guess that won't help. So instead, maybe: lambda r: db(db.product.productId == r.productId).select().first().*** *productName Anthony On Friday, April 12, 2013 1:56:34 PM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p roductSiteId.belongs(**currentItems)) (db.productSite.**availableAddon==True) (db.productSite.siteId==**workorder.siteId) (db.product.productId==db.**pro ductSite.productId)), db.productSite.productSiteId, lambda r: r.product.productName, zero='..') ...gives me... Traceback (most recent call last): File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 4291, in module File C:\dev\web2py\gluon\globals.**py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py**, line 2976, in f return action(*a, **b) File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 864, in workorderBom _formname='addonForm') File C:\dev\web2py\gluon\sqlhtml.**py, line 1599, in factory **attributes) File C:\dev\web2py\gluon\sqlhtml.**py, line 1113, in __init__ inp = self.widgets.options.widget(fi**eld, default) File C:\dev\web2py\gluon\sqlhtml.**py, line 252, in widget options = requires[0].options() File C:\dev\web2py\gluon\**validators.py, line 546, in options self.build_set() File C:\dev\web2py\gluon\**validators.py, line 543, in build_set self.labels = [self.label(r) for r in records] File C:/dev/web2py/applications/**infocenter/controllers/**applications.py http://10.10.2.34:8000/admin/default/edit/infocenter/controllers/applications.py, line 853, in lambda lambda r: r.product.productName, zero='..') AttributeError: 'Row' object has no attribute 'product' On Fri, Apr 12, 2013 at 12:10 PM, Jim Steil ato@gmail.comwrote: Shoot, should have thought of that. Will try when I get back to the office. Jim On Apr 12, 2013 12:04 PM, Anthony abas...@gmail.com wrote: It probably should work, but for some reason, the code converts the Row to a dict before doing the string formatting, and that breaks for Rows involving joins. For now, you can use a lambda instead: lambda r: r.product.productName Anthony On Friday, April 12, 2013 12:38:09 PM UTC-4, Jim S wrote: Tried that already but got the same error. Jim On Apr 12, 2013 11:32 AM, Anthony abas...@gmail.com wrote: Since you are joining tables, you might need to use the tablename.fieldname format to refer to the field in question. Does '%(product.productName)s' work (assuming productName is in the db.product table)? Anthony On Friday, April 12, 2013 11:59:59 AM UTC-4, Jim S wrote: requires = IS_IN_DB(db((~db.productSite.**p roductSiteId.belongs(**currentItems)) (db.productSite.**availableAddo** **n==True) (db.productSite.siteId==**worko** **rder.siteId) (db.product.productId==db.**pro** **ductSite.productId)), db.productSite.productSiteId, '%(productName)s', zero='..') I get a trace back with this. If I pull out the '%(productName)s' it works. But, I want to specify the field name to display being a field in the table linked by the 4 'anded' query. Help? -Jim -- --- You received this message because
[web2py] Re: Python 3 compatibility?
Web2py will never be ported to Python 3 (this is a lie, it was ported twice but it will never be official because it would break our promise of backward compatibility). We are working on web3py. It will work on Python 3 and Python 2. It will be different from web2py but, when on Python 2 it will run legacy web2py code. Massimo On Friday, 12 April 2013 19:51:23 UTC-5, twan...@gmail.com wrote: Hi, I'm interested (very interested) in a Python web framework that works with Python 3.x (3.3+, in particular). What is the status of web2py's py3 support? I found a late-2011 thread in this group where Massimo was betting that there would be a Python 2.8 and hence no pressing need to even care about 3.x. Me, I have no interest in 2.y, and if web2py doesn't support the current and in fact better version of Python then I will reluctantly have to look elsewhere. Thanks in advance, -- B -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: upgrading appengine has broken web2py
What version are you using Christian? On 12 Apr 2013 23:34, Christian Foster Howes cfho...@gmail.com wrote: i'm not having any problems with GAE + web2py.though i'm not fully upgraded on my web2py versions...perhaps i should do a test upgrade and see if i hit the same issues. On Friday, April 12, 2013 9:10:10 AM UTC-7, Carl wrote: Perhaps 2.5 isn't far away given 2.4.6 is out. I'll be happy to a version of web2py with it removed. On 12 April 2013 16:17, Massimo Di Pierro massimo@gmail.com wrote: I proposed in web2py 2.5 we remove the gql module. On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote: Removing the line from gluon.contrib.gql import * removed the error and allows my app to launch. I next run into this error: File F:\wp\TestEnvoy\web2py\gluon\main.py, line 555, in wsgibase session._try_store_in_db(**reque**st, response) File F:\wp\TestEnvoy\web2py\gluon\globals.py, line 747, in _try_store_in_db record_id = table.insert(**dd) File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 256, in insert id = self._create_id() File F:\wp\TestEnvoy\web2py\gluon\contrib\memdb.py, line 291, in _create_id id = self._tableobj.incr(shard_id) AttributeError: 'MemcacheClient' object has no attribute 'incr' One for me to investigate. On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote: has my db.py content fallen out of date? it includes: from gluon.sql import SQLCustomType if request.env.web2py_runtime_**gae**: # if running on Google App Engine from gluon.contrib.gql import * db = DAL('gae') On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote: actually.. while getting an unknown ticket if I request the url a second time I get this: File F:\wp\TestEnvoy\web2py\**applic**ations\init\models\db.**py, line 13, in module from gluon.contrib.gql import * File F:\wp\TestEnvoy\web2py\gluon\custom_import.py, line 100, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) ImportError: No module named gql That's fairly obvious because I've just delete gql.py! :) On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote: If I remove the file (and its .pyc) then I get a web2py Ticket issued: unknown I'll try upgrading again. On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote: What if you delete that file? On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote: With an update to appengine, all is still fine when running web2py locally. but if I run dev_appserver then on start-up I get the following kicked out at the console... File F:\wp\TestEnvoy\web2py\gluon\contrib\gql.py, line 5, in module from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType, gae ImportError: cannot import name *drivers* * * \contrib\gql.py exists for backward compatibility. This looks like I've tripped up somewhere really simple. Can anyone point me in the right direction? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/0XH6l1394mA/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.