[Proto-Scripty] Re: Ajax.Request add a toString method
Maybe you could describe this feature in some form (could be more generic to other Prototype objects) in the documentation. I'm assuming Object.inspect uses the toString method. I agree with you that debugging features should be stripped, if such a debug version would be created, implementation of the toString method of several classes could be added... On Nov 7, 5:34 pm, T.J. Crowder [EMAIL PROTECTED] wrote: FWIW, although I think it's a neat idea, I don't think I'd want to see it in Prototype itself. I think it's more of a debugging thing. (Granted Prototype has some other debugging things; I'd like to strip those out of the release version as well...) -- T.J. Crowder tj / crowder software / com On Nov 7, 3:49 pm, kangax [EMAIL PROTECTED] wrote: On Nov 7, 9:08 am, jaap.taal [EMAIL PROTECTED] wrote: I'd like a toString method for an Ajax.Request object that can identify the request for logging purposes. Right now I'm using the following custom code: Ajax.Request.prototype.toString = function() { if (this.method == 'get') { And what if it's PUT or DELETE? return this.url + (GET); } else { return this.url + ? + $H(this.parameters).toQueryString() + (POST); } }; I think something like this ought to be in the prototype library. I don't remember anyone proposing such thing : ) You can create a ticket (marking it as an enhancement) but I'm afraid what the output of `toString` should be is a pretty subjective decision. I think it's easy enough to write one (as you did) and tailor it to your specific need. -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Ajax.Request add a toString method
Best fit for this would be an inspect method. Have a look at the rest of the framework and at Ruby to see how this is generally implemented. Best, Tobie On Nov 8, 4:09 pm, jaap.taal [EMAIL PROTECTED] wrote: On Nov 7, 4:49 pm, kangax [EMAIL PROTECTED] wrote: On Nov 7, 9:08 am, jaap.taal [EMAIL PROTECTED] wrote: I'd like a toString method for an Ajax.Request object that can identify the request for logging purposes. Right now I'm using the following custom code: Ajax.Request.prototype.toString = function() { if (this.method == 'get') { And what if it's PUT or DELETE? I said something like this :) I'm not using PUT and DELETE in my application, so this was enough for me. return this.url + (GET); } else { return this.url + ? + $H(this.parameters).toQueryString() + (POST); } }; I think something like this ought to be in the prototype library. I don't remember anyone proposing such thing : ) You can create a ticket (marking it as an enhancement) but I'm afraid what the output of `toString` should be is a pretty subjective decision. I think it's easy enough to write one (as you did) and tailor it to your specific need. -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Ajax.Request add a toString method
FWIW, although I think it's a neat idea, I don't think I'd want to see it in Prototype itself. I think it's more of a debugging thing. (Granted Prototype has some other debugging things; I'd like to strip those out of the release version as well...) -- T.J. Crowder tj / crowder software / com On Nov 7, 3:49 pm, kangax [EMAIL PROTECTED] wrote: On Nov 7, 9:08 am, jaap.taal [EMAIL PROTECTED] wrote: I'd like a toString method for an Ajax.Request object that can identify the request for logging purposes. Right now I'm using the following custom code: Ajax.Request.prototype.toString = function() { if (this.method == 'get') { And what if it's PUT or DELETE? return this.url + (GET); } else { return this.url + ? + $H(this.parameters).toQueryString() + (POST); } }; I think something like this ought to be in the prototype library. I don't remember anyone proposing such thing : ) You can create a ticket (marking it as an enhancement) but I'm afraid what the output of `toString` should be is a pretty subjective decision. I think it's easy enough to write one (as you did) and tailor it to your specific need. -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Ajax.Request add a toString method
On Nov 7, 9:08 am, jaap.taal [EMAIL PROTECTED] wrote: I'd like a toString method for an Ajax.Request object that can identify the request for logging purposes. Right now I'm using the following custom code: Ajax.Request.prototype.toString = function() { if (this.method == 'get') { And what if it's PUT or DELETE? return this.url + (GET); } else { return this.url + ? + $H(this.parameters).toQueryString() + (POST); } }; I think something like this ought to be in the prototype library. I don't remember anyone proposing such thing : ) You can create a ticket (marking it as an enhancement) but I'm afraid what the output of `toString` should be is a pretty subjective decision. I think it's easy enough to write one (as you did) and tailor it to your specific need. -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---