- Timestamp:
- 09/06/13 11:47:20 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BookmarkController.pm
r62 r63 360 360 return [304, [], []] if $self->_check_modified($bookmark->mtime); 361 361 362 # check whether the requested field is part of the bookmark 363 if (!$bookmark->meta->has_attribute($field)) { 364 return [404, ['Content-Type' => 'text/plain; charset=UTF-8'], [qq{"$field" is not a valid bookmark data field}]]; 365 } 366 362 367 # respond with just the requested field as plain text 363 my $value = eval { $bookmark->$field }; 364 if ($@) { 365 if ($@ =~ /Can't locate object method/) { 366 return [404, ['Content-Type' => 'text/plain; charset=UTF-8'], [qq{"$field" is not a valid bookmark data field}]]; 367 } else { 368 die $@; 369 } 370 } 368 my $value = $bookmark->$field; 371 369 my $last_modified = time2str($bookmark->mtime); 372 370 return [200, ['Content-Type' => 'text/plain; charset=UTF-8', 'Last-Modified' => $last_modified], [ref $value eq 'ARRAY' ? join(' ', @{ $value }) : $value]]; … … 376 374 } 377 375 378 sub create {376 sub create_and_redirect { 379 377 my $self = shift; 380 378 … … 393 391 } 394 392 395 sub edit {393 sub update_and_redirect { 396 394 my $self = shift; 397 395 my $id = shift; -
trunk/app.psgi
r61 r63 48 48 49 49 # create the bookmark and redirect to the new bookmark's edit form 50 return $controller->create ;50 return $controller->create_and_redirect; 51 51 }; 52 52 }; … … 85 85 my $controller = get_controller($req); 86 86 87 return $controller->edit($params->{id}); 88 89 return [200, ['Content-Type' => 'text/plain'], ['update ', $params->{id}]]; 87 return $controller->update_and_redirect($params->{id}); 90 88 }; 91 89 };
Note: See TracChangeset
for help on using the changeset viewer.