Permalink
Browse files

Fix for #41

(and mauricemach/zappa#99 incidentally)
  • Loading branch information...
1 parent 5b5b89c commit 41f8faae4016dc3fe62c121fec2b5f75fd6ad393 @shimaore shimaore committed Sep 4, 2012
Showing with 13 additions and 6 deletions.
  1. +9 −0 docs/migrate-0.4.md
  2. +2 −3 src/client.coffee
  3. +2 −3 src/zappa.coffee
View
9 docs/migrate-0.4.md
@@ -34,3 +34,12 @@ Zappa in places. Here are the differences we know about.
* Express 3.0 is no longer a subclass of the Node.js HTTP server. The server
object is available as `@server`; `@app.listen` is now
`@server.listen`.
+
+
+Other changes are Zappa-specific and simplify the API:
+
+* If you built variadic helpers in Zappa 0.3 you might have been aware of an undocumented,
+ extraneous parameter (the context) provided to the helpers.
+
+ That extraneous argument has been removed since it is a duplicate of `this`.
+ Helper functions now receive the arguments provided by the caller unmodified.
View
5 src/client.coffee
@@ -16,9 +16,8 @@ skeleton = ->
for name, helper of helpers
do (name, helper) ->
if typeof helper is 'function'
- ctx[name] = (args...) ->
- args.push ctx
- helper.apply ctx, args
+ ctx[name] = ->
+ helper.apply ctx, arguments
else
ctx[name] = helper
ctx
View
5 src/zappa.coffee
@@ -294,9 +294,8 @@ zappa.app = (func,options={}) ->
for name, helper of helpers
do (name, helper) ->
if typeof helper is 'function'
- ctx[name] = (args...) ->
- args.push ctx
- helper.apply ctx, args
+ ctx[name] = ->
+ helper.apply ctx, arguments
else
ctx[name] = helper
ctx

0 comments on commit 41f8faa

Please sign in to comment.