[web2py] Re: Represent problem.
Hi Alan and Anthony, @Alan, This: {{for row in rows:}} tr td{{=db.Edge.byNodeID.represent(row.byNodeID, row)}}/td td{{=db.Edge.ofNodeID.represent(row.ofNodeID, row)}}/td /tr {{pass}} ... results in an empty td/td element ... @Anthony, Instead of the above, use: @auth.requires(lambda: auth.has_membership(HUB) or auth.has_membership(ADMIN)) Thanks for your advice, I made the changes in my code. rows=rows=db(db.HubEdge.hubID==session.hubadminID).select(db.HubEdge.ALL) return dict(rows=rows) Why do you have rows=rows? I had a look at the code, there's no rows=rows, I guess it's a copy and paste error. Kind regards, Annet.
[web2py] Re: RESTful API : function lambda at ... is not JSON serializable
Worked ! Thanks On Mar 19, 5:50 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: return dict(message = db.message(id).as_dict()) On Sunday, 18 March 2012 19:10:13 UTC-5, sebsto wrote: Dear All, I am new the web2py and trying to use the relatively new RESTful API, as described at http://web2py.com/books/default/chapter/29/10#Restful-Web-Services I am testing it with a very simple model : db.define_table('message', Field('sender', required=True), Field('recipient', required=True), Field('text', required=True)) And the doc provided function: @request.restful() def api(): response.view = 'generic.json' def GET(tablename,id): if not tablename=='message': raise HTTP(400) return dict(message = db.message(id)) return locals() When calling curl -vhttp://localhost:8000/RESTtest/default/api/message/1.json It generates an HTTP 500 error and the following ticket is logged 1 generic.json TypeError: function lambda at 0xa9a72f0 is not JSON serializable + details Traceback (most recent call last): File gluon/restricted.py, line 205, in restricted File /Applications/web2py.app/Contents/Resources/applications/ RESTtest/views/generic.json, line 2, in module File gluon/serializers.py, line 61, in json File gluon/contrib/simplejson/__init__.py, line 270, in dumps File gluon/contrib/simplejson/encoder.py, line 217, in encode File gluon/contrib/simplejson/encoder.py, line 486, in _iterencode File gluon/contrib/simplejson/encoder.py, line 460, in _iterencode_dict File gluon/contrib/simplejson/encoder.py, line 460, in _iterencode_dict File gluon/contrib/simplejson/encoder.py, line 496, in _iterencode File gluon/serializers.py, line 37, in custom_json TypeError: function lambda at 0xa9a72f0 is not JSON serializable Similar problem was reported here http://groups.google.com/group/web2py/browse_thread/thread/837aa4b3df... Is there an issue in generic.json ? Thanks for your help Seb
Re: [web2py] Re: config file - configuration per environment
On 18 March 2012 15:51, Alex mrauc...@gmail.com wrote: sorry, I don't understand your answer. What does mult tenance mean? There is no description for tenant in the request documentation. When I access request.tenant in my local app it is None. There is something in the book ( http://www.web2py.com/books/default/chapter/29/6?search=tenant) but I must admit that it is not quite clear to me from that documentation how to use it. Look for the heading Common fields and multi-tenancy in the book. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Request all function from a controller
Dear ALL , How can i get all the functions in a controller ?? i know i can get the function am in using request.function but how can i get them all ??
[web2py] Get All Controller Functions
Dear ALL , How Can I Get ALL controller functions , as i know i can get the one am at in the view using request.function , so how can i get all of them ??
Re: [web2py] Re: Web2py Update
Im use linux ubuntu 11.10 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/3/18 Massimo Di Pierro massimo.dipie...@gmail.com which os? We know there is a problem on winodows. Download the latest, unzip and copy over the older one. On Sunday, 18 March 2012 16:39:19 UTC-5, Ovidio Marinho wrote: Check for update web2py 1.99.4 does not work, someone has a solution? 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
[web2py] RESTful API: hook before controller is called ?
Hello, Still developing around the RESTfull API. I am looking for a way to handle the HTTP POST payload *before* the controller is called. I want my REST clients to send encrypted and compressed content. I would need to decipher and decompress the content before the args parsing is done. Any suggestion ? Thanks Seb
[web2py] Re: Creating a cms with restricted video streaming access
Why not. But for now the problem is not in access control but in having Movuca support this new elearning data types, as long as the app knew how to manage the new data, then you'll be able to customize it as much as you want. On 19 mar, 01:46, Osama Khan osama...@gmail.com wrote: Hey! This is amazing, I am working on something similar :) I had just started so your project will help me immensely decrease development time. Thanks alot! Is it possible that we restrict the user from downloading the videos something like udemy has done? -- Osama Khan [http://www.osamakhan.com] On Mar 18, 4:25 pm, Bruno Rocha rochacbr...@gmail.com wrote: Yes, all in Movu.ca will be open-source as LGPLv3, movu.ca was created with content as focus, social features is a plus, but the center of the CMS is the content, so I need to improve the content-types system to be able to include content-bundles, a content bundle is like a folder, a group, a course, a class, a complete tutorial or whatever you need to group together. With a generic functionality like that I think it will be easy to implement it as a courseware, also implementing better privacy options based on groups, permissions and users who have signed to some course or bundle. I plan to use for my course, also for a cooking website. For the videos I am thinking in integration with Big Blue Button API, VIMEO Plus API, Amazon S3 for streaming, and also Google Docs. The code is in github, I have not started to write the ideas for 'content-bundles', take a look at the code and may be we can work together on this. On Sun, Mar 18, 2012 at 8:17 AM, Alan Etkin spame...@gmail.com wrote: Bruno, are you planning to release a development version of the movu.ca courseware as open source? If so, I could contribute, as I probably will need a production implementation for the next months. I think that my app would also use the vimeo PLUS product and I am researching ways of streaming online with justin.tv (only for authenticated users also) The live video feature of PyConUS is an open source tool, as I have read in the video site (perhaps there is relevant code too, although it probably was developed for django). On 18 mar, 05:16, Bruno Rocha rochacbr...@gmail.com wrote: I am building something like this using Movu.ca as base for the system. I will use this on my coursewww.cursodepython.com.br, Now this course runs with VIMEO plus and only registered students have access to videos. Now I will extend with content-types in movu.ca On Sat, Mar 17, 2012 at 9:53 AM, Alan Etkin spame...@gmail.com wrote: Hi. I have been asked to buiild a web site with these features and requirements: -Content managment for universitary students and teachers Teachers will upload and edit course documents. -Students must pay a fee to access the site's content. -Students evaluation system with QA -Online video classes The site must allow (only authenticated) students to watch classes live or from a site's class video archive. Is there something already developed that I can use for this requirements? I know there are lot of separated solutions (Martin's Instant Press and I could mix them with more or less success, but I'd like to know if someone found a starting project that covers this requirements, so the development tasks can be decreased and there is no need to reinvent the wheel. For accessing video streams I am thinking of using a third-party brand like vimeo or other similar, have anybody tested those services? Could I use Instant Press for this project? Does it have this video streaming features or should I develop something like an Instant Press plugin for this case?. Thank you. -- Bruno Rocha [http://rochacbruno.com.br] -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Re: Nginx and Web2py
Thanks for all the answers. As I said before, I used the script that comes with web2py ( web2py/scripts directory). Installed and ran nginx and uwsgi right away. What didn't work was the creation of new apps from admin interface. At least not untill I started web2py manually (python2.6 web2py.py). This is not a production server yet. I'm testing installation of web2py on nginx and performance. If everything goes well, I'd like to get my apps running on it. I've read many good things about nginx (specially when it comes to use on VPS), so I'm interested on it. And since we're on the subject, those who are using nginx today. What do you think about it ? I'll do a few more tests and see if things run smoothly. If they do, I'll probably use it. Thanks for all the help! (I'll use Bruno's and Bruce's answers as references). Cheers, Marco 2012/3/17 Bruce Wade bruce.w...@gmail.com Ubuntu 11.10, setup-web2py-nginx-uwsgi-ubuntu.sh. When it didn't work I changed the file and submitted it back to the community. The install for uwsgi-python doesn't work instead you need to change to: apt-get -y install uwsgi uwsgi-plugin-python Then update the path you save the configuration file from: /etc/uwsgi-python/apps-available. to /etc/*uwsgi*/apps-available.. I also changed the user/group from www-data to a custom one to make deployment much smother Finally had to update the command that starts uwsgi from /etc/init.d/uwsgi-python restart to /etc/init.d/*uwsgi* restart On Sat, Mar 17, 2012 at 1:26 AM, pbreit pbreitenb...@gmail.com wrote: What script did you use? What server are you on? What did it do when it didn't work? -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com -- []'s Marco Tulio
Re: [web2py] Installing a project which in cloned in mercurial repository in web2py
Hi Praveen, FYI a .w2p file is basically a tar archive. If you unpack it it gives you a directory structure. On Sunday, March 18, 2012 5:44:00 PM UTC-4, praveen krishna wrote: But to install an application it should be of .w2p format then how can I copy or move a normal folder which contains other folders along with models,controllers ,views which is cloned using mercurial . On Sun, Mar 18, 2012 at 10:14 PM, Michele Comitini michele.comit...@gmail.com wrote: Hi, Download web2py from web2py.com and follow the instructions to run it Just copy or move the folder containing models,controllers,views under the applications folder inside your web2py installation. mic Il 18 marzo 2012 16:06, praveen krishna praveenchitne...@gmail.com ha scritto: Hii, I have cloned a project called pyMantis in mercurial in read only mode and want to install it as a pyMantis app in web2py .what are the next steps to be followed in windows7 environment to install.
[web2py] Pyscripter 2.5 and Iron python 2.7.2.1 released
Just saw that Pyscripter 2.5 and Iron python 2.7.2.1 were released.
Re: [web2py] Re: Creating a cms with restricted video streaming access
VIMEO Plus protect videos for downloading http://zerp.ly/rochacbruno Em 19/03/2012 01:46, Osama Khan osama...@gmail.com escreveu:
[web2py] Re: Get All Controller Functions
Here's how the admin app does it: http://code.google.com/p/web2py/source/browse/applications/admin/controllers/default.py#728. You might try something like that. Anthony On Monday, March 19, 2012 6:16:45 AM UTC-4, Hassan Alnatour wrote: Dear ALL , How Can I Get ALL controller functions , as i know i can get the one am at in the view using request.function , so how can i get all of them ??
Re: [web2py] Re: routes.py not picking up
Another thing that needs to be pointed out (at least this is the case in Windows) that modifications to this file require a full web2py server shutdown/restart. If you use the tk UI to stop server and then start server, it will not pick up changes in the file -- perhaps this is obvious to some, but it can throw people in a loop if they are not aware. On Fri, Mar 16, 2012 at 11:09 PM, Anthony abasta...@gmail.com wrote: ok removing those and re-starting web2py worked (well it broke, but that's a good thing). Thx all for your help. If it's not on to-do list: maybe it should be to improve (or to make clearer in the docs) how the routes.py works and that you need to comment our routes_app in order for it to work. Maybe we could make the sample file more clear, but I think the book has it right: Application-Specific URL rewrite routes_app When using the pattern-based system, an application can set its own routes in an application-specific routes.py file located in the applications base folder. This is enabled by configuring routes_app in the base routes.py to determine from an incoming URL the name of the application to be selected. When this happens, the application-specific routes.py is used in place of the base routes.py. The format of routes_app is identical to routes_in, except that the replacement pattern is simply the application name. If applying routes_app to the incoming URL does not result in an application name, or the resulting application-specific routes.py is not found, the base routes.py is used as usual. Though that last half sentence may not be correct (rather, it probably should be correct, but there may be a bug). Anthony
[web2py] SQLFORM.grid search using signature
Hi all I can't perform search operations on SQLFORM.grid forms. If I remove the @auth.requires_signature() part, it does work. In the webserver-logfile I noticed that the edit page is signed, while the search page isn't. EDIT: /init/location/form/edit/location/4?_signature=368187847e306b826b2c5a1f8a4780c236aafb8c SEARCH: /init/location/form?keywords=test Given the following code in controller location.py: @auth.requires_signature() def form(): db.location.id.readable=False query=((db.location.id 0 )) default_sort_order=[db.location.country] form = SQLFORM.grid(query=query, orderby=default_sort_orderr, create=True, deletable=True, editable=True, user_signature=True) return dict(form=form) What do I have to do to get it working? Regards -Gian.
[web2py] Re: trouble with @auth.requires_login() in wiki app from manual
Ack. Well that would explain why it only caused a problem in the one spot! Thanks for the assistance! Monte On Sunday, March 18, 2012 4:10:49 PM UTC-7, Anthony wrote: As Alan suggests, you slightly mis-copied the code from the book -- it should be: @auth.requires_login() def documents(): Note the parentheses. Anthony On Sunday, March 18, 2012 6:21:54 PM UTC-4, Monte Milanuk wrote: Hello, Working my way thru the wiki app demo in the online manual... I kept getting a weird error like this: Traceback (most recent call last): File gluon/restricted.py, line 205, in restricted File E:\web2py\applications\mywiki\controllers/default.py, line 31, in module TypeError: requires_login() takes exactly 1 argument (2 given) whenever I attempted to access any of the views for this app. Only on line 31 of the controller 'default.py', right before 'def documents():'. Here is the code listing from the 'trouble ticket': edit an existing wiki page this_page = db.page(request.args(0)) or redirect(URL('index')) form = crud.update(db.page, this_page, next = URL('show', args=request.args)) return dict(form=form) @auth.requires_login def documents(): browse edit all documents attached to a given page page = db.page(request.args(0)) or redirect(URL('index')) db.document.page_id.default = page.id I went back thru the code several times, and I couldn't seem to find anything specifically wrong that jumped out at me... ...but when I commented out line 31 entirely - everything began working. Eh?!? Could someone explain to me why that one line, right there, would cause things to break when the decorator is used elsewhere in the same controller 'default.py' several times with no problems? There are any number of things I don't fully understand yet, but most of them 'just work' so I've kept moving on, learning as I go. This one has me kinda stumped - I don't *think* its a typo on my part, though thats certainly the most likely cause. If it is, I'm not seeing it though, at least not right there in the section of code the trouble ticket high-lighted. TIA, Monte
Re: [web2py] Re: TEXT data type deprecated in future MSSQL?
I don't think we need to worry about this for a while. It doesn't say deprecated, but that it will be removed in a future version (semantics, I know). But, they have not given any indication of what version, which means they probably won't remove it until the version AFTER 2012 (2014, maybe). And a lot of people are still using MSSQL 2000 and 2005. When the time comes, it would probably be just as easy to make a MSSQL2014 (or whatever you want to call it) adapter that subclasses MSSQL2, but uses varchar(max) instead of text. Or even an option in MSSQL2 to switch between the two names. On Friday, March 16, 2012 5:43:48 PM UTC-4, Joaquin Orbe wrote: On Fri, Mar 16, 2012 at 5:45 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: P.S. Please open a google code ticket about it. Done: http://code.google.com/p/web2py/issues/detail?id=722 Regards, Joaco.
[web2py] Re: web2py talk at PyCon US 2012 [video]
I've finished writing the english subtitles. I'd be nice if someone could refine it. There are a couple of sentences I left unwritten with a (?) mark and it needs better synchronization. When it was done, I'll be able to finish the spanish translation that I left incomplete. Thanks here is the link to the online translation editor (requires user registration) http://pyvideo.org/video/714/web2py-ideas-we-stole-and-ideas-we-had# On 18 mar, 11:26, Alan Etkin spame...@gmail.com wrote: Someone else interested in writing the subtitles? On 13 mar, 20:36,MassimoDi Pierro massimo.dipie...@gmail.com wrote: On Tuesday, 13 March 2012 00:22:39 UTC-5, rochacbruno wrote: http://pyvideo.org/video/714/web2py-ideas-we-stole-and-ideas-we-had -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: web2py talk at PyCon US 2012 [video]
Thank you Alan. Massimo On Monday, 19 March 2012 11:00:51 UTC-5, Alan Etkin wrote: I've finished writing the english subtitles. I'd be nice if someone could refine it. There are a couple of sentences I left unwritten with a (?) mark and it needs better synchronization. When it was done, I'll be able to finish the spanish translation that I left incomplete. Thanks here is the link to the online translation editor (requires user registration) http://pyvideo.org/video/714/web2py-ideas-we-stole-and-ideas-we-had# On 18 mar, 11:26, Alan Etkin spame...@gmail.com wrote: Someone else interested in writing the subtitles? On 13 mar, 20:36,MassimoDi Pierro massimo.dipie...@gmail.com wrote: On Tuesday, 13 March 2012 00:22:39 UTC-5, rochacbruno wrote: http://pyvideo.org/video/714/web2py-ideas-we-stole-and-ideas-we-had -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] trouble reading this list
Is it just me? I am having trouble accessing some recent posts on this list. I see the title, author, and content says loading I apologize if I cannot answer but I do not know what to do but wait. massimo
[web2py] Re: Get All Controller Functions
Would this work inside a controller? # this module belongs to the Python Standard Library # http://docs.python.org/library/inspect.html#module-inspect import inspect # when using the same globals() an exception is thrown for k, v in globals().copy().iteritems(): if inspect.isfunction(v): argspec = inspect.getargspec(v) # anything else to check? if len(argspec.args) == 0 and argspec.varargs is None and argspec.keywords is None: # then this is a function of the current controller pass On 19 mar, 11:13, Anthony abasta...@gmail.com wrote: Here's how the admin app does it:http://code.google.com/p/web2py/source/browse/applications/admin/cont You might try something like that. Anthony On Monday, March 19, 2012 6:16:45 AM UTC-4, Hassan Alnatour wrote: Dear ALL , How Can I Get ALL controller functions , as i know i can get the one am at in the view using request.function , so how can i get all of them ??
[web2py] Re: trouble reading this list
I would suggest clearing browser cache and restarting it. On Monday, March 19, 2012 1:20:01 PM UTC-4, Massimo Di Pierro wrote: Is it just me? I am having trouble accessing some recent posts on this list. I see the title, author, and content says loading I apologize if I cannot answer but I do not know what to do but wait. massimo
[web2py] Re: trouble reading this list
I noticed the same thing this morning on my Android, but seems OK in my desktop browser, and Android seems OK now too. Anthony On Monday, March 19, 2012 1:20:01 PM UTC-4, Massimo Di Pierro wrote: Is it just me? I am having trouble accessing some recent posts on this list. I see the title, author, and content says loading I apologize if I cannot answer but I do not know what to do but wait. massimo
[web2py] Re: Get All Controller Functions
I don't think that will distinguish functions defined in models or imported within models or the controller, though I guess in most cases such functions wouldn't have no arguments. Anthony On Monday, March 19, 2012 1:28:10 PM UTC-4, Alan Etkin wrote: Would this work inside a controller? # this module belongs to the Python Standard Library # http://docs.python.org/library/inspect.html#module-inspect import inspect # when using the same globals() an exception is thrown for k, v in globals().copy().iteritems(): if inspect.isfunction(v): argspec = inspect.getargspec(v) # anything else to check? if len(argspec.args) == 0 and argspec.varargs is None and argspec.keywords is None: # then this is a function of the current controller pass On 19 mar, 11:13, Anthony abasta...@gmail.com wrote: Here's how the admin app does it: http://code.google.com/p/web2py/source/browse/applications/admin/cont You might try something like that. Anthony On Monday, March 19, 2012 6:16:45 AM UTC-4, Hassan Alnatour wrote: Dear ALL , How Can I Get ALL controller functions , as i know i can get the one am at in the view using request.function , so how can i get all of them ??
[web2py] Re: trouble reading this list
I was having that problem too... 2012. március 19., hétfő 18:20:01 UTC+1 időpontban Massimo Di Pierro a következőt írta: Is it just me? I am having trouble accessing some recent posts on this list. I see the title, author, and content says loading I apologize if I cannot answer but I do not know what to do but wait. massimo
[web2py] Re: export Data Abstraction Layer (DAL) to be used with Google Cloud SQL on App Engine
Might be a bug -- you can file an issue here: http://code.google.com/p/web2py/issues/list On Sunday, March 18, 2012 11:03:25 PM UTC-4, Jarod G.R. Meng wrote: Hi, I was trying to use web2py's DAL with Google Cloud SQL on App Engine, but to no avail. The error seems to be because GAE doesn't allow any manipulation of its filesystem which web2py's DAL module (gluon.dal) needs to define a folder attribute (my understanding of the trouble could be wrong). I was wondering whether anyone has used web2py's DAL with Cloud SQL before? Any advice is welcome! Jarod
[web2py] Re: web2py and roundcube
This is a problem with your web server configuration. Could you please post how are you using web2py, with Apache and mod_wsgi or...? How do your vhost configurations look like? On Friday, March 16, 2012 8:02:43 PM UTC+1, george3825 wrote: Hello, I am trying to setup web2py and roundcube on the same Ubuntu 11.10 box. I have to go to http://serverip/installer Per: http://trac.roundcube.net/wiki/Howto_Install But, when I do it takes me to a web2py page that tells me it can't find the controller. This error makes sense to me. But I am stuck on trying to either have roundcube respond on a different port or have web2py not respond on this page. Any ideas? Thanks, George
[web2py] DAL or SQL?
I need to run a reasonably complex query, and I'm wondering whether it would be better to code it in SQL, or should I try to get the DAL to provide the data (or maybe there's another way). There's no right or wrong answer, but I'd welcome opinion on the best approach. Simply put, consider two tables, tasks and periods. As well as an id field, tasks has a 'name' field too. Each task has multiple periods (of work) associated with it, and the periods table has id, date, start_time, end_time (and other fields). What I want to do is produce a summary that lists: task_name total_time ...for each task. That is, for each period, find the duration by subtracting the start_time from the end_time, and total all durations for each task in turn. I can write this in SQL, but then I lose the advantages of the DAL, as well as potentially losing database portability. I'm not even sure if this is doable in the DAL. What would be the best approach? -- You can have everything in life you want if you help enough other people get what they want - Zig Ziglar. Who did you help today?
[web2py] Errors in web2py Online Book
Just wanted to make note of two errors I found in the online book while coding up a website: 1) In the Forms and validators chapter, the SQLFORM constructor signature is shown with a named parameter record_id. In fact, the parameter name is record. 2) In the Email and SMS chapter, it says to Set mail.settings.login=False if the SMTP server does not require authentication. This should state Set mail.settings.login=None. These are based on version 1.99.6. Eudean
[web2py] How do I add b inside of a in HTML format?
I looked up the documentary and example, I wasn't able to find one. How can I convert this to Web2py format? a href=index.htmlWish List b(3)/b/a Thank you.
[web2py] Re: Get All Controller Functions
Ok, then the right approach is the admin's (I think it reads the controller files and does some sort of filtering with regular expressions). It even collects all function names from any controller in the app in a dictionary. What if web2py exposed that list for each app in an environment object (although I cannot think of a benefit of that service)? On 19 mar, 15:14, Anthony abasta...@gmail.com wrote: I don't think that will distinguish functions defined in models or imported within models or the controller, though I guess in most cases such functions wouldn't have no arguments. Anthony On Monday, March 19, 2012 1:28:10 PM UTC-4, Alan Etkin wrote: Would this work inside a controller? # this module belongs to the Python Standard Library #http://docs.python.org/library/inspect.html#module-inspect import inspect # when using the same globals() an exception is thrown for k, v in globals().copy().iteritems(): if inspect.isfunction(v): argspec = inspect.getargspec(v) # anything else to check? if len(argspec.args) == 0 and argspec.varargs is None and argspec.keywords is None: # then this is a function of the current controller pass On 19 mar, 11:13, Anthony abasta...@gmail.com wrote: Here's how the admin app does it: http://code.google.com/p/web2py/source/browse/applications/admin/cont You might try something like that. Anthony On Monday, March 19, 2012 6:16:45 AM UTC-4, Hassan Alnatour wrote: Dear ALL , How Can I Get ALL controller functions , as i know i can get the one am at in the view using request.function , so how can i get all of them ??
Re: [web2py] How do I add b inside of a in HTML format?
Never Mind. It was easier than I really thought of. {{=A('Wish List',B('(3)'),_href=URL('index'))}} Awesome :) On Mon, Mar 19, 2012 at 12:22 PM, Kenny nis...@gmail.com wrote: I looked up the documentary and example, I wasn't able to find one. How can I convert this to Web2py format? a href=index.htmlWish List b(3)/b/a Thank you.
[web2py] How to execute code after Register and Login functions ?
Dear All, I would like to execute some security related code (like key generation) after successful Registration and / or Login function ... Is it possible ? How to do it ? Thanks Seb
[web2py] Re: How to execute code after Register and Login functions ?
auth.settings.login_onaccept and auth.settings.register_onaccept can each be a list of callback functions that take a form object (the post-submission instance of the login and registration form objects, respectively). There are callbacks for other auth events as well -- see http://web2py.com/books/default/chapter/29/9#Settings-and-messages. Anthony On Monday, March 19, 2012 4:04:50 PM UTC-4, sebsto wrote: Dear All, I would like to execute some security related code (like key generation) after successful Registration and / or Login function ... Is it possible ? How to do it ? Thanks Seb
[web2py] Re: LDAP queries on all subdomains under root?
The new ldap_auth.py is in the trunk. If you could test it. Please give me a feedback if something is broken. http://code.google.com/p/web2py/issues/detail?id=724 2012. március 18., vasárnap 12:20:24 UTC+1 időpontban IVINH a következőt írta: It's work. But changed username_attrib instead username_attrs at lign 306: filter = '((%s=%s)(%s))' % ( username_attrib, ldap.filter.escape_filter_chars( username ), filterstr ) Thank szimszon. Vào 05:15:08 UTC+7 Thứ bảy, ngày 17 tháng ba năm 2012, szimszon đã viết: Can you please test it? I can test it only on monday. or you can customize the search for user: auth.settings.login_methods.append(ldap_auth( mode='custom', server='my.ldap.server', base_dn='ou=Users,dc=domain,dc=com', username_attrib='uid', custom_scope='subtree')) the custom_scope can be: base, onelevel, subtree. 2012. március 16., péntek 3:15:10 UTC+1 időpontban IVINH a következőt írta: Hi all, This my code for LDAP: from gluon.contrib.login_methods.ldap_auth import ldap_auth auth.settings.login_methods.append(ldap_auth(mode='cn',server='myserver',base_dn='ou=subdomain1,o=domain,c=com',port=389)) This works fine when I explicitely query SUBDOMAIN1 with the users that are in that domain (user1, user2, ...) My problem is that at runtime, I don't know what subdomain the users are from and I don't want to query all subdomains one after the other to find user information. Is these a way to query the entire directory (root) for users without knowing what subdomains they are in? If not, is there another better way to do this? Thank advance.
[web2py] Pls, upgrade eCardsonMap to V3
Hi, Pls, upgrade eCardsonMap to V3 Regards, Ashraf
[web2py] Re: DAL or SQL?
Another DAL challenge. accepted! assuming the model: db.define_table('tasks', Field('name') ) db.define_table('periods', Field('task_id', db.tasks), Field('start_time', 'datetime'), Field('end_time', 'datetime'), ) You'd like to calculate the total duration (let's say in seconds) of every period, and sum that total duration by task_id. Instead of visualizing the task_id, you want task.name. Instead of blowing the full solution, let's take it one step at a time, hopefully enjoying the logic that ties your goal, your brain, the database and the DAL abstraction for every period, duration is calculated as: duration = db.periods.end_time.seconds() - db.periods.start_time.seconds() now, get a list of all durations... result = db(db.periods.id0).select(db.periods.id, duration) But, you want the SUM of this durations, grouped by task_id. let's rewrite duration as the SUM of it duration = (db.periods.end_time.seconds() - db.periods.start_time.seconds()).sum() and the result, with task_id result = db(db.periods.id0).select(db.periods.task_id, durations, groupby=db.periods.task_id) Now, slip into it task.name instead of the id, joining the two tables the definition of duration remains the same duration = (db.periods.end_time.seconds() - db.periods.start_time.seconds()).sum() result = db(db.periods.task_id == db.tasks.id).select(db.tasks.name,duration, groupby=db.tasks.name) Everything clear ?? NB: a little caveat with compound expressions like sum() or this kind of calculations, looping the results can't be done in the usual way, like: for row in result: print row.tasks.name, row.duration this is going to raise an exception because duration is not a proper column of a table You can use the dictionary notation to solve the problem: for row in result: print row.tasks.name, row[duration] Il giorno lunedì 19 marzo 2012 20:00:42 UTC+1, backseat ha scritto: I need to run a reasonably complex query, and I'm wondering whether it would be better to code it in SQL, or should I try to get the DAL to provide the data (or maybe there's another way). There's no right or wrong answer, but I'd welcome opinion on the best approach. Simply put, consider two tables, tasks and periods. As well as an id field, tasks has a 'name' field too. Each task has multiple periods (of work) associated with it, and the periods table has id, date, start_time, end_time (and other fields). What I want to do is produce a summary that lists: task_name total_time ...for each task. That is, for each period, find the duration by subtracting the start_time from the end_time, and total all durations for each task in turn. I can write this in SQL, but then I lose the advantages of the DAL, as well as potentially losing database portability. I'm not even sure if this is doable in the DAL. What would be the best approach? -- You can have everything in life you want if you help enough other people get what they want - Zig Ziglar. Who did you help today?
[web2py] Re: How to execute code after Register and Login functions ?
Thanks Anthony ! On Mar 19, 9:14 pm, Anthony abasta...@gmail.com wrote: auth.settings.login_onaccept and auth.settings.register_onaccept can each be a list of callback functions that take a form object (the post-submission instance of the login and registration form objects, respectively). There are callbacks for other auth events as well -- seehttp://web2py.com/books/default/chapter/29/9#Settings-and-messages. Anthony On Monday, March 19, 2012 4:04:50 PM UTC-4, sebsto wrote: Dear All, I would like to execute some security related code (like key generation) after successful Registration and / or Login function ... Is it possible ? How to do it ? Thanks Seb
Re: [web2py] Re: TEXT data type deprecated in future MSSQL?
As an insider working with MSSQL at least 8 hours a day no need to worry, text is going to be there at least for five or more years. there are several professional applications that require it extensively. To make things worse, varchar(max) implementation - forced and recommended by MSSQL - performs very badly, so there are some peoples with real problems switching table definitions Beware of some idiosyncrasies with the text type comparing, sorting, grouping, etc support is limited. Although for MSSQL = 2005, I advise to switch now to varchar(max) and nvarchar(max): poses no problem at all (and restore complete functionality compared to other engines text type). The only real problem is for MSSQL 2000: varchar on it is limited to 8000 characters, so varchar(8000) it's the max you can get. Last but not least, every row in MSSQL 2000 can't exceed ~8000 bytes means that creating a table with two fields of varchar(8000) is not allowed. NB: The same applies for MSSQL 2005: you can't create a table with two varchar(8000) fields, but the restriction goes away with varchar(max)... actually the limit achieved with that is ~2.1GB for every single row.
Re: [web2py] Re: Book translation
Hello, Same here for Turkish translation... it might take a year by my humble hours I can dedicate now and then.. will be waiting for the heads-up.. On Tue, Dec 27, 2011 at 6:18 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: You will soon be able to do this online. On Dec 27, 10:03 am, Mirek Zvolský zvol...@seznam.cz wrote: I want start translation of the book 4th edition (czech language). Can I read somewhere hints, how to do it? Idea: Can we have menu item in web2py.com/book (Translations?) with such hints? -- Sefa Denizoğlu
[web2py] Using Translation without request object
Hi, I have created a standalone python module which allows me to do a whole bunch of tasks to the database. I then wrote a console application that can use this file, primary for automated tasks and or non-web based application api testing. Anyway how would I use the Translation in this situation considering there isn't a request so nothing is attached to current. I want to make it so my output is translated based on which ever language I set when the console application starts. Any suggestions? -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] Re: Creating a cms with restricted video streaming access
I've written a ELO - CMS using the plugin-wiki system and some custom widgets which for example insert a expandable/collapsable videoplayer based on MediaSite, audio-feedback and I'm working on self-evaluation tests with feedback and planning on using our SSO system for authentication/autorization. For now its freely accessable, see herehttp://webapp.fkt.uvt.nl/bho/plugin_wiki/page/begrippenlijst But be warned: it's in Dutch AND about leaning biblical Hebrew! Instant Press (both versions) I've used for other blogs/cms and I've looked at movu.ca which look promising. I would like to help to design and build a good, flexible Web2py ELO system. There have been some attempts, we just need some momentum. Maybe we can organise a Google Hangout or IRC discussion? Nico de Groot On Saturday, March 17, 2012 1:53:04 PM UTC+1, Alan Etkin wrote: Hi. I have been asked to buiild a web site with these features and requirements: -Content managment for universitary students and teachers Teachers will upload and edit course documents. -Students must pay a fee to access the site's content. -Students evaluation system with QA -Online video classes The site must allow (only authenticated) students to watch classes live or from a site's class video archive. Is there something already developed that I can use for this requirements? I know there are lot of separated solutions (Martin's Instant Press and I could mix them with more or less success, but I'd like to know if someone found a starting project that covers this requirements, so the development tasks can be decreased and there is no need to reinvent the wheel. For accessing video streams I am thinking of using a third-party brand like vimeo or other similar, have anybody tested those services? Could I use Instant Press for this project? Does it have this video streaming features or should I develop something like an Instant Press plugin for this case?. Thank you.
[web2py] Spatial / GIS support in DAL
Spatial / GIS support (in latest trunk) = Sponsored by AidIQ for use by Sahana Eden available for (so far) ++ 1) Postgres + PostGIS http://postgis.refractions.net/docs/ 2) MS SQL http://msdn.microsoft.com/en-us/library/ff848797.aspx SQLite + Spatialite next. Both geometry and geography fields are supported. supported functions (so far) st_asgeojson (PostGIS only) st_astext st_contained st_contains st_distance st_equals st_intersects st_overlaps st_simplify (PostGIS only) st_touches st_within Some MS SQL examples dbm = DAL(rmssql://user:pass@host:db) sp = dbm.define_table('spatial', Field('geo1','geometry()') ) # a point sp.insert(geo1=POINT (1 2)) 1 # a line sp.insert(geo1=LINESTRING (100 100, 20 180, 180 180)) 2 # a polygon (a square in this case) sp.insert(geo1=POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0))) 3 rr=dbm(sp.id0).select() print rr spatial.id,spatial.geo1 1, 2, 3, # why doesn't it display geo1? # field geo1 has an undisplayable internal representation in MS SQL # e.g. the first record's POINT(1 2) is stored as # 0x010CF03F0040 # to visualize as WKT use function st_astext rr=dbm(sp.id0).select(sp.id, sp.geo1.st_astext()) print rr spatial.id,spatial.geo1.STAsText() 1,POINT (1 2) 2,LINESTRING (100 100, 20 180, 180 180) 3,POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0)) # or using an alias rr=dbm(sp.id0).select(sp.id, sp.geo1.st_astext().with_alias('g1')) for r in rr: print r.spatial.id, r.g1 ... 1 POINT (1 2) 2 LINESTRING (100 100, 20 180, 180 180) 3 POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0)) # other functions # STContains rr=dbm(sp.geo1.st_contains(POINT(1 1))).select(sp.id,sp.geo1.st_astext()) print rr spatial.id,spatial.geo1.STAsText() 3,POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0)) # STDistance rr=dbm(sp.id0).select(sp.id, sp.geo1.st_distance(POINT(-1 2)).with_alias('d')) for r in rr: print r.spatial.id, r.d ... 1 2.0 2 140.714249456 3 1.0 # STIntersects rr=dbm(sp.geo1.st_intersects(LINESTRING(20 120,60 160))).select(sp.id,sp.geo1.st_astext()) print rr spatial.id,spatial.geo1.STAsText() 2,LINESTRING (100 100, 20 180, 180 180) 3,POLYGON ((0 0, 150 0, 150 150, 0 150, 0 0)) Some PostGIS examples + #pg is the postgres db connection pg.define_table('franchise', Field('code', 'string', length=1), Field('name'), ) pg.define_table('fastfood', Field('franchise', 'reference franchise'), Field('lat', 'double'), Field('lon', 'double'), Field('geom', 'geometry()'), ) # parameters for geom fields are: schema, srid and dimension # e.g. Field('geom', 'geometry('',4326,2)') # hard-coded defaults: srid=4326, dimension=2 # migration works, fields are added/dropped as required. pg.franchise.insert(code='b', name='Burger Joint') pg.fastfood.insert(franchise=1,lat=25.8092,lon=-80.24,geom='POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))') pg.commit() ff=pg.fastfood q=ff.geom.st_overlaps('POLYGON((1 1,5 1,5 5,1 5,1 1))') print pg(q).select() fastfood.id,fastfood.franchise,fastfood.lat,fastfood.lon,fastfood.geom # no records, there are no overlaps q=ff.geom.st_overlaps('POLYGON((1 1,11 1,11 11,11 1,1 1))') print pg(q).select() fastfood.id,fastfood.franchise,fastfood.lat,fastfood.lon,fastfood.geom 1,1,25.8092,-80.24,010320E6100100050 024402440244 02440 print pg(ff.id0).select(ff.id,ff.franchise,ff.lat,ff.lon,ff.geom.st_simplify(1).st_astext()) fastfood2.id,fastfood2.franchise,fastfood2.lat,fastfood2.lon,ST_AsText(ST_Simplify(fastfood2.geom, 1.0)) 1,1,25.8092,-80.24,POLYGON((0 0,10 0,10 10,0 10,0 0)) # geography example pg.define_table('airport', Field('code','string',3), Field('geog','geography()'), ) a=pg.airport a.insert(code='LAX', geog='POINT(-118.4079 33.9434)') 1 a.insert(code='CDG', geog='POINT(2.5559 49.0083)') 2 a.insert(code='REK', geog='POINT(-21.8628 64.1286)') 3 lax=POINT(-118.4079 33.9434) rr=pg(a.id0).select(a.code,a.geog.st_distance(lax).with_alias('from_lax')) for r in rr: print r.airport.code, r.from_lax ... LAX,0.0 CDG,9124665.26917 REK,6969660.54628 # results are in meters rr=pg(a.id0).select(a.code,a.geog.st_asgeojson().with_alias('geojson')) for r in rr: print r.airport.code, r.geojson ... LAX {type:Point,coordinates:[-118.4079,33.9433997]} CDG {type:Point,coordinates:[2.5559,49.0082998]} REK {type:Point,coordinates:[-21.8628,64.1286006]} More to come... Denes Lengyel.
[web2py] Using Facebook for registration and login
Has anyone programmed a Facebook integration for registration and login using this server-side technique: http://developers.facebook.com/docs/authentication/server-side/ I do not want to use Janrain.