[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-08-18 Thread Ken Snyder
Yes! The core devs do need to address whether or not this
Ajax.Request#getStatus() behavior will be fixed.
All non-HTTP requests (namely file:) return a status of 0. A function like
the following needs to be added, probably in Ajax.Request#getStatus()

isHttp: function() {
  var pcol = String(this.url).match(/^([a-z]+)?\:/i);
  if (!pcol) {
return window.location.protocol.match(/^https?\:/);
  }
  if (pcol[1] == 'http') {
return true;
  }
},

In my opinion, the status should be zero only on failure and an
onNetworkError or the like should be fired in place of on0 (Firing on0
seems kludgey). Other error status codes (such as 12002, 12007, 12029,
12030, 12031, 12152 and 13030) need to be mapped to a status of 0 and fire
onNetworkError (see Ajax: the Complete Reference by Thomas Powell -
http://books.google.com/books?id=p9hrjVMAeYkCpg=PA180 )

Then, as you mentioned, Ajax.Request#success() would then be  return
(status = 200  status 300);

With the current state of Prototype, you'll need to manually interpret a
success as a failure when the request is HTTP.

- Ken


On Fri, Jul 17, 2009 at 4:15 AM, T.J. Crowder t...@crowdersoftware.comwrote:


  Looks like success() returns TRUE all the time as foolged said.

 Yes, if getStatus returns 0 (either because the HTTP status code
 really came back from the browser as 0, or because the browser didn't
 supply one at all), then success will return true.  This has been
 noted before.[1][2]

 I'd love to hear from one of the core devs (NOT just someone active on
 this list like myself) *why* zero is considered success, because it
 doesn't make sense to me.  The server being offline is certainly not a
 successful outcome.  Most of the contributors to Prototype are not
 dumb, it's there for a reason, I just want to know what the reason is
 since they didn't feel it deserved a comment in the source.

 [1]
 http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests
 [2]
 http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/6d1d9fc7aa1e927a
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available


 On Jul 16, 1:52 pm, dmitrymos dmitry...@gmail.com wrote:
  Alex, what does success() return if getStatus() returns 0 in case of
  error?
 
  Looks like success() returns TRUE all the time as foolged said.
 
  On Jul 16, 7:37 am, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
 
 
 
   as it states...
 
   Return !status (NOT STATUS) || (OR) status greater than or equal to 200
   (TRUE|FALSE)  status LESS THAN 300
 
   as i said again it returns a true false
 
   - Original Message -
   From: foolged fool...@gmail.com
   To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
   Sent: Thursday, July 16, 2009 10:42 AM
   Subject: [Proto-Scripty] Re: checked !status in line 1496?
 
   (prototype-1.6.1.RC3)
 
Hi All
You do not understand my question.
I asked, not what is returned.
I asked what is checked! status?
 
IMHO rightly so.
return (status = 200   status 300);
 


--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-08-18 Thread Tobie Langel

An ajax revamp is planned for 2.0.

Best,

Tobie

On Aug 18, 4:55 pm, Ken Snyder kendsny...@gmail.com wrote:
 Yes! The core devs do need to address whether or not this
 Ajax.Request#getStatus() behavior will be fixed.
 All non-HTTP requests (namely file:) return a status of 0. A function like
 the following needs to be added, probably in Ajax.Request#getStatus()

 isHttp: function() {
   var pcol = String(this.url).match(/^([a-z]+)?\:/i);
   if (!pcol) {
     return window.location.protocol.match(/^https?\:/);
   }
   if (pcol[1] == 'http') {
     return true;
   }

 },

 In my opinion, the status should be zero only on failure and an
 onNetworkError or the like should be fired in place of on0 (Firing on0
 seems kludgey). Other error status codes (such as 12002, 12007, 12029,
 12030, 12031, 12152 and 13030) need to be mapped to a status of 0 and fire
 onNetworkError (see Ajax: the Complete Reference by Thomas Powell 
 -http://books.google.com/books?id=p9hrjVMAeYkCpg=PA180)

 Then, as you mentioned, Ajax.Request#success() would then be  return
 (status = 200  status 300);

 With the current state of Prototype, you'll need to manually interpret a
 success as a failure when the request is HTTP.

 - Ken

 On Fri, Jul 17, 2009 at 4:15 AM, T.J. Crowder t...@crowdersoftware.comwrote:





   Looks like success() returns TRUE all the time as foolged said.

  Yes, if getStatus returns 0 (either because the HTTP status code
  really came back from the browser as 0, or because the browser didn't
  supply one at all), then success will return true.  This has been
  noted before.[1][2]

  I'd love to hear from one of the core devs (NOT just someone active on
  this list like myself) *why* zero is considered success, because it
  doesn't make sense to me.  The server being offline is certainly not a
  successful outcome.  Most of the contributors to Prototype are not
  dumb, it's there for a reason, I just want to know what the reason is
  since they didn't feel it deserved a comment in the source.

  [1]
 http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-re...
  [2]
 http://groups.google.com/group/prototype-scriptaculous/browse_thread/...
  --
  T.J. Crowder
  tj / crowder software / com
  Independent Software Engineer, consulting services available

  On Jul 16, 1:52 pm, dmitrymos dmitry...@gmail.com wrote:
   Alex, what does success() return if getStatus() returns 0 in case of
   error?

   Looks like success() returns TRUE all the time as foolged said.

   On Jul 16, 7:37 am, Alex McAuley webmas...@thecarmarketplace.com
   wrote:

as it states...

Return !status (NOT STATUS) || (OR) status greater than or equal to 200
(TRUE|FALSE)  status LESS THAN 300

as i said again it returns a true false

- Original Message -
From: foolged fool...@gmail.com
To: Prototype  script.aculo.us 
  prototype-scriptaculous@googlegroups.com
Sent: Thursday, July 16, 2009 10:42 AM
Subject: [Proto-Scripty] Re: checked !status in line 1496?

(prototype-1.6.1.RC3)

 Hi All
 You do not understand my question.
 I asked, not what is returned.
 I asked what is checked! status?

 IMHO rightly so.
 return (status = 200   status 300);
--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-08-18 Thread Ken Snyder
yay!

On Tue, Aug 18, 2009 at 3:36 PM, Tobie Langel tobie.lan...@gmail.comwrote:


 An ajax revamp is planned for 2.0.

 Best,

 Tobie



--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-07-17 Thread dmitrymos

Alex, what does success() return if getStatus() returns 0 in case of
error?

Looks like success() returns TRUE all the time as foolged said.

On Jul 16, 7:37 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 as it states...

 Return !status (NOT STATUS) || (OR) status greater than or equal to 200
 (TRUE|FALSE)  status LESS THAN 300

 as i said again it returns a true false



 - Original Message -
 From: foolged fool...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Thursday, July 16, 2009 10:42 AM
 Subject: [Proto-Scripty] Re: checked !status in line 1496?

 (prototype-1.6.1.RC3)

  Hi All
  You do not understand my question.
  I asked, not what is returned.
  I asked what is checked! status?

  IMHO rightly so.
  return (status = 200   status 300);

--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-07-17 Thread Alex McAuley

What about status's that are zero ? (some browsers report 0 as offline 
server)

