Skip to content

Commit

Permalink
Make attachments work, have a stab at lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Nov 17, 2009
1 parent 49b3761 commit 131582d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions lib/Canary.pm
Expand Up @@ -71,6 +71,23 @@ sub view {
$mm->respond("", $self->moniker => $thing);
}

package Canary::Attachment;
use base 'Canary::Base';

sub view {
my ($self, $mm, @args) = @_;
my $thing = $self->underlying_class->retrieve($args[0]);
if (!$thing) { return $mm->do404() }
warn "RETURNING REAL ATTACHMENT\n";
my $res =Plack::Response->new();
$res->status(200);
$res->content_type($thing->content_type);
$res->body($thing->payload);
return $res;
}

package Canary::List;
use base 'Canary::Base';
package Canary::Entity;
use base 'Canary::Base';
package Canary::NamedEntity;
Expand Down
2 changes: 1 addition & 1 deletion lib/Email/Store/Attachment.pm
Expand Up @@ -94,7 +94,7 @@ __DATA__
CREATE TABLE IF NOT EXISTS attachment (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
mail varchar(255),
payload text,
payload blob,
filename varchar(255),
content_type varchar(255)
);

0 comments on commit 131582d

Please sign in to comment.