[racket-dev] form:binding / request utilities

2011-03-04 Thread John Clements
I'm doing a web-server/insta example in class, and one of my students (Arlo 
White, cc:'ed) pointed out that  the existing framework for extracting bindings 
seems to be missing a bunch of useful functions. In particular, he volunteered 
to implement a few of the functions from the Spring framework, most notably a 
function that accepts a request and a name and returns the string associated 
with that name in the request's bindings.  Like hash-ref, it would allow you to 
specify your own failure behavior.

I've run into this myself, and it's always a pain to operate on the request 
structures.  Would you be open to adding a few functions like this to the 
web-server (if we provide them, along with docs and tests)? Looking at the 
documentation, it appears that there's some cleanup that just never made it to 
the top of someone's list.

John



smime.p7s
Description: S/MIME cryptographic signature
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] form:binding / request utilities

2011-03-04 Thread Jay McCarthy
That sounds reasonable. Here are a few things:

1) I almost exclusively use formlets, where these issues are basically
taken care of. I suggest checking them out.

2) Would it be good for the request struct to be a prop:dict where the
dictionary is the bindings? Would that be confusing because it is also
plausible to dictionary on the headers?

3) Part of what you want is just request-bindings, but
request-bindings has lots of subtle bugs. For example, HTTP does not
mandate UTF-8, so naive conversion to Racket strings can crash. HTTP
differentiates between form bindings and file bindings---for files you
definitely want the bytes and you should also be able to get the
filename.

4) The docs are in web-server/scribblings/http.scrbl; The tests are in
tests/web-server/private/request-test.rkt and
tests/web-server/servlet/bindings-test.rkt

Jay

2011/3/4 John Clements cleme...@brinckerhoff.org:
 I'm doing a web-server/insta example in class, and one of my students (Arlo 
 White, cc:'ed) pointed out that  the existing framework for extracting 
 bindings seems to be missing a bunch of useful functions. In particular, he 
 volunteered to implement a few of the functions from the Spring framework, 
 most notably a function that accepts a request and a name and returns the 
 string associated with that name in the request's bindings.  Like hash-ref, 
 it would allow you to specify your own failure behavior.

 I've run into this myself, and it's always a pain to operate on the request 
 structures.  Would you be open to adding a few functions like this to the 
 web-server (if we provide them, along with docs and tests)? Looking at the 
 documentation, it appears that there's some cleanup that just never made it 
 to the top of someone's list.

 John





-- 
Jay McCarthy j...@cs.byu.edu
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

The glory of God is Intelligence - DC 93

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] overwrite

2011-03-04 Thread Jakub Piotr Cłapa

On 27.02.11 23:33, Eli Barzilay wrote:

Two hours ago, John Clements wrote:


Add'l data point: I tried messing up the clock manually, by turning
off NTP, but I was unable to duplicate the bug this way.


NTP is unlikely to be the problem, since the times are saved on the
filesystem, independently of the system time (or clock).  And since
Robby says that DrR compares only the time value regardless of being
in the future, then there shouldn't be any problem with that.


If NTP or clock drift was the reason then makefiles would not work and 
vim would also complain a lot (an this is not the case, at least for me).


I do not use network mounts or git and I too get this message almost all 
the time on OS X. I will try to track it down using the patches posted 
in this thread.


--
regards,
Jakub Piotr Cłapa
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev