[google-appengine] Re: Ajax Updater parameters transfer
For '/update_tags/mark365' Url mapping cloud be: ('/update_tags/(.*)', UpdateTags), And class: class UpdateTags(BaseRequestHandler): def get(self, mark): Javascript: function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags/' + mark, { method: 'get' }); } For '/update_tags?mark=mark365' ('/update_tags.*', UpdateTags), class UpdateTags(BaseRequestHandler): def get(self): mark = self.request.get('mark') function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags?mark=' + mark, { method: 'get' }); } For url '/update_tags' but with mark data in POST header ('/update_tags', UpdateTags), class UpdateTags(BaseRequestHandler): def post(self): mark = self.request.get('mark') function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags', { method: 'post', parameters: { 'mark':mark } }); } Also your template file probably should be: span class=itema href=javascript:updateTags({{mark}})b {{mark}}/b/a/span But good principle would be to separate presentation from behavior and not to have html and javascript in same file. It depends of you problem but something like: span class=itema href=# class=marks id={{ mark }}strong {{mark}}/strong/a/span And in separate javascript file you need to have one more function that is executed after html document downloaded: this in html script type=text/javascript Event.observe(window, 'load', init); /script And javascript code in separate file function init(){ $$('.marks').each(function(linkMark){ Event.observe(linkMark, 'click', updateTags); )}; } function updateTags(mouseInfo){ Event.stop(mouseInfo); var mark = mouseInfo.element().id; // or var mark = mouseInfo.element().readAttribute('id'); ... and here your preferred way of sending data. } Hope that helped. Matija. P.S. There could be some writing errors. On Dec 15, 7:09 am, Shay Ben Dov shay.ben...@gmail.com wrote: Hi, It should be '/update_tags/a' like when you use .?id={{ variable }} thanks, Shay --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Ajax Updater parameters transfer
thanks, I'll implement it in the following week and let you know how it comes out. Shay On Dec 15, 11:29 am, Matija matija.jerko...@gmail.com wrote: For '/update_tags/mark365' Url mapping cloud be: ('/update_tags/(.*)', UpdateTags), And class: class UpdateTags(BaseRequestHandler): def get(self, mark): Javascript: function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags/' + mark, { method: 'get' }); } For '/update_tags?mark=mark365' ('/update_tags.*', UpdateTags), class UpdateTags(BaseRequestHandler): def get(self): mark = self.request.get('mark') function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags?mark=' + mark, { method: 'get' }); } For url '/update_tags' but with mark data in POST header ('/update_tags', UpdateTags), class UpdateTags(BaseRequestHandler): def post(self): mark = self.request.get('mark') function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags', { method: 'post', parameters: { 'mark':mark } }); } Also your template file probably should be: span class=itema href=javascript:updateTags({{mark}})b {{mark}}/b/a/span But good principle would be to separate presentation from behavior and not to have html and javascript in same file. It depends of you problem but something like: span class=itema href=# class=marks id={{ mark }}strong {{mark}}/strong/a/span And in separate javascript file you need to have one more function that is executed after html document downloaded: this in html script type=text/javascript Event.observe(window, 'load', init); /script And javascript code in separate file function init(){ $$('.marks').each(function(linkMark){ Event.observe(linkMark, 'click', updateTags); )}; } function updateTags(mouseInfo){ Event.stop(mouseInfo); var mark = mouseInfo.element().id; // or var mark = mouseInfo.element().readAttribute('id'); ... and here your preferred way of sending data. } Hope that helped. Matija. P.S. There could be some writing errors. On Dec 15, 7:09 am,ShayBen Dov shay.ben...@gmail.com wrote: Hi, It should be '/update_tags/a' like when you use .?id={{ variable }} thanks, Shay- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Ajax Updater parameters transfer
javascript:updateTags(mark) what is mark in this function call? '/update_tags' + mark this url will not be matched by ('/update_tags', UpdateTags), Add some logging statements to see if you get inside the handler and what the value of certain variables is. 2008/12/13 Shay Ben Dov shay.ben...@gmail.com: Hi, I'm trying to develop a tagging application. What I'm missing is the wrap-around of all the components involved. The principle is: The calling link: span class=itema href=javascript:updateTags(mark)b{{mark}}/ b/a/span The JS function: function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags' + mark, { method: 'get' }); } the url mapping in my py program: ('/update_tags', UpdateTags), the class in the py program class UpdateTags(BaseRequestHandler): def get(self): mark = self.request.get('id') .. self.response.headers['Content-Type'] = 'text/plain' self.response.out.write(this is new tag__ + mark) I hope I'm doing it right. Please let me know if I'm on the right track to implement it correctly. Thanks, Shay Ben Dov --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Ajax Updater parameters transfer
'/update_tags' + mark mark is name of the parameter I want to transfer to the following class: class UpdateTags(BaseRequestHandler): and I wish to process it according to the app requirements. Shay On Dec 14, 11:26 am, djidjadji djidja...@gmail.com wrote: javascript:updateTags(mark) what is mark in this function call? '/update_tags' + mark this url will not be matched by ('/update_tags', UpdateTags), Add some logging statements to see if you get inside the handler and what the value of certain variables is. 2008/12/13ShayBen Dov shay.ben...@gmail.com: Hi, I'm trying to develop a tagging application. What I'm missing is the wrap-around of all the components involved. The principle is: The calling link: span class=itema href=javascript:updateTags(mark)b{{mark}}/ b/a/span The JS function: function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags' + mark, { method: 'get' }); } the url mapping in my py program: ('/update_tags', UpdateTags), the class in the py program class UpdateTags(BaseRequestHandler): def get(self): mark = self.request.get('id') .. self.response.headers['Content-Type'] = 'text/plain' self.response.out.write(this is new tag__ + mark) I hope I'm doing it right. Please let me know if I'm on the right track to implement it correctly. Thanks, ShayBen Dov- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Ajax Updater parameters transfer
If mark == 'a', do you expect '/update_tags' + mark to be '/ update_tagsa' or '/update_tags/a'? Which one do you think will match ('/update_tags', UpdateTags)? And, once you get a form that matches, how are you planning to extract the original value of mark? On Dec 14, 3:13 am, Shay Ben Dov shay.ben...@gmail.com wrote: '/update_tags' + mark mark is name of the parameter I want to transfer to the following class: class UpdateTags(BaseRequestHandler): and I wish to process it according to the app requirements. Shay On Dec 14, 11:26 am, djidjadji djidja...@gmail.com wrote: javascript:updateTags(mark) what is mark in this function call? '/update_tags' + mark this url will not be matched by ('/update_tags', UpdateTags), Add some logging statements to see if you get inside the handler and what the value of certain variables is. 2008/12/13ShayBen Dov shay.ben...@gmail.com: Hi, I'm trying to develop a tagging application. What I'm missing is the wrap-around of all the components involved. The principle is: The calling link: span class=itema href=javascript:updateTags(mark)b{{mark}}/ b/a/span The JS function: function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags' + mark, { method: 'get' }); } the url mapping in my py program: ('/update_tags', UpdateTags), the class in the py program class UpdateTags(BaseRequestHandler): def get(self): mark = self.request.get('id') .. self.response.headers['Content-Type'] = 'text/plain' self.response.out.write(this is new tag__ + mark) I hope I'm doing it right. Please let me know if I'm on the right track to implement it correctly. Thanks, ShayBen Dov- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Ajax Updater parameters transfer
Hi, It should be '/update_tags/a' like when you use .?id={{ variable }} thanks, Shay On Dec 14, 11:51 pm, Andy Freeman ana...@earthlink.net wrote: If mark == 'a', do you expect '/update_tags' + mark to be '/ update_tagsa' or '/update_tags/a'? Which one do you think will match ('/update_tags', UpdateTags)? And, once you get a form that matches, how are you planning to extract the original value of mark? On Dec 14, 3:13 am,ShayBen Dov shay.ben...@gmail.com wrote: '/update_tags' + mark mark is name of the parameter I want to transfer to the following class: class UpdateTags(BaseRequestHandler): and I wish to process it according to the app requirements. Shay On Dec 14, 11:26 am, djidjadji djidja...@gmail.com wrote: javascript:updateTags(mark) what is mark in this function call? '/update_tags' + mark this url will not be matched by ('/update_tags', UpdateTags), Add some logging statements to see if you get inside the handler and what the value of certain variables is. 2008/12/13ShayBen Dov shay.ben...@gmail.com: Hi, I'm trying to develop a tagging application. What I'm missing is the wrap-around of all the components involved. The principle is: The calling link: span class=itema href=javascript:updateTags(mark)b{{mark}}/ b/a/span The JS function: function updateTags(mark){ new Ajax.Updater('tagging_area', '/update_tags' + mark, { method: 'get' }); } the url mapping in my py program: ('/update_tags', UpdateTags), the class in the py program class UpdateTags(BaseRequestHandler): def get(self): mark = self.request.get('id') .. self.response.headers['Content-Type'] = 'text/plain' self.response.out.write(this is new tag__ + mark) I hope I'm doing it right. Please let me know if I'm on the right track to implement it correctly. Thanks, ShayBen Dov- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---