[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 28 Apr 2006 18:33:11 -0000


albertel		Fri Apr 28 14:33:11 2006 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  - don't try to load data for anonmous print requests
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.352 loncom/homework/structuretags.pm:1.353
--- loncom/homework/structuretags.pm:1.352	Thu Apr 20 15:07:09 2006
+++ loncom/homework/structuretags.pm	Fri Apr 28 14:33:10 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.352 2006/04/20 19:07:09 albertel Exp $
+# $Id: structuretags.pm,v 1.353 2006/04/28 18:33:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -331,9 +331,16 @@
 }
 
 sub initialize_storage {
-    %Apache::lonhomework::results=();
-    %Apache::lonhomework::history=();
+    undef(%Apache::lonhomework::results);
+    undef(%Apache::lonhomework::history);
     my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
+    
+    # anonymous users (CODEd exams) have no data
+    if ($name eq 'anonymous' 
+	&& !defined($domain)) {
+	return;
+    }
+
     if ($env{'request.state'} eq 'construct' 
 	|| $symb eq ''
 	|| $Apache::lonhomework::type eq 'practice') {
@@ -353,6 +360,7 @@
 	%Apache::lonhomework::history=
 	    &Apache::lonnet::restore($symb,$courseid,$domain,$name);
     }
+
     #ignore error conditions
     my ($temp)=keys %Apache::lonhomework::history ;
     if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }