|
|
| Author |
Message |
< Erlyweb mailing list ~ bug: annoying double slash in function a/? when app root is |
| Guest |
Posted: Sun Aug 03, 2008 10:51 pm |
|
|
|
Guest
|
Hi,
My get_app_root patch could be simplified if one doesn't use the
lists:split/? function.
Just do this:
get_app_root (A) ->
ServerPath = yaws_arg:server_path(A)
, AppModData = yaws_arg:appmoddata(A)
, ServerPath -- AppModData.
This has a major problem.
Suppose the approot contains the string "abcd". Suppose there's a
component also called "abcd".
"/abcdtest/abcd" -- "abcd". Guess which one gets removed. The intended
effect is to remove the 2nd instance of "abcd" from left to right.
One could reverse both appmoddata and server_path, then subtract the
reversed appmoddata from the server_path. That would solve the
abovementioned problem. I think it could be cheaper and easier than
the present solution provided by Yariv.
get_app_root (A) ->
ServerPath = yaws_arg:server_path(A)
, AppModData = yaws_arg:appmoddata(A)
, lists:reverse(ServerPath) -- lists:reverse(AppModData).
The cheapest solution would be to store this value somewhere
permanently... magically, like the magic model and magic controller.
Yariv what do you think?
For instance:
erlyweb_<project>:get_constant()... like app_root, app_name etc.
Compute constants only once.
Bye.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|