Mercurial > repos > rhope
diff framework.rhope @ 148:f582fd6c75ee
Fixed framework port, works for said.rhope example
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 22 Nov 2010 01:37:05 -0500 |
parents | f3686f60985d |
children | 47ab97730865 |
line wrap: on
line diff
--- a/framework.rhope Mon Nov 22 01:15:02 2010 -0500 +++ b/framework.rhope Mon Nov 22 01:37:05 2010 -0500 @@ -37,10 +37,7 @@ } string,out headers <- [final page]Render - after headers <- HTTP OK[ncon, Get Content Type[".html"], [string]Byte Length, out headers] - { Print["Sent status"] - { [[string]Write to File[after headers]]Close - { Print["Wrote data"] }}} + [[string]Write to File[HTTP OK[ncon, Get Content Type[".html"], [string]Byte Length, out headers]]]Close } Handler Fixer[handler:out] @@ -423,7 +420,7 @@ Process POST[page,con,headers:out,ncon] { - ,ncon <- [con]Read[[headers]Index["Content-Length"]] + ,ncon <- [con]Read[Int32[[headers]Index["Content-Length"]]] { post string <- [String[~]]Replace["+"," "] } @@ -513,6 +510,48 @@ out <- in } +Render@String Cat[string:out,headers] +{ + out <- [Web Text[string,""]]Render +} + +Name@String Cat[string:out,none] +{ + none <- string +} + +Postback@String Cat[in,post data:out,events] +{ + out <- in + events <- List[] +} + +Set Session@String Cat[in,session:out] +{ + out <- in +} + +Render@String Slice[string:out,headers] +{ + out <- [Web Text[string,""]]Render +} + +Name@String Slice[string:out,none] +{ + none <- string +} + +Postback@String Slice[in,post data:out,events] +{ + out <- in + events <- List[] +} + +Set Session@String Slice[in,session:out] +{ + out <- in +} + Blueprint Web Field { Name @@ -612,20 +651,23 @@ Dirty } -Get Unique ID[:out] uses Session +_Get Counter[:out] uses Session { - Print["Get Unique ID"] - out <- [[String[Session::ID]]Append["_"]]Append[String[Random[]]] - { Session::ID <- [Session::ID]+[1] } + out <- Val[Session::ID] + { Session::ID <- [~]+[1] } +} + +Get Unique ID[:out] +{ + out <- [[String[_Get Counter[]]]Append["_"]]Append[String[Random[]]] } Session[:out] { out <- [[[[Build[Session()]]Session ID <<[Get Unique ID[]]]Use Cookies <<[No]]Data <<[Dictionary[]]]Dirty <<[No] - { Print["Built session"] } } -Load Session[queryvars,headers:out] uses Session +_Load Session[queryvars,headers:out,makenew] uses Session { ,checkquery <- [headers]Index["Cookie"] { @@ -647,8 +689,11 @@ out, makenew <- [Session::Sessions]Index[~] } } - - Val[makenew] +} + +Load Session[queryvars,headers:out] +{ + out <- _Load Session[queryvars,headers] {} { out <- Session[] } @@ -700,6 +745,7 @@ Save@Session[session:out] uses Session { Session::Sessions <- [Session::Sessions]Set[[session]Session ID >>, session] + out <- Yes } Finalize@Session[session,headers:out headers]