From: Tara L Andrews Date: Wed, 19 Sep 2012 14:11:52 +0000 (+0200) Subject: check for language module in root before relying on it X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ed2aaedb8e176c9a304811e70e954d982e879032;p=scpubgit%2Fstemmaweb.git check for language module in root before relying on it --- diff --git a/lib/stemmaweb/Controller/Root.pm b/lib/stemmaweb/Controller/Root.pm index 7987334..aa6329c 100644 --- a/lib/stemmaweb/Controller/Root.pm +++ b/lib/stemmaweb/Controller/Root.pm @@ -220,7 +220,8 @@ sub textinfo :Local :Args(1) { } # Handle language param, making Default => null my $langval = delete $params->{language} || 'Default'; - unless( $tradition->language eq $langval ) { + + unless( $tradition->language eq $langval || !$tradition->can('language') ) { try { $tradition->language( $langval ); $changed = 1; @@ -275,11 +276,14 @@ sub textinfo :Local :Args(1) { my $textinfo = { textid => $textid, name => $tradition->name, - language => $tradition->language, + #language => $tradition->language, public => $tradition->public || 0, owner => $tradition->user ? $tradition->user->email : undef, witnesses => [ map { $_->sigil } $tradition->witnesses ], }; + if( $tradition->can('language') ) { + $textinfo->{'language'} = $tradition->language; + } my @stemmasvg = map { $_->as_svg() } $tradition->stemmata; map { $_ =~ s/\n/ /mg } @stemmasvg; $textinfo->{stemmata} = \@stemmasvg;