..

Thats why its in there



- Original Message - 
From: dmitrymos dmitry...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, July 16, 2009 1:52 PM
Subject: [Proto-Scripty] Re: checked !status in line 1496? 
(prototype-1.6.1.RC3)



Alex, what does success() return if getStatus() returns 0 in case of
error?

Looks like success() returns TRUE all the time as foolged said.

On Jul 16, 7:37 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 as it states...

 Return !status (NOT STATUS) || (OR) status greater than or equal to 200
 (TRUE|FALSE)  status LESS THAN 300

 as i said again it returns a true false



 - Original Message -
 From: foolged fool...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Thursday, July 16, 2009 10:42 AM
 Subject: [Proto-Scripty] Re: checked !status in line 1496?

 (prototype-1.6.1.RC3)

  Hi All
  You do not understand my question.
  I asked, not what is returned.
  I asked what is checked! status?

  IMHO rightly so.
  return (status = 200   status 300);




--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-07-17 Thread T.J. Crowder

 Looks like success() returns TRUE all the time as foolged said.

Yes, if getStatus returns 0 (either because the HTTP status code
really came back from the browser as 0, or because the browser didn't
supply one at all), then success will return true.  This has been
noted before.[1][2]

I'd love to hear from one of the core devs (NOT just someone active on
this list like myself) *why* zero is considered success, because it
doesn't make sense to me.  The server being offline is certainly not a
successful outcome.  Most of the contributors to Prototype are not
dumb, it's there for a reason, I just want to know what the reason is
since they didn't feel it deserved a comment in the source.

[1] http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests
[2] 
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/6d1d9fc7aa1e927a
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jul 16, 1:52 pm, dmitrymos dmitry...@gmail.com wrote:
 Alex, what does success() return if getStatus() returns 0 in case of
 error?

 Looks like success() returns TRUE all the time as foolged said.

 On Jul 16, 7:37 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:



  as it states...

  Return !status (NOT STATUS) || (OR) status greater than or equal to 200
  (TRUE|FALSE)  status LESS THAN 300

  as i said again it returns a true false

  - Original Message -
  From: foolged fool...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
  Sent: Thursday, July 16, 2009 10:42 AM
  Subject: [Proto-Scripty] Re: checked !status in line 1496?

  (prototype-1.6.1.RC3)

   Hi All
   You do not understand my question.
   I asked, not what is returned.
   I asked what is checked! status?

   IMHO rightly so.
   return (status = 200   status 300);
--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-07-16 Thread foolged

Hi All
You do not understand my question.
I asked, not what is returned.
I asked what is checked! status?

IMHO rightly so.
return (status = 200   status 300);
--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-07-16 Thread Alex McAuley

as it states...


Return !status (NOT STATUS) || (OR) status greater than or equal to 200 
(TRUE|FALSE)  status LESS THAN 300

as i said again it returns a true false

- Original Message - 
From: foolged fool...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, July 16, 2009 10:42 AM
Subject: [Proto-Scripty] Re: checked !status in line 1496? 
(prototype-1.6.1.RC3)



 Hi All
 You do not understand my question.
 I asked, not what is returned.
 I asked what is checked! status?

 IMHO rightly so.
 return (status = 200   status 300);
 
 


--~--~-~--~~~---~--~~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---