| CODENOTIFIER | HelpYou are not signed inSign in |
Project: erlyweb
Revision: 247
Author: yarivvv
Date: 27 May 2008 23:37:28
Changes:cleanups plus fixed redirect from hook()
Files:| ... | ...@@ -436,8 +436,10 @@ | |
| 436 | 436 | ModuleAtom when is_atom(ModuleAtom) -> |
| 437 | 437 | %% and try to locate the actual module, then |
| 438 | 438 | %% extract the last compile time |
| 439 | case catch(lists:keysearch(time,1, | |
| 440 | ModuleAtom:module_info(compile))) of | |
| 439 | case catch( | |
| 440 | lists:keysearch( | |
| 441 | time,1, | |
| 442 | ModuleAtom:module_info(compile))) of | |
| 441 | 443 | {value, |
| 442 | 444 | {time, |
| 443 | 445 | {Year,Month,Day,Hour,Minute,Second}}} -> |
| ... | ...@@ -447,9 +449,11 @@ | |
| 447 | 449 | |
| 448 | 450 | %% compile-time is in universal time, but |
| 449 | 451 | %% mtime is in local time |
| 450 | CompileTime=calendar:universal_time_to_local_time({{Year,Month,Day}, | |
| 451 | {Hour,Minute,Second}}), | |
| 452 | Mtime >= calendar:datetime_to_gregorian_seconds(CompileTime); | |
| 452 | CompileTime = | |
| 453 | calendar:universal_time_to_local_time( | |
| 454 | {{Year,Month,Day}, | |
| 455 | {Hour,Minute,Second}}), | |
| 456 | Mtime >= calendar:datetime_to_gregorian_seconds(CompileTime); | |
| 453 | 457 | _ -> |
| 454 | 458 | %% some part of finding the last |
| 455 | 459 | %% compile-time failed |
| ... | ...@@ -186,7 +186,7 @@ | |
| 186 | 186 | %% |
| 187 | 187 | %% @spec out(A::arg(), AppController::atom()) -> term() |
| 188 | 188 | out(A, AppController) -> |
| 189 | AppData = proplists:get_value(app_data_module, yaws_arg:opaque(A)), | |
| 189 | AppData = get_app_data(A), | |
| 190 | 190 | %% catch any exits from hook/1 |
| 191 | 191 | Req = case catch AppController:hook(A) of |
| 192 | 192 | {'EXIT', Err} -> |
| ... | ...@@ -199,7 +199,11 @@ | |
| 199 | 199 | Ewc -> |
| 200 | 200 | Ewc |
| 201 | 201 | end, |
| 202 | handle_request(A, AppController, Req, AppData). | |
| 202 | case is_redirect(A, Req) of | |
| 203 | {true, Val} -> Val; | |
| 204 | _ -> | |
| 205 | handle_request(A, AppController, Req, AppData) | |
| 206 | end. | |
| 203 | 207 | |
| 204 | 208 | %% checks that at least 3 seconds have passed since the last compilation |
| 205 | 209 | %% and that the request doesn't match the optional auto_compile_exclude |
| ... | ...@@ -333,7 +337,7 @@ | |
| 333 | 337 | element(1, get_initial_ewc1(Ewc)). |
| 334 | 338 | |
| 335 | 339 | get_initial_ewc1({ewc, A} = Ewc) -> |
| 336 | AppData = lookup_app_data_module(A), | |
| 340 | AppData = get_app_data(A), | |
| 337 | 341 | get_initial_ewc1(Ewc, AppData). |
| 338 | 342 | get_initial_ewc1({ewc, A}, AppData) -> |
| 339 | 343 | case get_ewc(A, AppData) of |
| ... | ...@@ -488,7 +492,7 @@ | |
| 488 | 492 | end. |
| 489 | 493 | |
| 490 | 494 | get_ewc(A) -> |
| 491 | get_ewc(A, lookup_app_data_module(A)). | |
| 495 | get_ewc(A, get_app_data(A)). | |
| 492 | 496 | |
| 493 | 497 | get_ewc(A, AppData) -> |
| 494 | 498 | Prefix = erlyweb_util:get_url_prefix(A), |
| ... | ...@@ -553,6 +557,7 @@ | |
| 553 | 557 | First |
| 554 | 558 | end. |
| 555 | 559 | |
| 556 | lookup_app_data_module(A) -> | |
| 560 | get_app_data(A) -> | |
| 557 | 561 | proplists:get_value(app_data_module, yaws_arg:opaque(A)). |
| 558 | 562 | |
| 563 |