[web2py] Connecting from LAN to wsdl file
Hello, Thanks for all of your post about connecting to web2py rocket server from my LAN. For me, using 0.0.0.0 was not accessible on my local pc or from my laptop. I used ipconfig to find the ipaddress and started web2py server using 192.168.1.65 on my pc. Then it was accessible from my laptop using 192.165.1.65:8000. However using http://192.168.1.65:8000/app/default/call/soap?WSDL does return the wsdl when accessed from my local machine but not when I try it from my laptop. Instead, an error saying invalid view (default/call.html) is returned in the browser. Is this normal behavior? When I try to acces from my laptop using soapUI I get an error loading WSDL dialog box: WSDLException (at /html): faultCode=INVALID_WSDL:Exception element '{http://schemas.xmlsoap.org/wsdl/}definitions'. Anyone have a clue what I'm missing? Very best regards, Bill P.S. I tried adding tags LAN, localhost, WSDL, soapUI to this post but got an error message. --
Re: [web2py] Connecting from LAN to wsdl file
Hello Bill: Generic views are disabled if you don't connect to localhost address (because they can be security risk) You can try to add this to your controller, call function: def call(): response.view = generic.html' Te best solution is to create a view default/call.html to display the webservice wsdl information page. IIRC it should contain something like: {{extend 'layout.html'}} {{=body}} Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Fri, Jul 20, 2012 at 3:22 AM, Bill Thayer bill.tha...@live.com wrote: Hello, Thanks for all of your post about connecting to web2py rocket server from my LAN. For me, using 0.0.0.0 was not accessible on my local pc or from my laptop. I used ipconfig to find the ipaddress and started web2py server using 192.168.1.65 on my pc. Then it was accessible from my laptop using 192.165.1.65:8000. However using http://192.168.1.65:8000/app/default/call/soap?WSDL does return the wsdl when accessed from my local machine but not when I try it from my laptop. Instead, an error saying invalid view (default/call.html) is returned in the browser. Is this normal behavior? When I try to acces from my laptop using soapUI I get an error loading WSDL dialog box: WSDLException (at /html): faultCode=INVALID_WSDL:Exception element '{http://schemas.xmlsoap.org/wsdl/}definitions'. Anyone have a clue what I'm missing? Very best regards, Bill P.S. I tried adding tags LAN, localhost, WSDL, soapUI to this post but got an error message. -- --
[web2py] how to use db connection multiple times with scheduler?
hi, I have to implement one scenario where scheduler will make the query to database periodically to retrieve data(lets say every 10 mins), i have written function inside model db.py to retrieve the data, and from controller i am staring the scheduler and assign the job to get the data periodically. Problem: when i request the function of controller where i am starting scheduler from web browser , its executing perfectly and display the data first time , after that it started throwing error ProgrammingError: Cannot operate on a closed database. continuously and i found that for each request models are executed DAL(...) statement and when action is done it will commit and rollback the db connection so because of that when scheduler tries to retrieve data second time from database using db , its throwing above mentioned error. Note: I am using sqlite databse and APScheduler.. How to implement this scenario where request come very first time i need to start scheduler and assign the job so periodically it should query to db and retrieve the data(second time onwards to db instance should be alive) ? --
Re: [web2py] Re: sqlform.grid search widget
I think that there is an argument for incorporating my solution into the standard sqlform grid and having a flag for switching between the query system or my simple text search. If the table is being presented in a web application for the great web public then they are going to expect searches to be 'google like'. Peter On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote: I think it will solve one of the issue I had with using sqlform.grid in place of sqltable + Datatables. Since Datatables has a pretty simple search/filter and my users knows how to use it than I would not remove this kind of easy search/filter functionality and leave them with only a harder more complex solution, so I stick with sqltable + Datatables even if sqlform.grid is much more interesting... Thank Peter. Richard On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote: Thanks for this I had not noticed that clear did not work, I guess I never use it. The problem is a type in the search_form function The fifth line should read id = 'search_text'), not id='searchText'), Does anyone know if I can edit the first message in this topic so as to correct it? Peter On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote: Works like a charm, but the Clear button is working exactly like the Search one, without clearing 'search_text' before submit Is there another method to do that? Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske escreveu: Good one. You earned a browser bookmark. Thanks. On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote: As I have commented before, sqlform.grid has a particular way of searching. Its combination of search and 'queries' is very powerful. However the search does not really work in the way a casual web user might expect. If entered - Bob Dylan - in the search box and clicked search, then one get 'invalid query'. I eventually worked out how to change the search widget, so as I believe this is currently undocumented I thought I would share it. The semantics I have chosen for search are that it will return records where any of the specified fields (fielda and fieldb in the example) contain all of the words in the search field. i.e if the search term is -Bob Dylan- it will return records that have both Bob and Dylan in the fieldA or both in fieldb. Define a search function that creates the form and a function that does the search def search_form(self,url): form = FORM('', INPUT(_name='search_text',_**value=request.get_vars.search_**text, _style='width:200px;', _id='searchText'), INPUT(_type='submit',_value=**T('Search')), INPUT(_type='submit',_value=**T('Clear'), _onclick=jQuery('#search_**text').val('');), _method=GET,_action=url) return form def search_query(tableid,search_**text,fields): words= search_text.split(' ') if search_text else [] query=tableid0#empty query for field in fields: new_query=tableid0 for word in words: new_query=new_queryfield.**contains(word) query=query|new_query return query Then in the function that has the sqlform.grid call, before the call add search_text=request.get_vars.**search_text query=search_query(db.tablea.**id http://db.tablea.id,search_text, [db.tablea.fielda,db.tablea.**fieldb]) ... # the query could now be combined with other queries. table=SQLFORM.grid(query, search_widget=search_form.**...) return dict(table=table) -- --
[web2py] Admin infinite loop on latest trunk
Just grabbed the latest trunk from Google Code, and got quite an annoying problem, which I'm guessing was due to the added CSRF checks (http://code.google.com/p/web2py/source/detail?r=26be4b6bb1b607fda73219c93ee3e72f4eecd681). Basically I try to login to the admin panel, and it asks for my password, I enter my password and it has generated a ticket and has heading Internal error, unfortunately I can't view the ticket until I've logged into admin . Infinite loops are annoying! Can you please fix this error? Thanks, Alec Taylor --
[web2py] Re: two references from one table to another.
Let's say your table name is from_to. Then you have something like arbitrary_last_name = 'Smith' # make this assignment at run time query = ( (db.auth_user.last_name==arbitrary_last_name) (db.auth_user.id==db.from_to.from_user) (db.from_to.to_user==db.auth_user.id) ) db(query).select(db.auth_user.first_name, db.auth_user) On Thursday, July 19, 2012 6:57:03 PM UTC-4, Ashraf Mansour wrote: Hi, The first table has two fields: * from_user , db.auth_user* * to_user , db.auth_user* both are referencing db.auth_user. How to get the list of records in the first table with the corresponding first_name of the two fields? I am confused, because I don't know how to differentiate the two field --- db.auth_user.name for the two fields. Regards, Ashraf --
Re: [web2py] Admin infinite loop on latest trunk
in gluon/validators.py replace line 2582: OLD: key = self.crypt.key.split(':')[1] if ':' in self.crypt.key else '' NEW: key = self.crypt.key.split(':')[1] if self.crypt.key and ':' in self.crypt.key else '' and restart web2py With the best regards, Vladyslav Kozlovskyy (Ukraine) 20.07.12 13:49, Alec Taylor ???(??): Just grabbed the latest trunk from Google Code, and got quite an annoying problem, which I'm guessing was due to the added CSRF checks (http://code.google.com/p/web2py/source/detail?r=26be4b6bb1b607fda73219c93ee3e72f4eecd681). Basically I try to login to the admin panel, and it asks for my password, I enter my password and it has generated a ticket and has heading Internal error, unfortunately I can't view the ticket until I've logged into admin . Infinite loops are annoying! Can you please fix this error? Thanks, Alec Taylor --
[web2py] Re: two references from one table to another.
Thank you for your time. But unfortunately, I don't understand. maybe the question is not clear enough. the query will be like *( db.from_to.from_user == db.auth_user.id ) ( db.from_to.to_user == db.auth_user.id )* How to select the two names? both are * db.auth_user.name* --
[web2py] Re: A Web2py CMS like Joomla ?
On Thu, 19 Jul 2012 13:06:09 -0300 Bruno Rocha rochacbr...@gmail.com wrote: Sorry community, but we do not have to expect a ready-to-use solution if nobody contributes with running code! Both projects are open source in github or bitbicket. get the source, propose patches, send pull requests. I understand the point, but as user of PHP CMS-es wanting to leave PHP and embrace web2py, I simply do not feet secure investing in the project with bus-factor of 1...seeing that community is a bit behind 'em woudl be great. Lets put our forces together and may be build the next-great-web2py-thing! it have not to be called Movuca, aldo it has not to be called Instant Press, but I think community should take these two projects as example and may be merge/fork/contribute. That would be great and hopefully there would be place to noob to contribute with some add-ons, themes etc. Sincerely, Gour -- The humble sages, by virtue of true knowledge, see with equal vision a learned and gentle brāhmana, a cow, an elephant, a dog and a dog-eater. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] Re: A Web2py CMS like Joomla ?
On Thu, 19 Jul 2012 18:03:19 -0300 Bruno Rocha rochacbr...@gmail.com wrote: IMHO the real question is *what is the cause of plugins little usage?* The misunderstanding of plugin system, to be honest I think the web2py plugin system is not good. Can you shed some more light on it, please? Now with modules, we can have a better base for plugin development. Excuse me for my ignorance, but what does it mean 'now with modules'? How 'new' are the modules in web2py? Sincerely, Gour -- The intricacies of action are very hard to understand. Therefore one should know properly what action is, what forbidden action is, and what inaction is. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] Making minor changes to auth.navbar()
Is there a simple way to make changes to the auth.navbar() helper object? For example, the default for a logged in user is: Welcome {First Name} Logouthttp://127.0.0.1:8000/main/default/user/logout?_next=/main/default/index| Profilehttp://127.0.0.1:8000/main/default/user/profile?_next=/main/default/index| Passwordhttp://127.0.0.1:8000/main/default/user/change_password?_next=/main/default/index I would like to change it to: '{Email} | Logout | Profile | Password but I'm not sure how to request the information I want when it's masked by the helper object. Thanks for your help. --
Re: [web2py] Re: x509 authentication
Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com sp1d...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- --
Re: [web2py] Re: x509 authentication
Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? Ahem... I stand corrected, you are right I just copied a comment in the code. The comment must be fixed. mic 2012/7/20 tiadobatima gbara...@gmail.com: Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- -- --
Re: [web2py] Re: sqlform.grid search widget
Maybe open a issue and summit a patch or your code... http://code.google.com/p/web2py/issues/list Richard On Fri, Jul 20, 2012 at 4:29 AM, peter peterchutchin...@gmail.com wrote: I think that there is an argument for incorporating my solution into the standard sqlform grid and having a flag for switching between the query system or my simple text search. If the table is being presented in a web application for the great web public then they are going to expect searches to be 'google like'. Peter On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote: I think it will solve one of the issue I had with using sqlform.grid in place of sqltable + Datatables. Since Datatables has a pretty simple search/filter and my users knows how to use it than I would not remove this kind of easy search/filter functionality and leave them with only a harder more complex solution, so I stick with sqltable + Datatables even if sqlform.grid is much more interesting... Thank Peter. Richard On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote: Thanks for this I had not noticed that clear did not work, I guess I never use it. The problem is a type in the search_form function The fifth line should read id = 'search_text'), not id='searchText'), Does anyone know if I can edit the first message in this topic so as to correct it? Peter On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote: Works like a charm, but the Clear button is working exactly like the Search one, without clearing 'search_text' before submit Is there another method to do that? Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske escreveu: Good one. You earned a browser bookmark. Thanks. On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote: As I have commented before, sqlform.grid has a particular way of searching. Its combination of search and 'queries' is very powerful. However the search does not really work in the way a casual web user might expect. If entered - Bob Dylan - in the search box and clicked search, then one get 'invalid query'. I eventually worked out how to change the search widget, so as I believe this is currently undocumented I thought I would share it. The semantics I have chosen for search are that it will return records where any of the specified fields (fielda and fieldb in the example) contain all of the words in the search field. i.e if the search term is -Bob Dylan- it will return records that have both Bob and Dylan in the fieldA or both in fieldb. Define a search function that creates the form and a function that does the search def search_form(self,url): form = FORM('', INPUT(_name='search_text',_**val**ue=request.get_vars.search_**tex**t, _style='width:200px;', _id='searchText'), INPUT(_type='submit',_value=**T**('Search')), INPUT(_type='submit',_value=**T**('Clear'), _onclick=jQuery('#search_**tex**t').val('');), _method=GET,_action=url) return form def search_query(tableid,search_**te**xt,fields): words= search_text.split(' ') if search_text else [] query=tableid0#empty query for field in fields: new_query=tableid0 for word in words: new_query=new_queryfield.**con**tains(word) query=query|new_query return query Then in the function that has the sqlform.grid call, before the call add search_text=request.get_vars.**s**earch_text query=search_query(db.tablea.**i**d http://db.tablea.id,search_text, [db.tablea.fielda,db.tablea.**fi**eldb]) ... # the query could now be combined with other queries. table=SQLFORM.grid(query, search_widget=search_form....) return dict(table=table) -- -- --
[web2py] Re: how to compare date time in web2py?
I'm not sure if web2py has something built-in to do this calculation but for other similar issues in the past I've just converted my dates to epoch and done the necessary math to see the difference between the two date-times. On Thursday, July 19, 2012 4:05:41 AM UTC-5, Amit wrote: Hi, I have some records in a table and each record is having one field of type datetime [fromat : 2012-07-19 23:12:0 (-MM-DD HH:MM:SS)], table structure is: Emp_ID Emp_Name Emp_Address Emp_Salary updated_on(Type: datetime) periodically getting data against each Emp_ID and updating to the particular record, every 20 mins data has to be updated for each Emp_ID, for e.g : suppose for one Emp_ID data has updated on 2012-07-19 10:10:00 then again it has to update on 2012-07-19 10:30:00 etc... and if data is not updated in 20 mins then one scheduler will verify against the updated_on column value and inform user that data has not updated for particular employee. Problem facing: How to compare current datetime with updated_on coulmn value in web2py? can anybody please share me the code to achieve the same? --
Re: [web2py] Re: A Web2py CMS like Joomla ?
Yes I was a bit disappear cause personal problems, I know there are some bugs reported, I'm a little busy at the moment but I have in mind to make changes to instant press. As bruno said I didn't get any contribution from the project, but is open source feel free to merge /fork or whatever. 2012/7/19 Bruno Rocha rochacbr...@gmail.com The only problem here is WHO will build the Killer web2py CMS? Instant Press is built by @Martin and I dont know if he gets contribution Movu.ca is built by @rochacbruno (me) and I did not get too much contribution (two or 3 people helped with ideas and translations) Sorry community, but we do not have to expect a ready-to-use solution if nobody contributes with running code! Both projects are open source in github or bitbicket. get the source, propose patches, send pull requests. Lets put our forces together and may be build the next-great-web2py-thing! it have not to be called Movuca, aldo it has not to be called Instant Press, but I think community should take these two projects as example and may be merge/fork/contribute. I made movu.ca for my own needs (http://www.menuvegano.com.br) - so I put all my efforts on my own needs, as I am a programmer, I dont need facilities, installers, plugins etc.. I think Martin has made IPress for his own needs. But we love open-source, and we shared our source codes expecting to receive contributions! I will be very happy if somebody gets Movu.ca source from github, fork, or only copy some ideas and release a new killer-cms for the community! The projects are open for you to put the hands on and code, change, propose! Lets go! -- -- http://www.tecnodoc.com.ar --
Re: [web2py] Re: how to compare date time in web2py?
On 20 Jul 2012, at 6:19 AM, Andrew wrote: I'm not sure if web2py has something built-in to do this calculation but for other similar issues in the past I've just converted my dates to epoch and done the necessary math to see the difference between the two date-times. web2py ordinarily deals with datetime fields as Python datetime objects, which can just be compared (with due allowance for timezones). request.now has the current local time as a datetime; request.utcnow has UTC. I use epoch dates myself in some cases, in particular to communicate with iOS clients through JSON, passing them as integers. The Python docs have quite a bit of material on manipulating dates, though it's a bit confusing in places. The modules of most interest are datetime, time and calendar. On Thursday, July 19, 2012 4:05:41 AM UTC-5, Amit wrote: Hi, I have some records in a table and each record is having one field of type datetime [fromat : 2012-07-19 23:12:0 (-MM-DD HH:MM:SS)], table structure is: Emp_ID Emp_Name Emp_Address Emp_Salary updated_on(Type: datetime) periodically getting data against each Emp_ID and updating to the particular record, every 20 mins data has to be updated for each Emp_ID, for e.g : suppose for one Emp_ID data has updated on 2012-07-19 10:10:00 then again it has to update on 2012-07-19 10:30:00 etc... and if data is not updated in 20 mins then one scheduler will verify against the updated_on column value and inform user that data has not updated for particular employee. Problem facing: How to compare current datetime with updated_on coulmn value in web2py? can anybody please share me the code to achieve the same? --
Re: [web2py] Admin infinite loop on latest trunk
Thanks, seems Massimo just fixed it also So thanks to both of you :) On Fri, Jul 20, 2012 at 9:39 PM, Vladyslav Kozlovskyy vld...@gmail.com wrote: in gluon/validators.py replace line 2582: OLD: key = self.crypt.key.split(':')[1] if ':' in self.crypt.key else '' NEW: key = self.crypt.key.split(':')[1] if self.crypt.key and ':' in self.crypt.key else '' and restart web2py With the best regards, Vladyslav Kozlovskyy (Ukraine) 20.07.12 13:49, Alec Taylor написав(ла): Just grabbed the latest trunk from Google Code, and got quite an annoying problem, which I'm guessing was due to the added CSRF checks (http://code.google.com/p/web2py/source/detail?r=26be4b6bb1b607fda73219c93ee3e72f4eecd681). Basically I try to login to the admin panel, and it asks for my password, I enter my password and it has generated a ticket and has heading Internal error, unfortunately I can't view the ticket until I've logged into admin . Infinite loops are annoying! Can you please fix this error? Thanks, Alec Taylor -- --
[web2py] Question about an xml file in use with a JS(jquery) Mappicker in web2py ...
Hello everyone ... I am trying to intergrate a jquery mappicker within my web2py app ! One of the js file calls upon an xml file containing the text information related to the location clicked on the map shown on screen ! the js function goes like this : ... ... ... $.ajax({ type: 'GET', url: 'xml/canadaMapSettings.xml', dataType: $.br$.ajax({ type: 'GET', url: 'xml/canadaMapSettings.xml', dataType: $.browser.msie ? 'text' : 'xml', success: function (data) {owser.msie ? 'text' : 'xml', success: function (data) { . ... as you see, the snippets of code above in the js file function calls upon the canadaMapSetting.xml First) please take note that this js file is in the js folder within the static folder of web2py Second) the canadaMapSetting.xml file has text information that I would want to be serialized by web2py for the presentation of these texts on the view page that uses it ( such as the Translate function T ) So my 2 questions are these : Primo: Can I have an xml file be serialized by web2py when it is called by a js file and where would I include this xml file .. ( I am thinking that the xml file has to be placed in the view folder !! ) ? which brings me to my second question ... : how would I call upon that xml file in the js file ... should i modified the way it is called in the ajax function above ??? ... should I just write url: 'canadaMapSettings.xml' or another way ??? Any clues or directives regarding this issue would be greatly appreciated ! thank you Don --
Re: [web2py] Re: Routing broke between 2012-06-18 and 2012-07-10
On Fri, Jul 13, 2012 at 4:32 AM, Anthony abasta...@gmail.com wrote: Hmm, I added that line (`auth.navbar(referrer_actions=['register', 'profile', 'login'])`) below `auth.settings.login_next = URL(f='profile')` in db.py, and it changed the way the problem occurs. No, you don't want 'login' to be one of the referrer_actions -- that will cause it to redirect to the referring page rather than the auth.settings.login_next URL. Anthony Okay, I tried with `auth.navbar(referrer_actions='profile')` and `auth.navbar(referrer_actions=['profile'])` and a few other permutations of what to put in that list, but all it's doing is redirecting me to: http://localhost/#_=_; (Specifically to brian.com/#_=_ with brian.com being set to 127.0.0.1 in /etc/hosts) Maybe I've put the line in the wrong part of my db.py. Here is my db.py: http://pastebin.com/huuTN0TF (Line 104 is where the line is) --
Re: [web2py] Admin infinite loop on latest trunk
you are welcome! :) 20.07.12 17:02, Alec Taylor написав(ла): Thanks, seems Massimo just fixed it also So thanks to both of you :) On Fri, Jul 20, 2012 at 9:39 PM, Vladyslav Kozlovskyy vld...@gmail.com wrote: in gluon/validators.py replace line 2582: OLD: key = self.crypt.key.split(':')[1] if ':' in self.crypt.key else '' NEW: key = self.crypt.key.split(':')[1] if self.crypt.key and ':' in self.crypt.key else '' and restart web2py With the best regards, Vladyslav Kozlovskyy (Ukraine) 20.07.12 13:49, Alec Taylor написав(ла): Just grabbed the latest trunk from Google Code, and got quite an annoying problem, which I'm guessing was due to the added CSRF checks (http://code.google.com/p/web2py/source/detail?r=26be4b6bb1b607fda73219c93ee3e72f4eecd681). Basically I try to login to the admin panel, and it asks for my password, I enter my password and it has generated a ticket and has heading Internal error, unfortunately I can't view the ticket until I've logged into admin . Infinite loops are annoying! Can you please fix this error? Thanks, Alec Taylor -- --
[web2py] http://www.web2pyslices.com/ is down
http://www.web2pyslices.com/ is down Richard --
[web2py] Re: Question about an xml file in use with a JS(jquery) Mappicker in web2py ...
Sorry .. it is not called a mappicker but an interactive map --
[web2py] Re: Making minor changes to auth.navbar()
Unfortunately, the navbar isn't very flexible. However, it returns an HTML helper object (a SPAN with several components), so you can manipulate it after creation. The part after Welcome is the second component of the span, so: navbar = auth.navbar() if auth.user: navbar[1] = auth.user.email #replace first name with email del navbar[0] # remove Welcome Anthony On Friday, July 20, 2012 4:35:25 AM UTC-4, Matt Newton wrote: Is there a simple way to make changes to the auth.navbar() helper object? For example, the default for a logged in user is: Welcome {First Name} Logouthttp://127.0.0.1:8000/main/default/user/logout?_next=/main/default/index| Profilehttp://127.0.0.1:8000/main/default/user/profile?_next=/main/default/index| Passwordhttp://127.0.0.1:8000/main/default/user/change_password?_next=/main/default/index I would like to change it to: '{Email} | Logout | Profile | Password but I'm not sure how to request the information I want when it's masked by the helper object. Thanks for your help. --
[web2py] Re: A Web2py CMS like Joomla ?
Sorry community, but we do not have to expect a ready-to-use solution if nobody contributes with running code! Both projects are open source in github or bitbicket. get the source, propose patches, send pull requests. I understand the point, but as user of PHP CMS-es wanting to leave PHP and embrace web2py, I simply do not feet secure investing in the project with bus-factor of 1...seeing that community is a bit behind 'em woudl be great. I guess that's the problem. You want others to contribute and generate some traction before getting involved yourself. That's perfectly reasonable, but of course, if everyone feels that way, nothing will happen. Anthony --
[web2py] Re: Unable to login to admin in trunk
can you please try again? On Thursday, 19 July 2012 18:17:11 UTC-5, JohnB wrote: Using Version 2.00.0 (2012-07-19 16:56:40) dev $python web2py.py Enter pw and start server. Starts up OK in welcome app. Click on goto admin button and get login screen. Enter pw and get admin error ticket. Has password hash in parameters_8000.py Help? --
Re: [web2py] Re: x509 authentication
I'll wait for the patch. On Friday, 20 July 2012 07:51:37 UTC-5, Michele Comitini wrote: Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? Ahem... I stand corrected, you are right I just copied a comment in the code. The comment must be fixed. mic 2012/7/20 tiadobatima gbara...@gmail.com: Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- -- --
[web2py] Re: A Web2py CMS like Joomla ?
On Fri, 20 Jul 2012 08:07:50 -0700 (PDT) Anthony abasta...@gmail.com wrote: I guess that's the problem. You want others to contribute and generate some traction before getting involved yourself. That's perfectly reasonable, but of course, if everyone feels that way, nothing will happen. Well, I'm noob and not capable to contribute in a significant way to mold a project into robust/decent app, but I hope/beleive there are other more advanced users who would like to have good CMS powered by web2py and/or are capable to contibute. Web2py is not so young project, so it's reasonable that 'oldtimers' are providing some infrastructure (besides framework itself) on which new users/devs can jump on. Sincerely, Gour -- While contemplating the objects of the senses, a person develops attachment for them, and from such attachment lust develops, and from lust anger arises. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] Re: A Web2py CMS like Joomla ?
On Fri, 20 Jul 2012 10:32:21 -0300 Martín Mulone mulone.mar...@gmail.com wrote: Yes I was a bit disappear cause personal problems, I know there are some bugs reported, I'm a little busy at the moment but I have in mind to make changes to instant press. I'm sorry hearing about your problems hoping you will resolve it. As bruno said I didn't get any contribution from the project, but is open source feel free to merge /fork or whatever. I'm aware there were no contribution to InstantPress which is a pity considering it looks very nice and it might become nice CMS/blog platform in the web2py's ecosystem... Sincerely, Gour -- He who is satisfied with gain which comes of its own accord, who is free from duality and does not envy, who is steady in both success and failure, is never entangled, although performing actions. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] Re: Question about an xml file in use with a JS(jquery) Mappicker in web2py ...
As far as I know, web2py does not work directly with XML. It can output to xml automatically, and serializes, but as far as working with xml as data, I don't think it has anything like that. You should be able to use the python standard libraries for that. I prefer xml.dom.minidom, but I've heard good things about xml.etree.ElementTree. If you are familiar with jQuery, I believe you can use it's selectors to parse XML also. I think the preferred way of working with xml in web2py is to import the data into a database and use DAL for your queries. Hmm, for some reason I can't get to web2py.com right now, so I can't check the documentation on that. On Friday, July 20, 2012 7:11:27 AM UTC-7, Don_X wrote: Hello everyone ... I am trying to intergrate a jquery mappicker within my web2py app ! One of the js file calls upon an xml file containing the text information related to the location clicked on the map shown on screen ! the js function goes like this : ... ... ... $.ajax({ type: 'GET', url: 'xml/canadaMapSettings.xml', dataType: $.br$.ajax({ type: 'GET', url: 'xml/canadaMapSettings.xml', dataType: $.browser.msie ? 'text' : 'xml', success: function (data) {owser.msie ? 'text' : 'xml', success: function (data) { . ... as you see, the snippets of code above in the js file function calls upon the canadaMapSetting.xml First) please take note that this js file is in the js folder within the static folder of web2py Second) the canadaMapSetting.xml file has text information that I would want to be serialized by web2py for the presentation of these texts on the view page that uses it ( such as the Translate function T ) So my 2 questions are these : Primo: Can I have an xml file be serialized by web2py when it is called by a js file and where would I include this xml file .. ( I am thinking that the xml file has to be placed in the view folder !! ) ? which brings me to my second question ... : how would I call upon that xml file in the js file ... should i modified the way it is called in the ajax function above ??? ... should I just write url: 'canadaMapSettings.xml' or another way ??? Any clues or directives regarding this issue would be greatly appreciated ! thank you Don --
[web2py] web2py.com offline
can't get to the website today. --
[web2py] Dreadful IE trick spewing out lots of 'x' chars when raising HTTP(4xx)
Hi guys, Raising a 4xx exception is printing extra 512 'x' characters in the body. This seems to be the culprit (HTTP.py): if len(body)512 and self.headers['Content-Type'].startswith( 'text/html'): body += '!-- %s //--' % ('x'*512) ### trick IE Is there any easy way of not printing these extra characters without chaging HTTP.py? Long term, It would be nice if there was switch to turn this off, maybe an user-agent argument in the constructor? The current behaviour is not great for REST APIs. Thanks! :) g. --
[web2py] Unions and select from tables
I am trying to work in Web2py's union method and am wondering a few things if I have a query *db( (db.sample.id0) and (db.example.id0) and (db.random.id0)).select()* I would like to know how to orderby the latest ids as well when I am displaying a page link *a href={{=URL('view', 'page1', args=row.id)}}* or whatever I may have a another page to link to with in the loop *a href={{=URL('view', 'page2', args=row.id)}} * How can I do a check to see what table I am selecting from if row == table1: display_this_link elif row == table2: display 2nd link *cheers and ty :-) --
[web2py] Re: Unable to login to admin in trunk
~/web2py$ python web2py.py --nogui web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 2.00.0 (2012-07-20 10:31:02) dev Database drivers available: SQLite3, pymysql, pg8000, IMAP choose a password: please visit: http://127.0.0.1:8000 use kill -SIGTERM 20312 to shutdown the web2py server Traceback (most recent call last): File web2py.py, line 25, in module gluon.widget.start(cron=True) File /Users/jlb/web2py/gluon/widget.py, line 1065, in start interfaces=options.interfaces) File /Users/jlb/web2py/gluon/main.py, line 783, in __init__ save_password(password, port) File /Users/jlb/web2py/gluon/main.py, line 648, in save_password fp.write('password=%s\n' % cpassword) File /Users/jlb/web2py/gluon/validators.py, line 2574, in __str__ hashed = simple_hash(self.password, masterkey, digest_alg) File /Users/jlb/web2py/gluon/utils.py, line 46, in simple_hash return hmac_hash(text, salt, digest_alg) File /Users/jlb/web2py/gluon/utils.py, line 87, in hmac_hash int(keylen),get_digest(alg)) File /Users/jlb/web2py/gluon/utils.py, line 72, in get_digest raise ValueError(Invalid digest algorithm) ValueError: Invalid digest algorithm --
Re: [web2py] How do we check the number of users in the new google groups?
How about when you're a group owner? The groups that I started don't allow me to see the number of subscribers...thoughts? On Friday, March 30, 2012 10:17:39 AM UTC-4, Anthony wrote: How do we check the number of users in the new google groups? Everything is so complicated compared to the old google groups. :-( Showing 50 of 3709 members https://groups.google.com/forum/?fromgroups#!members/web2py Via the Members button in the upper right, which is only visible from the topics list view (not when viewing individual topics). I'm not sure there is any longer a way to see the number of posts per month as in the old version. Anthony --
[web2py] Re: Question about an xml file in use with a JS(jquery) Mappicker in web2py ...
More information regarding this initiative : the scripts used for the interactive map is the one found at : http://codecanyon.net/item/interactive-svg-canada-map/2355460 It is said to be XML driven and i wish to port it to my web2py app. . But i am hitting a wall with this ! ... the xml file is used as data source for the JS ( jquery ) I have looked at various alternatives to xml on the web for interaction possibility with various scripting languages like JS, or Python etc .. I know there is YAML I am thinking that YAML can replace the xml method for data interaction with the js script .. and possibly be also serialized by web2py for translation (T) ?? ... can anyone help me with this or shed some light about this for me ... I am stuck ..??? .. thank you --
[web2py] Re: Unable to login to admin in trunk
Hi, It's still not resolved El viernes, 20 de julio de 2012 12:22:01 UTC-4, Massimo Di Pierro escribió: can you please try again? Traceback (most recent call last): File web2py.py, line 25, in module gluon.widget.start(cron=True) File /home/dantoac/web2py_git/gluon/widget.py, line 1065, in start interfaces=options.interfaces) File /home/dantoac/web2py_git/gluon/main.py, line 783, in __init__ save_password(password, port) File /home/dantoac/web2py_git/gluon/main.py, line 648, in save_password fp.write('password=%s\n' % cpassword) File /home/dantoac/web2py_git/gluon/validators.py, line 2574, in __str__ hashed = simple_hash(self.password, masterkey, digest_alg) File /home/dantoac/web2py_git/gluon/utils.py, line 46, in simple_hash return hmac_hash(text, salt, digest_alg) File /home/dantoac/web2py_git/gluon/utils.py, line 87, in hmac_hash int(keylen),get_digest(alg)) File /home/dantoac/web2py_git/gluon/utils.py, line 72, in get_digest raise ValueError(Invalid digest algorithm: %s % value) ValueError: Invalid digest algorithm: sh512 --
Re: [web2py] Re: Unable to login to admin in trunk
On 20 Jul 2012, at 11:03 AM, Daniel Aguayo wrote: Hi, It's still not resolved Yeah, that was just for diagnostic purposes. Find where you're specifying 'sh512' and change it to 'sha512'. El viernes, 20 de julio de 2012 12:22:01 UTC-4, Massimo Di Pierro escribió: can you please try again? Traceback (most recent call last): File web2py.py, line 25, in module gluon.widget.start(cron=True) File /home/dantoac/web2py_git/gluon/widget.py, line 1065, in start interfaces=options.interfaces) File /home/dantoac/web2py_git/gluon/main.py, line 783, in __init__ save_password(password, port) File /home/dantoac/web2py_git/gluon/main.py, line 648, in save_password fp.write('password=%s\n' % cpassword) File /home/dantoac/web2py_git/gluon/validators.py, line 2574, in __str__ hashed = simple_hash(self.password, masterkey, digest_alg) File /home/dantoac/web2py_git/gluon/utils.py, line 46, in simple_hash return hmac_hash(text, salt, digest_alg) File /home/dantoac/web2py_git/gluon/utils.py, line 87, in hmac_hash int(keylen),get_digest(alg)) File /home/dantoac/web2py_git/gluon/utils.py, line 72, in get_digest raise ValueError(Invalid digest algorithm: %s % value) ValueError: Invalid digest algorithm: sh512 --
[web2py] Routing by SLUG with default controller?
I've got a system with users, groups and group-events. Preferably I would like the following routing schemes: localhost/groupSLUGhere/ localhost/groupSLUGhere/eventIDhere localhost/profile/usernameHere How would I go about setting this up? Currently the system is very fiddly, even for doing simple redirects... e.g.: I need to use `URL(, groups)` rather than `URL(groups)`. Thanks for all suggestions, Alec Taylor FYI: I'll be open-sourcing this system following August 2 --
Re: [web2py] http://www.web2pyslices.com/ is down
Yeah, sorry. I have to upgrade my Linode, also, bots from google and baidu are eating my server. I need to solve some sessions problems. I will upgrade the Linode for webslices and also I will put a bigger donate, sponsor link in web2pyslices website, I am paying backups and hosting by my own, and I think I can get some donation from a company. May be I will talk to PythonAnywhere to host the slices website for free and get a banner in the site! *Bruno Cezar Rocha* http://www.CursoDePython.com.br [image: Facebook] http://facebook.com/rochacbruno [image: Twitter]http://twitter.com/rochacbruno [image: LinkedIn] http://linkedin.com/in/rochacbruno [image: about.me]http://about.me/rochacbruno [image: Amazon] http://amazon.com/author/rochacbruno [image: AngelList]http://angel.co/rochacbruno [image: Blog RSS] http://www.web2pyslices.com/slice/list.rss?author=1 [image: Facebook Page] http://facebook.com/CursoDePython [image: foursquare]http://foursquare.com/rochacbruno [image: Google Plus] https://plus.google.com/u/0/116110204708544946953/posts [image: pinterest] http://pinterest.com/rochacbruno [image: SlideShare]http://slideshare.com/rochacbruno [image: YouTube] http://youtube.com/user/brunovegan [image: Google Talk] rochacbruno [image: Skype] blouweb Get a signature like this. http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18 Click here.http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18 On Fri, Jul 20, 2012 at 11:40 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: http://www.web2pyslices.com/ is down Richard -- --
Re: [web2py] web2py.com offline
Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com wrote: can't get to the website today. -- --
Re: [web2py] Routing by SLUG with default controller?
On 20 Jul 2012, at 11:38 AM, Alec Taylor wrote: I've got a system with users, groups and group-events. Preferably I would like the following routing schemes: localhost/groupSLUGhere/ localhost/groupSLUGhere/eventIDhere localhost/profile/usernameHere Where do you want these URLs to route (in terms of controller/function)? How would I go about setting this up? Currently the system is very fiddly, even for doing simple redirects... e.g.: I need to use `URL(, groups)` rather than `URL(groups)`. Thanks for all suggestions, Alec Taylor FYI: I'll be open-sourcing this system following August 2 --
[web2py] Re: Unions and select from tables
I see what you are doing and I like it. I think it may be tricky to implement but I look forward to see what you come up to. I think: *db( (db.sample.id0) and (db.example.id0) and (db.random.id0)).select()* * * should be * * *db( (db.sample.id0) (db.example.id0) (db.random.id0)).select()* * * since and is a reserved keyword and cannot be overloaded. I think you are asking about select(orderby=*~db.sample.id)* On Friday, 20 July 2012 11:03:30 UTC-5, ade wrote: I am trying to work in Web2py's union method and am wondering a few things if I have a query *db( (db.sample.id0) and (db.example.id0) and (db.random.id0)).select() * I would like to know how to orderby the latest ids as well when I am displaying a page link *a href={{=URL('view', 'page1', args=row.id)}}* or whatever I may have a another page to link to with in the loop *a href={{=URL('view', 'page2', args=row.id)}} * How can I do a check to see what table I am selecting from if row == table1: display_this_link elif row == table2: display 2nd link *cheers and ty :-) --
Re: [web2py] Routing by SLUG with default controller?
On Sat, Jul 21, 2012 at 4:41 AM, Jonathan Lundell jlund...@pobox.com wrote: On 20 Jul 2012, at 11:38 AM, Alec Taylor wrote: I've got a system with users, groups and group-events. Preferably I would like the following routing schemes: localhost/groupSLUGhere/ controllers/groups.py localhost/groupSLUGhere/eventIDhere controllers/events.py localhost/profile/usernameHere controllers/profile.py Where do you want these URLs to route (in terms of controller/function)? Thanks for asking, please see above for inline reference. How would I go about setting this up? Currently the system is very fiddly, even for doing simple redirects... e.g.: I need to use `URL(, groups)` rather than `URL(groups)`. Thanks for all suggestions, Alec Taylor FYI: I'll be open-sourcing this system following August 2 -- --
Re: [web2py] Re: Unable to login to admin in trunk
El viernes, 20 de julio de 2012 14:24:01 UTC-4, Jonathan Lundell escribió: On 20 Jul 2012, at 11:03 AM, Daniel Aguayo wrote: Hi, It's still not resolved Yeah, that was just for diagnostic purposes. Find where you're specifying 'sh512' and change it to 'sha512'. Hi Jonathan I know, I was just giving you feedback Thank you :) --
Re: [web2py] web2py.com offline
By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.comwrote: can't get to the website today. -- --
[web2py] Re: Dreadful IE trick spewing out lots of 'x' chars when raising HTTP(4xx)
The rest about should not have: self.headers['Content-Type'].startswith('text/html') If they do you need the extra comment else IE will not display the rest of the error message. On Friday, 20 July 2012 12:22:50 UTC-5, tiadobatima wrote: Hi guys, Raising a 4xx exception is printing extra 512 'x' characters in the body. This seems to be the culprit (HTTP.py): if len(body)512 and self.headers['Content-Type'].startswith( 'text/html'): body += '!-- %s //--' % ('x'*512) ### trick IE Is there any easy way of not printing these extra characters without chaging HTTP.py? Long term, It would be nice if there was switch to turn this off, maybe an user-agent argument in the constructor? The current behaviour is not great for REST APIs. Thanks! :) g. --
[web2py] Re: Unable to login to admin in trunk
my bad. fixed. On Friday, 20 July 2012 13:03:36 UTC-5, Daniel Aguayo wrote: Hi, It's still not resolved El viernes, 20 de julio de 2012 12:22:01 UTC-4, Massimo Di Pierro escribió: can you please try again? Traceback (most recent call last): File web2py.py, line 25, in module gluon.widget.start(cron=True) File /home/dantoac/web2py_git/gluon/widget.py, line 1065, in start interfaces=options.interfaces) File /home/dantoac/web2py_git/gluon/main.py, line 783, in __init__ save_password(password, port) File /home/dantoac/web2py_git/gluon/main.py, line 648, in save_password fp.write('password=%s\n' % cpassword) File /home/dantoac/web2py_git/gluon/validators.py, line 2574, in __str__ hashed = simple_hash(self.password, masterkey, digest_alg) File /home/dantoac/web2py_git/gluon/utils.py, line 46, in simple_hash return hmac_hash(text, salt, digest_alg) File /home/dantoac/web2py_git/gluon/utils.py, line 87, in hmac_hash int(keylen),get_digest(alg)) File /home/dantoac/web2py_git/gluon/utils.py, line 72, in get_digest raise ValueError(Invalid digest algorithm: %s % value) ValueError: Invalid digest algorithm: sh512 --
Re: [web2py] web2py.com offline
Its working now, thanks! On Friday, 20 July 2012 12:48:09 UTC-6, Massimo Di Pierro wrote: By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.comwrote: can't get to the website today. -- --
Re: [web2py] Routing by SLUG with default controller?
On 20 Jul 2012, at 11:45 AM, Alec Taylor wrote: On Sat, Jul 21, 2012 at 4:41 AM, Jonathan Lundell jlund...@pobox.com wrote: On 20 Jul 2012, at 11:38 AM, Alec Taylor wrote: I've got a system with users, groups and group-events. Preferably I would like the following routing schemes: localhost/groupSLUGhere/ controllers/groups.py localhost/groupSLUGhere/eventIDhere controllers/events.py localhost/profile/usernameHere controllers/profile.py Where do you want these URLs to route (in terms of controller/function)? Thanks for asking, please see above for inline reference. One possibility. With the parametric router, combine groups and events into one controller, and handle your first two cases in its default function. In that case, the routed URL will be localhost/default/index/groupSLUG/eventID, where the slug and ID would be in request.args. The default function would look at request.args and dispatch to the appropriate internal functions. You'd need to give the router a list of functions in the default controller. For the profile URLs, either make profile a function in the default controller (it'll be routed to localhost/default/profile/username, with username in request.args), or if profile really needs to be a separate controller, provide a list of its functions as well (in that case the functions item in the router needs to be a dict). The general idea is that the router needs to fill in a controller and function, pushing your slugs c to args. How would I go about setting this up? Currently the system is very fiddly, even for doing simple redirects... e.g.: I need to use `URL(, groups)` rather than `URL(groups)`. Thanks for all suggestions, Alec Taylor FYI: I'll be open-sourcing this system following August 2 --
Re: [web2py] web2py.com offline
Anyway, considering they have different hosting it is suspicious they went down at the same time. In web2py.com apache was not running but was not able to restart because could not bind to 0.0.0.0:80. I had to reboot. I have not seen this problem before. I was always able to simply restart apache. massimo --
Re: [web2py] web2py.com offline
I could not be able to restart NGINX/UWSGI, I am waiting my backups to finish and I will need to restart my Linode. The same problem :/ On Fri, Jul 20, 2012 at 3:58 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Anyway, considering they have different hosting it is suspicious they went down at the same time. In web2py.com apache was not running but was not able to restart because could not bind to 0.0.0.0:80. I had to reboot. I have not seen this problem before. I was always able to simply restart apache. massimo -- --
[web2py] Re: Unions and select from tables
Does that mean sample, example, random have to have identical structures ? What if I just want the id and name columns ? How do I select just those in a union scenario? I know massimo doesn't like unions, but they are required sometimes. I am visualizing object relationships in a graph (picture something like http://bost.ocks.org/mike/fisheye ) and I want to get one list of nodes. I've only done it with executesql so far. --
Re: [web2py] Routing by SLUG with default controller?
I dont know if it is a bug or feature (but I like it), you can do it in models! models/0_routing.py if request.controller in MYLISTOFGROUPS: groupslug = str(request.controller) # here you can use deep copy or just str() request.controller = 'group' request.function = 'show' request.args[0] = groupslug controllers/group.py def show() group = db(db.groups.slug==request.args(0)).select() return dict(group=group) --
Re: [web2py] Routing by SLUG with default controller?
On 20 Jul 2012, at 12:03 PM, Bruno Rocha wrote: I dont know if it is a bug or feature (but I like it), you can do it in models! That works too, but you need be careful in your generation of outgoing URLs. It might be best to check request.controller for known controllers (default, profile, appadmin, whatever) and just default to the group handler. models/0_routing.py if request.controller in MYLISTOFGROUPS: groupslug = str(request.controller) # here you can use deep copy or just str() request.controller = 'group' request.function = 'show' request.args[0] = groupslug controllers/group.py def show() group = db(db.groups.slug==request.args(0)).select() return dict(group=group) --
Re: [web2py] Routing by SLUG with default controller?
Thanks, but I'm a little uncertain how to get the list of groups, I tried `if request.controller in db(db.group_of_events).select(orderby=db.group_of_events.group_name)`, but that didn't work. Here's an extremely simplified version of my tables (if that's of help): db.define_table( 'group_of_events', Field('group_name', notnull=True, requires=[IS_NOT_IN_DB(db, 'group_of_events.group_name'), IS_SLUG()]), format='%(group_name)s' ) db.define_table( 'event', Field('event_name', notnull=True), Field('group_id', 'reference db.group_of_events', notnull=True, requires=IS_IN_DB(db, db.group_of_events, '%(group_name)s')), format='%(event_name)s' ) On Sat, Jul 21, 2012 at 5:03 AM, Bruno Rocha rochacbr...@gmail.com wrote: I dont know if it is a bug or feature (but I like it), you can do it in models! models/0_routing.py if request.controller in MYLISTOFGROUPS: groupslug = str(request.controller) # here you can use deep copy or just str() request.controller = 'group' request.function = 'show' request.args[0] = groupslug controllers/group.py def show() group = db(db.groups.slug==request.args(0)).select() return dict(group=group) -- --
Re: [web2py] Routing by SLUG with default controller?
On 20 Jul 2012, at 12:11 PM, Alec Taylor wrote: Thanks, but I'm a little uncertain how to get the list of groups, I tried `if request.controller in db(db.group_of_events).select(orderby=db.group_of_events.group_name)`, but that didn't work. You need to specify a field in the select, before the orderby. But that's a lot of overhead to incur on every request. Better to check for known controllers instead. Here's an extremely simplified version of my tables (if that's of help): db.define_table( 'group_of_events', Field('group_name', notnull=True, requires=[IS_NOT_IN_DB(db, 'group_of_events.group_name'), IS_SLUG()]), format='%(group_name)s' ) db.define_table( 'event', Field('event_name', notnull=True), Field('group_id', 'reference db.group_of_events', notnull=True, requires=IS_IN_DB(db, db.group_of_events, '%(group_name)s')), format='%(event_name)s' ) On Sat, Jul 21, 2012 at 5:03 AM, Bruno Rocha rochacbr...@gmail.com wrote: I dont know if it is a bug or feature (but I like it), you can do it in models! models/0_routing.py if request.controller in MYLISTOFGROUPS: groupslug = str(request.controller) # here you can use deep copy or just str() request.controller = 'group' request.function = 'show' request.args[0] = groupslug controllers/group.py def show() group = db(db.groups.slug==request.args(0)).select() return dict(group=group) --
Re: [web2py] Routing by SLUG with default controller?
On Sat, Jul 21, 2012 at 5:15 AM, Jonathan Lundell jlund...@pobox.com wrote: On 20 Jul 2012, at 12:11 PM, Alec Taylor wrote: Thanks, but I'm a little uncertain how to get the list of groups, I tried `if request.controller in db(db.group_of_events).select(orderby=db.group_of_events.group_name)`, but that didn't work. You need to specify a field in the select, before the orderby. But that's a lot of overhead to incur on every request. Better to check for known controllers instead. Your probably right. Also, I seem to be getting error after error after choosing `ALL`. I'll try your method tomorrow (it's past 5AM here). Would you be able to elaborate on your method, perhaps referencing documentation? - I was having trouble finding documentation before Mr Rocha suggested his technique... would you be able to present a small code sample otherwise? Thanks for your patience, Alec Taylor Here's an extremely simplified version of my tables (if that's of help): db.define_table( 'group_of_events', Field('group_name', notnull=True, requires=[IS_NOT_IN_DB(db, 'group_of_events.group_name'), IS_SLUG()]), format='%(group_name)s' ) db.define_table( 'event', Field('event_name', notnull=True), Field('group_id', 'reference db.group_of_events', notnull=True, requires=IS_IN_DB(db, db.group_of_events, '%(group_name)s')), format='%(event_name)s' ) On Sat, Jul 21, 2012 at 5:03 AM, Bruno Rocha rochacbr...@gmail.com wrote: I dont know if it is a bug or feature (but I like it), you can do it in models! models/0_routing.py if request.controller in MYLISTOFGROUPS: groupslug = str(request.controller) # here you can use deep copy or just str() request.controller = 'group' request.function = 'show' request.args[0] = groupslug controllers/group.py def show() group = db(db.groups.slug==request.args(0)).select() return dict(group=group) -- --
Re: [web2py] Routing by SLUG with default controller?
On 20 Jul 2012, at 12:19 PM, Alec Taylor wrote: On Sat, Jul 21, 2012 at 5:15 AM, Jonathan Lundell jlund...@pobox.com wrote: On 20 Jul 2012, at 12:11 PM, Alec Taylor wrote: Thanks, but I'm a little uncertain how to get the list of groups, I tried `if request.controller in db(db.group_of_events).select(orderby=db.group_of_events.group_name)`, but that didn't work. You need to specify a field in the select, before the orderby. But that's a lot of overhead to incur on every request. Better to check for known controllers instead. Your probably right. Also, I seem to be getting error after error after choosing `ALL`. I'll try your method tomorrow (it's past 5AM here). Would you be able to elaborate on your method, perhaps referencing documentation? - I was having trouble finding documentation before Mr Rocha suggested his technique... would you be able to present a small code sample otherwise? Have a look at router.example.py; there's also some explanatory material in the book. If that's not clear, I can help you create a router. I use the model-based scheme myself for some purposes, and it's fairly simple. If you want all three of your controllers, you'd want to do something like: if request.controller in ('profile', 'default', 'appadmin', 'group', 'event'): handle the known controllers elif request.function == 'index': # if the incoming URL had no 'function', and web2py filled in the default function request.args[0] = request.controller request.controller = 'group' else request.args[0] = request.controller request.args[1] = request.function request.controller = 'event' Thanks for your patience, --
Re: [web2py] web2py.com offline
What, you removed the book? On Friday, July 20, 2012 11:48:09 AM UTC-7, Massimo Di Pierro wrote: By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.comwrote: can't get to the website today. -- --
Re: [web2py] Routing by SLUG with default controller?
Thanks, I'll give that a go tomorrow. To confirm, I am adding that in a file located at the same level as `applications` in the `web2py` root folder, to a filename `router.py`? On Sat, Jul 21, 2012 at 5:30 AM, Jonathan Lundell jlund...@pobox.com wrote: On 20 Jul 2012, at 12:19 PM, Alec Taylor wrote: On Sat, Jul 21, 2012 at 5:15 AM, Jonathan Lundell jlund...@pobox.com wrote: On 20 Jul 2012, at 12:11 PM, Alec Taylor wrote: Thanks, but I'm a little uncertain how to get the list of groups, I tried `if request.controller in db(db.group_of_events).select(orderby=db.group_of_events.group_name)`, but that didn't work. You need to specify a field in the select, before the orderby. But that's a lot of overhead to incur on every request. Better to check for known controllers instead. Your probably right. Also, I seem to be getting error after error after choosing `ALL`. I'll try your method tomorrow (it's past 5AM here). Would you be able to elaborate on your method, perhaps referencing documentation? - I was having trouble finding documentation before Mr Rocha suggested his technique... would you be able to present a small code sample otherwise? Have a look at router.example.py; there's also some explanatory material in the book. If that's not clear, I can help you create a router. I use the model-based scheme myself for some purposes, and it's fairly simple. If you want all three of your controllers, you'd want to do something like: if request.controller in ('profile', 'default', 'appadmin', 'group', 'event'): handle the known controllers elif request.function == 'index': # if the incoming URL had no 'function', and web2py filled in the default function request.args[0] = request.controller request.controller = 'group' else request.args[0] = request.controller request.args[1] = request.function request.controller = 'event' Thanks for your patience, -- --
[web2py] Re: Dreadful IE trick spewing out lots of 'x' chars when raising HTTP(4xx)
Hi Massimo, I see. But how do I set the Content-Type when raising HTTP(400)? I'm assuming this Content-Type set automatically when when the exception is raised. Do I have any control over it? Thanks :) g. On Friday, 20 July 2012 11:49:58 UTC-7, Massimo Di Pierro wrote: The rest about should not have: self.headers['Content-Type'].startswith('text/html') If they do you need the extra comment else IE will not display the rest of the error message. On Friday, 20 July 2012 12:22:50 UTC-5, tiadobatima wrote: Hi guys, Raising a 4xx exception is printing extra 512 'x' characters in the body. This seems to be the culprit (HTTP.py): if len(body)512 and self.headers['Content-Type'].startswith( 'text/html'): body += '!-- %s //--' % ('x'*512) ### trick IE Is there any easy way of not printing these extra characters without chaging HTTP.py? Long term, It would be nice if there was switch to turn this off, maybe an user-agent argument in the constructor? The current behaviour is not great for REST APIs. Thanks! :) g. --
Re: [web2py] Re: x509 authentication
I want to point out that the documentation is also using X509Account: http://web2py.com/books/default/chapter/29/9#Other-login-methods-and-login-forms Thanks guys, g. On Friday, 20 July 2012 09:25:36 UTC-7, Massimo Di Pierro wrote: I'll wait for the patch. On Friday, 20 July 2012 07:51:37 UTC-5, Michele Comitini wrote: Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? Ahem... I stand corrected, you are right I just copied a comment in the code. The comment must be fixed. mic 2012/7/20 tiadobatima @gmail.com: Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- -- --
[web2py] Re: Foreign Key fields as null?
That hasn't worked for me. When I try, I get the error:type 'exceptions.KeyError' 'name' It points to the smartgrid I made, with this code: grid = SQLFORMhttp://127.0.0.1:8000/examples/global/vars/SQLFORM .smartgrid(db.dog) Thanks! -Joe Peacock On Tuesday, July 17, 2012 6:22:53 PM UTC-5, Anthony wrote: You should probably make it a reference field. By default, if you don't specify any requires, you'll automatically get an IS_IN_DB validator as well as a represent attribute that displays whatever is specifying by the format attribute of the referenced table. However, if you specify your own validator(s), then you don't get any default represent -- so just add your own explicit represent: db.define_table('dog', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('owner', db. person, requires=IS_EMPTY_ORhttp://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR (IS_IN_DB http://127.0.0.1:8000/examples/global/vars/IS_IN_DB(db, ' person.id', '%(name)')), represent=lambda id, row: db.person(id).name), format = '%(name)s') Anthony On Tuesday, July 17, 2012 10:26:52 AM UTC-4, joe wrote: Is there any way to make a field in a form referencing a foreign key null, while storing a foreign key as a foreign key, but making dropdowns corrospond to the format. Here is my example: Model: db = DAL http://127.0.0.1:8000/examples/global/vars/DAL('sqlite://storage.sqlite') db.define_table('person', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('email'), format = '%(name)s') db.define_table('dog', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('owner', requires = IS_EMPTY_OR http://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR(IS_IN_DB http://127.0.0.1:8000/examples/global/vars/IS_IN_DB(db,db.person))), #I have also tried default=None, and required = False, no difference format = '%(name)s') Controller: *from gluon.tools import Crud crud = Crud(db) def index(): form = SQLFORM(db.person) if form.process().accepted: response.flash = 'success' return dict(form=form) def add_dog(): form = SQLFORM(db.dog) if form.process().accepted: response.flash = 'success' return dict(form=form) def view(): grid = SQLFORM.smartgrid(db.dog) grid2 = crud.select(db.person) return dict(grid=grid, grid2=grid2) * * * When I have the above code, a foreign key will be stored in the database, but all views of that key will be rendered as the numerical value of the foreign key, and not the name. In the table definition, if I just have *db.person* instead of requires = *IS_EMPTY_OR*(*IS_IN_DB*(db,db.person)), It requires the field. Are there any workarounds? -Joe Peacock --
Re: [web2py] web2py.com offline
Bruno, how many pageviews a day? On 07/20/2012 03:40 PM, Bruno Rocha wrote: Well, I think web2py.com http://web2py.com and web2pyslices.com http://web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com mailto:davidramsayreinh...@gmail.com wrote: can't get to the website today. -- -- --
[web2py] Re: Question about an xml file in use with a JS(jquery) Mappicker in web2py ...
Yes, don... XML drive means it takes an XML file as source for the map. It appears the XML is handled client side via javascript. There are no arguments passed to the XML so it is a static file. You would put it in your STATIC folder. On Friday, July 20, 2012 10:58:13 AM UTC-7, Don_X wrote: More information regarding this initiative : the scripts used for the interactive map is the one found at : http://codecanyon.net/item/interactive-svg-canada-map/2355460 It is said to be XML driven and i wish to port it to my web2py app. . But i am hitting a wall with this ! ... the xml file is used as data source for the JS ( jquery ) I have looked at various alternatives to xml on the web for interaction possibility with various scripting languages like JS, or Python etc .. I know there is YAML I am thinking that YAML can replace the xml method for data interaction with the js script .. and possibly be also serialized by web2py for translation (T) ?? ... can anyone help me with this or shed some light about this for me ... I am stuck ..??? .. thank you --
[web2py] Re: Foreign Key fields as null?
Oh, right, since you allow empty values, you'll need to test for that before doing the query: represent=lambda id, row: db.person(id).name if id else 'Nobody owns this dog' Anthony On Friday, July 20, 2012 3:47:33 PM UTC-4, joe wrote: That hasn't worked for me. When I try, I get the error:type 'exceptions.KeyError' 'name' It points to the smartgrid I made, with this code: grid = SQLFORMhttp://127.0.0.1:8000/examples/global/vars/SQLFORM .smartgrid(db.dog) Thanks! -Joe Peacock On Tuesday, July 17, 2012 6:22:53 PM UTC-5, Anthony wrote: You should probably make it a reference field. By default, if you don't specify any requires, you'll automatically get an IS_IN_DB validator as well as a represent attribute that displays whatever is specifying by the format attribute of the referenced table. However, if you specify your own validator(s), then you don't get any default represent -- so just add your own explicit represent: db.define_table('dog', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('owner', db. person, requires=IS_EMPTY_ORhttp://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR (IS_IN_DB http://127.0.0.1:8000/examples/global/vars/IS_IN_DB(db, ' person.id', '%(name)')), represent=lambda id, row: db.person(id).name), format = '%(name)s') Anthony On Tuesday, July 17, 2012 10:26:52 AM UTC-4, joe wrote: Is there any way to make a field in a form referencing a foreign key null, while storing a foreign key as a foreign key, but making dropdowns corrospond to the format. Here is my example: Model: db = DAL http://127.0.0.1:8000/examples/global/vars/DAL('sqlite://storage.sqlite') db.define_table('person', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('email'), format = '%(name)s') db.define_table('dog', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('owner', requires = IS_EMPTY_OR http://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR(IS_IN_DB http://127.0.0.1:8000/examples/global/vars/IS_IN_DB(db,db.person))), #I have also tried default=None, and required = False, no difference format = '%(name)s') Controller: *from gluon.tools import Crud crud = Crud(db) def index(): form = SQLFORM(db.person) if form.process().accepted: response.flash = 'success' return dict(form=form) def add_dog(): form = SQLFORM(db.dog) if form.process().accepted: response.flash = 'success' return dict(form=form) def view(): grid = SQLFORM.smartgrid(db.dog) grid2 = crud.select(db.person) return dict(grid=grid, grid2=grid2) * * * When I have the above code, a foreign key will be stored in the database, but all views of that key will be rendered as the numerical value of the foreign key, and not the name. In the table definition, if I just have *db.person* instead of requires = *IS_EMPTY_OR*(*IS_IN_DB*(db,db.person)), It requires the field. Are there any workarounds? -Joe Peacock --
[web2py] Re: Foreign Key fields as null?
Actually, I would think that would have caused an AttributeError (trying to access an attribute of a NoneType object). Not sure where the KeyError is arising. Anthony On Friday, July 20, 2012 4:31:52 PM UTC-4, Anthony wrote: Oh, right, since you allow empty values, you'll need to test for that before doing the query: represent=lambda id, row: db.person(id).name if id else 'Nobody owns this dog' Anthony On Friday, July 20, 2012 3:47:33 PM UTC-4, joe wrote: That hasn't worked for me. When I try, I get the error:type 'exceptions.KeyError' 'name' It points to the smartgrid I made, with this code: grid = SQLFORMhttp://127.0.0.1:8000/examples/global/vars/SQLFORM .smartgrid(db.dog) Thanks! -Joe Peacock On Tuesday, July 17, 2012 6:22:53 PM UTC-5, Anthony wrote: You should probably make it a reference field. By default, if you don't specify any requires, you'll automatically get an IS_IN_DB validator as well as a represent attribute that displays whatever is specifying by the format attribute of the referenced table. However, if you specify your own validator(s), then you don't get any default represent -- so just add your own explicit represent: db.define_table('dog', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('owner', db .person, requires=IS_EMPTY_ORhttp://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR (IS_IN_DB http://127.0.0.1:8000/examples/global/vars/IS_IN_DB(db, ' person.id', '%(name)')), represent=lambda id, row: db.person(id).name), format = '%(name)s') Anthony On Tuesday, July 17, 2012 10:26:52 AM UTC-4, joe wrote: Is there any way to make a field in a form referencing a foreign key null, while storing a foreign key as a foreign key, but making dropdowns corrospond to the format. Here is my example: Model: db = DAL http://127.0.0.1:8000/examples/global/vars/DAL('sqlite://storage.sqlite') db.define_table('person', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('email'), format = '%(name)s') db.define_table('dog', Field http://127.0.0.1:8000/examples/global/vars/Field('name'), Field http://127.0.0.1:8000/examples/global/vars/Field('owner', requires = IS_EMPTY_OR http://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR(IS_IN_DB http://127.0.0.1:8000/examples/global/vars/IS_IN_DB(db,db.person))), #I have also tried default=None, and required = False, no difference format = '%(name)s') Controller: *from gluon.tools import Crud crud = Crud(db) def index(): form = SQLFORM(db.person) if form.process().accepted: response.flash = 'success' return dict(form=form) def add_dog(): form = SQLFORM(db.dog) if form.process().accepted: response.flash = 'success' return dict(form=form) def view(): grid = SQLFORM.smartgrid(db.dog) grid2 = crud.select(db.person) return dict(grid=grid, grid2=grid2) * * * When I have the above code, a foreign key will be stored in the database, but all views of that key will be rendered as the numerical value of the foreign key, and not the name. In the table definition, if I just have *db.person* instead of requires = *IS_EMPTY_OR*(*IS_IN_DB*(db,db.person)), It requires the field. Are there any workarounds? -Joe Peacock --
[web2py] Re: Dreadful IE trick spewing out lots of 'x' chars when raising HTTP(4xx)
You should be able to do HTTP(400,**{'Content-Type':'text/html'}) On Friday, 20 July 2012 14:41:19 UTC-5, tiadobatima wrote: Hi Massimo, I see. But how do I set the Content-Type when raising HTTP(400)? I'm assuming this Content-Type set automatically when when the exception is raised. Do I have any control over it? Thanks :) g. On Friday, 20 July 2012 11:49:58 UTC-7, Massimo Di Pierro wrote: The rest about should not have: self.headers['Content-Type'].startswith('text/html') If they do you need the extra comment else IE will not display the rest of the error message. On Friday, 20 July 2012 12:22:50 UTC-5, tiadobatima wrote: Hi guys, Raising a 4xx exception is printing extra 512 'x' characters in the body. This seems to be the culprit (HTTP.py): if len(body)512 and self.headers['Content-Type'].startswith( 'text/html'): body += '!-- %s //--' % ('x'*512) ### trick IE Is there any easy way of not printing these extra characters without chaging HTTP.py? Long term, It would be nice if there was switch to turn this off, maybe an user-agent argument in the constructor? The current behaviour is not great for REST APIs. Thanks! :) g. --
Re: [web2py] How do we check the number of users in the new google groups?
And the new google groups does not even seem to allow exporting members in CSV any more. Massimo On Friday, 20 July 2012 08:47:09 UTC-5, Brian wrote: How about when you're a group owner? The groups that I started don't allow me to see the number of subscribers...thoughts? On Friday, March 30, 2012 10:17:39 AM UTC-4, Anthony wrote: How do we check the number of users in the new google groups? Everything is so complicated compared to the old google groups. :-( Showing 50 of 3709 members https://groups.google.com/forum/?fromgroups#!members/web2py Via the Members button in the upper right, which is only visible from the topics list view (not when viewing individual topics). I'm not sure there is any longer a way to see the number of posts per month as in the old version. Anthony --
Re: [web2py] Re: x509 authentication
@Massimo I have made a pull request on github. mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com: I'll wait for the patch. On Friday, 20 July 2012 07:51:37 UTC-5, Michele Comitini wrote: Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? Ahem... I stand corrected, you are right I just copied a comment in the code. The comment must be fixed. mic 2012/7/20 tiadobatima gbara...@gmail.com: Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- -- -- --
[web2py] Re: Unions and select from tables
You can avoid a union like so: rows = db(q).select(r).as_list() rows.extend(db(qq).select(rr).as_list() You have to access attributes dictionary fashion, not in dot notation. Could be a problem for SQLTABLE and descendants. Google 'sort list of dictionaries' to see how to sort it. On Friday, July 20, 2012 3:00:58 PM UTC-4, Andrew wrote: Does that mean sample, example, random have to have identical structures ? What if I just want the id and name columns ? How do I select just those in a union scenario? I know massimo doesn't like unions, but they are required sometimes. I am visualizing object relationships in a graph (picture something like http://bost.ocks.org/mike/fisheye ) and I want to get one list of nodes. I've only done it with executesql so far. --
Re: [web2py] Re: sqlform.grid search widget
it works now =) thanks dude about the search query Found a hack somewhere in the here group telling to delete it directly like: del grid[0][2] Em sexta-feira, 20 de julho de 2012 05h29min27s UTC-3, peter escreveu: I think that there is an argument for incorporating my solution into the standard sqlform grid and having a flag for switching between the query system or my simple text search. If the table is being presented in a web application for the great web public then they are going to expect searches to be 'google like'. Peter On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote: I think it will solve one of the issue I had with using sqlform.grid in place of sqltable + Datatables. Since Datatables has a pretty simple search/filter and my users knows how to use it than I would not remove this kind of easy search/filter functionality and leave them with only a harder more complex solution, so I stick with sqltable + Datatables even if sqlform.grid is much more interesting... Thank Peter. Richard On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote: Thanks for this I had not noticed that clear did not work, I guess I never use it. The problem is a type in the search_form function The fifth line should read id = 'search_text'), not id='searchText'), Does anyone know if I can edit the first message in this topic so as to correct it? Peter On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote: Works like a charm, but the Clear button is working exactly like the Search one, without clearing 'search_text' before submit Is there another method to do that? Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske escreveu: Good one. You earned a browser bookmark. Thanks. On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote: As I have commented before, sqlform.grid has a particular way of searching. Its combination of search and 'queries' is very powerful. However the search does not really work in the way a casual web user might expect. If entered - Bob Dylan - in the search box and clicked search, then one get 'invalid query'. I eventually worked out how to change the search widget, so as I believe this is currently undocumented I thought I would share it. The semantics I have chosen for search are that it will return records where any of the specified fields (fielda and fieldb in the example) contain all of the words in the search field. i.e if the search term is -Bob Dylan- it will return records that have both Bob and Dylan in the fieldA or both in fieldb. Define a search function that creates the form and a function that does the search def search_form(self,url): form = FORM('', INPUT(_name='search_text',_**value=request.get_vars.search_**text, _style='width:200px;', _id='searchText'), INPUT(_type='submit',_value=**T('Search')), INPUT(_type='submit',_value=**T('Clear'), _onclick=jQuery('#search_**text').val('');), _method=GET,_action=url) return form def search_query(tableid,search_**text,fields): words= search_text.split(' ') if search_text else [] query=tableid0#empty query for field in fields: new_query=tableid0 for word in words: new_query=new_queryfield.**contains(word) query=query|new_query return query Then in the function that has the sqlform.grid call, before the call add search_text=request.get_vars.**search_text query=search_query(db.tablea.**id http://db.tablea.id,search_text, [db.tablea.fielda,db.tablea.**fieldb]) ... # the query could now be combined with other queries. table=SQLFORM.grid(query, search_widget=search_form.**...) return dict(table=table) -- Em sexta-feira, 20 de julho de 2012 05h29min27s UTC-3, peter escreveu: I think that there is an argument for incorporating my solution into the standard sqlform grid and having a flag for switching between the query system or my simple text search. If the table is being presented in a web application for the great web public then they are going to expect searches to be 'google like'. Peter On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote: I think it will solve one of the issue I had with using sqlform.grid in place of sqltable + Datatables. Since Datatables has a pretty simple search/filter and my users knows how to use it than I would not remove this kind of easy search/filter functionality and leave them with only a harder more complex solution, so I stick with sqltable + Datatables even if sqlform.grid is much more interesting... Thank Peter. Richard On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote: Thanks for this I had not noticed that clear did not work, I guess I never use it. The
[web2py] DAL/Postgres not creating a table
Hey, Problem is as follows. I start a clean db in psql. Test the connection + delete all the /databases files to fresh with remote db. When I launch index page tables start getting created then I get error regarding some table is missing. I check sql.log and it did not even start creating the table (this + a few more get ommited). I have check_reserved in my DAL declaration. Table is not ill named: db.define_table('delivery_type', Field('name','string'), Field('price','double'), format=lambda r: r.name ) but there are others not getting created version 1.99.7 --
Re: [web2py] Re: how to compare date time in web2py?
Difference of Two Dates #- # Dates produce timedeltas when subtracted. diff = date2 - date1 diff = datetime.date(year1, month1, day1) - datetime.date(year2, month2, day2)#- bree = datetime.datetime(1981, 6, 16, 4, 35, 25) nat = datetime.datetime(1973, 1, 18, 3, 45, 50) difference = bree - natprint There were, difference, minutes between Nat and Bree#= There were 3071 days, 0:49:35 between Nat and Bree weeks, days = divmod(difference.days, 7) minutes, seconds = divmod(difference.seconds, 60) hours, minutes = divmod(minutes, 60) print %d weeks, %d days, %d:%d:%d % (weeks, days, hours, minutes, seconds)#= 438 weeks, 5 days, 0:49:35#- print There were, difference.days, days between Bree and Nat. #= There were 3071 days between bree and nat Origin: http://pleac.sourceforge.net/pleac_python/datesandtimes.html Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/7/20 Jonathan Lundell jlund...@pobox.com On 20 Jul 2012, at 6:19 AM, Andrew wrote: I'm not sure if web2py has something built-in to do this calculation but for other similar issues in the past I've just converted my dates to epoch and done the necessary math to see the difference between the two date-times. web2py ordinarily deals with datetime fields as Python datetime objects, which can just be compared (with due allowance for timezones). request.now has the current local time as a datetime; request.utcnow has UTC. I use epoch dates myself in some cases, in particular to communicate with iOS clients through JSON, passing them as integers. The Python docs have quite a bit of material on manipulating dates, though it's a bit confusing in places. The modules of most interest are datetime, time and calendar. On Thursday, July 19, 2012 4:05:41 AM UTC-5, Amit wrote: Hi, I have some records in a table and each record is having one field of type datetime [fromat : 2012-07-19 23:12:0 (-MM-DD HH:MM:SS)], table structure is: Emp_ID Emp_Name Emp_Address Emp_Salary updated_on(Type: datetime) periodically getting data against each Emp_ID and updating to the particular record, every 20 mins data has to be updated for each Emp_ID, for e.g : suppose for one Emp_ID data has updated on 2012-07-19 10:10:00 then again it has to update on 2012-07-19 10:30:00 etc... and if data is not updated in 20 mins then one scheduler will verify against the updated_on column value and inform user that data has not updated for particular employee. Problem facing: How to compare current datetime with updated_on coulmn value in web2py? can anybody please share me the code to achieve the same? -- --
Re: [web2py] DAL/Postgres not creating a table
are you sure the migrate is not False in db = DAL(...) ? try including migrate=True in your define_table On Fri, Jul 20, 2012 at 6:17 PM, Marek Mollin rog...@gmail.com wrote: Hey, Problem is as follows. I start a clean db in psql. Test the connection + delete all the /databases files to fresh with remote db. When I launch index page tables start getting created then I get error regarding some table is missing. I check sql.log and it did not even start creating the table (this + a few more get ommited). I have check_reserved in my DAL declaration. Table is not ill named: db.define_table('delivery_type', Field('name','string'), Field('price','double'), format=lambda r: r.name ) but there are others not getting created version 1.99.7 -- --
Re: [web2py] DAL/Postgres not creating a table
Shows the Ticket? Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/7/20 Bruno Rocha rochacbr...@gmail.com are you sure the migrate is not False in db = DAL(...) ? try including migrate=True in your define_table On Fri, Jul 20, 2012 at 6:17 PM, Marek Mollin rog...@gmail.com wrote: Hey, Problem is as follows. I start a clean db in psql. Test the connection + delete all the /databases files to fresh with remote db. When I launch index page tables start getting created then I get error regarding some table is missing. I check sql.log and it did not even start creating the table (this + a few more get ommited). I have check_reserved in my DAL declaration. Table is not ill named: db.define_table('delivery_type', Field('name','string'), Field('price','double'), format=lambda r: r.name ) but there are others not getting created version 1.99.7 -- -- --
[web2py] Re: Unions and select from tables
You can also to db=DAL()db.define_table('a',Field('name')) db.define_table('b',Field('name')) db.a.insert(name='Alex') db.a.insert(name='Max') db.a.insert(name='Tim') db.b.insert(name='John') db.b.insert(name='Jack') def union(x,y): y.colnames=x.colnames return x|y *rows = union(db().select(db.a.name),db().select(db.b.name)).sort(lambda row: row.name)* for row in rows: print row.name This does not translate into a union and runs at the web2py level. Mind that while testing I notice a discrepancy between docs and implementation of the sort() method. I fixed it in trunk. This code will only work with trunk. Massimo On Friday, 20 July 2012 16:08:16 UTC-5, Cliff Kachinske wrote: You can avoid a union like so: rows = db(q).select(r).as_list() rows.extend(db(qq).select(rr).as_list() You have to access attributes dictionary fashion, not in dot notation. Could be a problem for SQLTABLE and descendants. Google 'sort list of dictionaries' to see how to sort it. On Friday, July 20, 2012 3:00:58 PM UTC-4, Andrew wrote: Does that mean sample, example, random have to have identical structures ? What if I just want the id and name columns ? How do I select just those in a union scenario? I know massimo doesn't like unions, but they are required sometimes. I am visualizing object relationships in a graph (picture something like http://bost.ocks.org/mike/fisheye ) and I want to get one list of nodes. I've only done it with executesql so far. --
[web2py] Re: two references from one table to another.
is the question too easy or too difficult ? Ashraf --
Re: [web2py] web2py.com offline
LOL. Sorry I meant the app to sell the pdf book, because it is now free in pdf. On Friday, 20 July 2012 14:30:55 UTC-5, Derek wrote: What, you removed the book? On Friday, July 20, 2012 11:48:09 AM UTC-7, Massimo Di Pierro wrote: By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.comwrote: can't get to the website today. -- --
Re: [web2py] Re: x509 authentication
thanks for letting me kno.w github does not notify me of pull requests. On Friday, 20 July 2012 15:59:48 UTC-5, Michele Comitini wrote: @Massimo I have made a pull request on github. mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com: I'll wait for the patch. On Friday, 20 July 2012 07:51:37 UTC-5, Michele Comitini wrote: Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? Ahem... I stand corrected, you are right I just copied a comment in the code. The comment must be fixed. mic 2012/7/20 tiadobatima gbara...@gmail.com: Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- -- -- --
[web2py] Re: Question about an xml file in use with a JS(jquery) Mappicker in web2py ...
thank you Derek However, If the data ( text, pics, sizes, tags. ... ) is in the xml file ( within the static folder ), I will not be able to provide translation for that information by using the web2py object T( ) for translation before viewing those informations ... so I was wandering if I can have my interactive map with the text information data ( from another source than xml ) so it can be serialised or translated when needed ( such as in french ) like the rest of the app .. And that is where I am a stuck !! .. thank you for your input .. it got me to understand more about xml and python ! ... On Friday, July 20, 2012 4:04:04 PM UTC-4, Derek wrote: Yes, don... XML drive means it takes an XML file as source for the map. It appears the XML is handled client side via javascript. There are no arguments passed to the XML so it is a static file. You would put it in your STATIC folder. On Friday, July 20, 2012 10:58:13 AM UTC-7, Don_X wrote: More information regarding this initiative : the scripts used for the interactive map is the one found at : http://codecanyon.net/item/interactive-svg-canada-map/2355460 It is said to be XML driven and i wish to port it to my web2py app. . But i am hitting a wall with this ! ... the xml file is used as data source for the JS ( jquery ) I have looked at various alternatives to xml on the web for interaction possibility with various scripting languages like JS, or Python etc .. I know there is YAML I am thinking that YAML can replace the xml method for data interaction with the js script .. and possibly be also serialized by web2py for translation (T) ?? ... can anyone help me with this or shed some light about this for me ... I am stuck ..??? .. thank you --
Re: [web2py] Re: x509 authentication
Could be a problem here: https://github.com/settings/notifications I get notifications, but they come in burst at random... mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com: thanks for letting me kno.w github does not notify me of pull requests. On Friday, 20 July 2012 15:59:48 UTC-5, Michele Comitini wrote: @Massimo I have made a pull request on github. mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com: I'll wait for the patch. On Friday, 20 July 2012 07:51:37 UTC-5, Michele Comitini wrote: Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? Ahem... I stand corrected, you are right I just copied a comment in the code. The comment must be fixed. mic 2012/7/20 tiadobatima gbara...@gmail.com: Thanks guys! I'm using nginx too, and I followed roughly the same steps but using uwsgi. Michelle, I know you wrote the code, but I believe X509Account should be replaced with X509Auth, no? from gluon.contrib.login_methods.x509_auth import X509Auth auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Autht() Cheers, g. On Thursday, 19 July 2012 13:27:30 UTC-7, Michele Comitini wrote: - Install M2Crypto. - If you use rocket be sure to pass the --ca-cert option or if you use another server configure the server to support client certificate validation and to pass needed SSL variables in wsgi environment*. - In you model put the following: from gluon.contrib.login_methods.x509_auth import X509Account auth.settings.actions_disabled=['register','change_password', 'request_reset_password','profile'] auth.settings.login_form = X509Account() *for example in nginx + scgi setup to pass environment variables add the following in the ssl server stanza: scgi_param SSL_PROTOCOL $ssl_protocol; scgi_param HTTPS on; scgi_param SSL_CIPHER $ssl_cipher; scgi_param SSL_CLIENT_SERIAL $ssl_client_serial; scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn; scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn; scgi_param SSL_SESSION_ID $ssl_session_id; scgi_param SSL_CLIENT_CERT $ssl_client_cert; scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert; scgi_param SSL_CLIENT_VERIFY $ssl_client_verify; mic 2012/7/19 Derek ...@gmail.com: 1. Take a look at x509_auth.py for information on how to do that. It's only 102 lines, so don't be daunted. 2. Yes. On Tuesday, July 17, 2012 4:12:50 PM UTC-7, tiadobatima wrote: Hi guys, After reading the docs, searching through old posts, and scouring the net, I'm hoping someone can enlighten me regarding x509 auth: 1- How to retrieve the subject contained in the x509 certificate (serialNumber, commonName, etc). Any example code? 2- Does the current implementation of x509 auth require any of the auth_ tables in the database for anything? Thanks! -- -- -- -- --
Re: [web2py] web2py.com offline
Massimo, How can we start mirroring? We should test for a while and then work on geodns or other redirection facility. mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com LOL. Sorry I meant the app to sell the pdf book, because it is now free in pdf. On Friday, 20 July 2012 14:30:55 UTC-5, Derek wrote: What, you removed the book? On Friday, July 20, 2012 11:48:09 AM UTC-7, Massimo Di Pierro wrote: By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com**wrote: can't get to the website today. -- -- --
[web2py] Re: Dreadful IE trick spewing out lots of 'x' chars when raising HTTP(4xx)
Very neat! Thanks Massimo! On Friday, 20 July 2012 13:45:01 UTC-7, Massimo Di Pierro wrote: You should be able to do HTTP(400,**{'Content-Type':'text/html'}) On Friday, 20 July 2012 14:41:19 UTC-5, tiadobatima wrote: Hi Massimo, I see. But how do I set the Content-Type when raising HTTP(400)? I'm assuming this Content-Type set automatically when when the exception is raised. Do I have any control over it? Thanks :) g. On Friday, 20 July 2012 11:49:58 UTC-7, Massimo Di Pierro wrote: The rest about should not have: self.headers['Content-Type'].startswith('text/html') If they do you need the extra comment else IE will not display the rest of the error message. On Friday, 20 July 2012 12:22:50 UTC-5, tiadobatima wrote: Hi guys, Raising a 4xx exception is printing extra 512 'x' characters in the body. This seems to be the culprit (HTTP.py): if len(body)512 and self.headers['Content-Type'].startswith( 'text/html'): body += '!-- %s //--' % ('x'*512) ### trick IE Is there any easy way of not printing these extra characters without chaging HTTP.py? Long term, It would be nice if there was switch to turn this off, maybe an user-agent argument in the constructor? The current behaviour is not great for REST APIs. Thanks! :) g. --
[web2py] Re: two references from one table to another.
Sorry, it took me a while to understand your question. But you actually have a very good question. Here is how you do it: db=DAL() db.define_table('auth_user', Field('name')) db.define_table('message', Field('to_user',db.auth_user), Field('from_user',db.auth_user)) max = db.auth_user.insert(name=Max) ashraf = db.auth_user.insert(name=Ashraf) db.message.insert(to_user=ashraf,from_user=max) sender = db.auth_user.with_alias('sender') receiver = db.auth_user.with_alias('receiver') rows = db((db.message.from_user==sender.id)(db.message.to_user==receiver.id)).select() for row in rows: print row.sender.name,'-',row.receiver.name On Thursday, 19 July 2012 17:57:03 UTC-5, Ashraf Mansour wrote: Hi, The first table has two fields: * from_user , db.auth_user* * to_user , db.auth_user* both are referencing db.auth_user. How to get the list of records in the first table with the corresponding first_name of the two fields? I am confused, because I don't know how to differentiate the two field --- db.auth_user.name for the two fields. Regards, Ashraf --
Re: [web2py] web2py.com offline
The plan is I finish remove confidential info from the folder and then allow people access to folder so they can periodically rsync. On Friday, 20 July 2012 17:09:54 UTC-5, Michele Comitini wrote: Massimo, How can we start mirroring? We should test for a while and then work on geodns or other redirection facility. mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com LOL. Sorry I meant the app to sell the pdf book, because it is now free in pdf. On Friday, 20 July 2012 14:30:55 UTC-5, Derek wrote: What, you removed the book? On Friday, July 20, 2012 11:48:09 AM UTC-7, Massimo Di Pierro wrote: By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com** wrote: can't get to the website today. -- -- --
Re: [web2py] web2py.com offline
If there is nothing confidential left using github or whatever repository to sync would not be better? mic 2012/7/21 Massimo Di Pierro massimo.dipie...@gmail.com The plan is I finish remove confidential info from the folder and then allow people access to folder so they can periodically rsync. On Friday, 20 July 2012 17:09:54 UTC-5, Michele Comitini wrote: Massimo, How can we start mirroring? We should test for a while and then work on geodns or other redirection facility. mic 2012/7/20 Massimo Di Pierro massimo.dipie...@gmail.com LOL. Sorry I meant the app to sell the pdf book, because it is now free in pdf. On Friday, 20 July 2012 14:30:55 UTC-5, Derek wrote: What, you removed the book? On Friday, July 20, 2012 11:48:09 AM UTC-7, Massimo Di Pierro wrote: By removing the online book, there are no more confidential information on web2py.com This will make it easier to move it and to create mirrors. I will move it next week. After that we will create mirrors. massimo On Friday, 20 July 2012 13:40:53 UTC-5, rochacbruno wrote: Well, I think web2py.com and web2pyslices.com needs a better hosting solution. On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com* *** wrote: can't get to the website today. -- -- -- --
[web2py] Re: Making minor changes to auth.navbar()
I just write my own: def user_bar(): action = '/user' if auth.user: logout=A('logout', _href=action+'/logout') profile=A('profile', _href=action+'/profile') password=A('change password', _href=action+'/change_password') bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | ',logout , _class='auth_navbar') else: login=A('login', _href=action+'/login') register=A('register',_href=action+'/register') lost_password=A('lost password', _href=action+ '/request_reset_password') bar = SPAN(' ', login, ' | ', register, ' | ', lost_password, _class ='auth_navbar') return bar --
[web2py] Re: two references from one table to another.
I love both, you and web2py. Regards, Ashraf --
[web2py] Contrib Index?
There is some really cool stuff in contrib. However, I cannot remember what it is. Is there an index anywhere? I mean just a brief description of even one line for each item would be really helpful. Thanks. --
[web2py] Re: Contrib Index?
You can look at the CHANGELOG file but not everything is described there. On Friday, 20 July 2012 21:07:15 UTC-5, villas wrote: There is some really cool stuff in contrib. However, I cannot remember what it is. Is there an index anywhere? I mean just a brief description of even one line for each item would be really helpful. Thanks. --
[web2py] Re: Contrib Index?
And some are described here: http://web2py.com/books/default/chapter/29/4#Libraries On Friday, July 20, 2012 10:46:08 PM UTC-4, Massimo Di Pierro wrote: You can look at the CHANGELOG file but not everything is described there. On Friday, 20 July 2012 21:07:15 UTC-5, villas wrote: There is some really cool stuff in contrib. However, I cannot remember what it is. Is there an index anywhere? I mean just a brief description of even one line for each item would be really helpful. Thanks. --
[web2py] Re: Web2py expert needed for start-up
Like if you search Ramkrishan bhatt you will get my detail over there or location wise if you want to search you can search developer as per your nearest location. I am interested in the project. you can contact me as ramkrishanbh...@zero-group.com . On Wednesday, 18 July 2012 15:12:48 UTC+5:30, Neil wrote: How does the experts4solutions website work? For example, if I wanted to see if anyone (anywhere) was interested in a paid hourly contract, would I have to send an individual email to each expert listed? Who does the contact us form get sent to? It would be really useful to be able to post project details just once, and see how is interested. On Tuesday, July 17, 2012 8:56:02 PM UTC+1, howesc wrote: to help with your search consider posting here http://experts4solutions.com/ if you haven't already. On Monday, July 16, 2012 4:23:41 PM UTC-7, Pepe C wrote: Hi, We have a set of applications on web2py and we are looking for an expert that can help us to operate and develop them. This is a long-term role taking ~10 hours a week, although we do have a bunch of additional work to get done in the next few weeks. Responsibilities include: - Development of new web services - Web2py administration and deployment - Polishing and addressing bugs in the existing code Experience with Jquery mobile plugin or mobile layouts would be a big plus. In your replies please tell us about your portfolio, your availability for the next two months and your hourly rate. Thanks! --
[web2py] Builtin Editor not working in latest Trunk
I just downloaded and ran the latest trunk: Version 2.0.0 (2012-07-20 17:37:48) dev The built-in editor seems to be in read-only mode. After seemingly editing either a new file or an existing file, hitting Ctrl-S does nothing and anything typed into the file is not saved. There is no flash verification of file saving. Also the editor doesn't have the usual row of button icons along the top for selecting actions or options. New editor not fully tested --