From: Glenn M. <Gl...@Mo...> - 2002-10-08 11:35:55
|
Hi all There appears to be a bug in config.pm or documentation, take your pick. Can't find any mention of a fix so here are my findings. Docs says.... Tags with the longest matching part of the id attribute provide the defaults for pages without the attribute in question. <PAGE> attributes written in the <PAGE> tag have the highest priority. If nothing is found the <SECTION> Tags are scanned for a default. I assume this means if we have the following <SECION id="/" require_login="recent"> <PAGE id="/somepage" browser_cache="no"> "/somepage" should still require a recent login because it does not have a "require_login" attribute. The code says.... (config.pm) 124 sub get_page_attr { 125 my ($config, $page_id, $key) = @_; 126 my $config_dir = $config->{config_dir}; 127 128 if ( exists $page_attr->{$config_dir}->{$page_id} ) { 129 return $page_attr->{$config_dir}->{$page_id}->{$key}; 130 } 131 132 # here page_id IS the section_id 133 while ( $page_id =~ s!^(.*)/+[^/]*$!$1! ) { 134 if ( exists $section_attr->{$config_dir}->{$page_id} ) { 135 return $section_attr->{$config_dir}->{$page_id}->{$key}; 136 } 137 } 138 139 # test for a global default in the section '/' or '' 140 return $section_attr->{$config_dir}->{''}->{$key}; 141 } shouldn't line 128 be checking the specific page attribute (ie. $page_attr->{$config_dir}->{$page_id}->{$key}) and not just checking whether the page has any, possibly unrelated, attributes. And the same goes for 134. That way default attributes will be read from the lower priority tag if they don't exist in higher priority tags. Or, mod the docs to correctly describe the current behaviour. I prefer a code patch. Cheers Glenn |