Partial apply of a patch from Frederic, this ensures that
authorJoshua Ferraro <jmf@liblime.com>
Tue, 8 Jul 2008 23:19:58 +0000 (18:19 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 8 Jul 2008 23:19:58 +0000 (18:19 -0500)
Context is cached; the remaining syspref cacheing will be
delayed until 3.2 as it needs to be paired with an as yet
unwritten setter for sysprefs

C4/Context.pm

index 3cba0ff..b9084b4 100644 (file)
@@ -249,11 +249,11 @@ sub db_scheme2dbi {
 sub import {
     my $package = shift;
     my $conf_fname = shift;        # Config file name
-    my $context;
+    $context;
 
     # Create a new context from the given config file name, if
     # any, then set it as the current context.
-    $context = new C4::Context($conf_fname);
+    $context = new C4::Context($conf_fname) unless $context;
     return undef if !defined($context);
     $context->set_context;
 }