kunzite: (Default)
Mike A. Trethewey ([personal profile] kunzite) wrote in [site community profile] dw_styles2012-08-21 09:47 pm

get_url()

s2
function builtin get_url(string user, string view) : string
"Returns a URL to the specified view for the specified user. Views use the same names as elsewhere. (recent, friends, archive, month, userinfo)";

function builtin get_url(UserLite user, string view) : string
"Returns a URL to the specified view for the specified user. Views use the same names as elsewhere. (recent, friends, archive, month, userinfo)";
Perl
sub get_url
{
    my ($ctx, $obj, $view) = @_;
    my $user;
[...]
    my $u = LJ::load_user($user);
[...]
    my $base = $u->journal_base;
    return "$base/$view";
}
views are in fact not using the all of the same names as LiveJournal. so, it blindly returns whatever string is given. layouts originating on LJ and being ported over to DW can potentially have old code like get_url($e.journal, "friends") and still get http://kunzite.dreamwidth.org/friends which results in a 404 here.

so, the question is, should people know better and update their code or should get_url() have a clause that $view = "read" if $view eq "friends";?
ninetydegrees: Drawing: a girl's face, with a yellow and green stripe over one eye (Default)

[personal profile] ninetydegrees 2012-08-22 06:32 am (UTC)(link)
Core 1 or Core 2?
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2012-08-22 10:38 am (UTC)(link)
Already commented on the bug I asked you to open ( thanks for that!) but also commenting here for the record. At first I was leaning towards updating the code you pointed out, but the more I think about it, the more comfortable I am with just letting people update any code they're porting over.

They already have to, anyway, if they're checking the view (i.e., $.view == "read", not $.view == "friends").
foxfirefey: A guy looking ridiculous by doing a fashionable posing with a mouse, slinging the cord over his shoulders. (geek)

[personal profile] foxfirefey 2012-08-22 09:15 pm (UTC)(link)
Might wanna put the <pre> stuff under a cut--it stretches way out!
baggyeyes: Princess Leia (Default)

[personal profile] baggyeyes 2012-08-23 11:30 am (UTC)(link)
There's a way to fix that - overflow:auto for the pre tag.