[open-ils-commits] r8220 - branches/rel_1_2/Open-ILS/src/perlmods/OpenILS

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Dec 15 11:29:56 EST 2007


Author: phasefx
Date: 2007-12-15 11:08:52 -0500 (Sat, 15 Dec 2007)
New Revision: 8220

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Event.pm
Log:
backporting dbs' Event.pm namespace patch since .getAttribute in my local version of libxml isn't picking up xml:lang in ils_events.xml

Modified: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Event.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Event.pm	2007-12-15 05:29:49 UTC (rev 8219)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Event.pm	2007-12-15 16:08:52 UTC (rev 8220)
@@ -1,4 +1,5 @@
 package OpenILS::Event;
+# vim:noet:ts=4
 use strict; use warnings;
 use XML::LibXML;
 use OpenSRF::Utils::SettingsClient;
@@ -75,9 +76,17 @@
 	$descs = {};
 	my @desc = $doc->documentElement->findnodes('//desc');
 	for my $d (@desc) {
-		my $lang = $d->getAttribute('lang');
+		my $lang = $d->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang');
 		my $code = $d->parentNode->getAttribute('code');
-		$descs->{$lang} = {} unless $descs->{$lang};
+		unless ($descs && $lang && exists $descs->{$lang}) {
+			$descs->{$lang} = {};
+			if (!$descs) {
+				$logger->error("No error description nodes found in $eventsxml.");
+			}
+			if (!$lang) {
+				$logger->error("No xml:lang attribute found for node in $eventsxml.");
+			}
+		}
 		$descs->{$lang}->{$code} = $d->textContent;
 	}
 }



More information about the open-ils-commits mailing list