/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 241 by dpavlin, Tue Dec 6 23:49:13 2005 UTC revision 242 by dpavlin, Wed Dec 14 18:56:17 2005 UTC
# Line 204  sub search { Line 204  sub search {
204    
205                  $t = time();                  $t = time();
206    
207                  my $ds = $self->{db}->load_ds( database => $database, prefix => $prefix, id => $id ) || $log->error("can't load_ds( $database / $prefix # $id )") && next;                  my $ds = $self->{db}->load_ds( database => $database, prefix => $prefix, id => $id );
208                    if (! $ds) {
209                            $log->error("can't load_ds( ${database}/${prefix}#${id} )");
210                            next;
211                    }
212    
213                  $times->{db} += time() - $t;                  $times->{db} += time() - $t;
214    
# Line 215  sub search { Line 219  sub search {
219                  my $html = $self->{out}->apply(                  my $html = $self->{out}->apply(
220                          template => $template_filename,                          template => $template_filename,
221                          data => $ds,                          data => $ds,
222                          record_uri => "${database}/${prefix}#${id}",                          record_uri => "${database}/${prefix}/${id}",
223                  );                  );
224    
225                  $times->{out} += time() - $t;                  $times->{out} += time() - $t;
# Line 259  sub record { Line 263  sub record {
263          my $log = $self->{log};          my $log = $self->{log};
264          $log->debug("args: " . Dumper( $args ));          $log->debug("args: " . Dumper( $args ));
265    
266          foreach my $f (qw/mfn template prefix/) {          foreach my $f (qw/record_uri template/) {
267                  $log->fatal("need $f") unless ($args->{$f});                  $log->fatal("need $f") unless ($args->{$f});
268          }          }
269    
270          my $mfn = $args->{mfn};          my ($database, $prefix, $id);
271    
272          my $ds = $self->{db}->load_ds( id => $mfn, prefix => 'FIXME' ) || $log->error("can't load_ds( $mfn )") && return;          if ($args->{record_uri} =~ m#^([^/]+)/([^/]+)/([^/]+)$#) {
273                    ($database, $prefix, $id) = ($1,$2,$3);
274            } else {
275                    $log->error("can't parse $args->{record_uri} into prefix, database and uri");
276                    return;
277            }
278    
279            my $ds = $self->{db}->load_ds( id => $id, prefix => $prefix, database => $database );
280            if (! $ds) {
281                    $log->error("can't load_ds( $database/$prefix/$id )");
282                    return;
283            }
284    
285          my $html = $self->{out}->apply(          my $html = $self->{out}->apply(
286                  template => $args->{template},                  template => $args->{template},
287                  data => $ds,                  data => $ds,
288                    record_uri => $args->{record_uri},
289          );          );
290    
291          $html = $self->{iconv}->convert( $html ) || $log->error("can't convert: $html");          $html = $self->{iconv}->convert( $html ) || $log->error("can't convert: $html");

Legend:
Removed from v.241  
changed lines
  Added in v.242

  ViewVC Help
Powered by ViewVC 1.1.26