Index: trunk/lib/Vote/Controller/Admin.pm
===================================================================
--- trunk/lib/Vote/Controller/Admin.pm	(revision 197)
+++ trunk/lib/Vote/Controller/Admin.pm	(revision 198)
@@ -24,5 +24,5 @@
 sub begin : Private {
     my ( $self, $c, @args ) = @_;
-    $c->model('Vote')->db->rollback;
+    $c->model('Vote')->rollback;
 }
 
@@ -43,8 +43,8 @@
         if ($c->req->param('addch')) {
             $vote->vote_add_choice($id, $c->req->param('addch'))
-                and $vote->db->commit;
+                and $vote->commit;
         } elsif ($c->req->param('delch')) {
             $vote->delete_choice($c->req->param('delch'))
-                and $vote->db->commit;
+                and $vote->commit;
         } elsif ($c->req->param('pollparam')) {
             if ($c->req->param('dstart')) {
@@ -77,13 +77,13 @@
                 grep { exists($c->req->params->{$_}) }
                 qw(label description start end choice_count free_choice)
-            ) and $vote->db->commit;
+            ) and $vote->commit;
         } elsif ($c->req->param('encrypted')) {
             my $passphrase = $c->req->param('passphrase') ||
                 $c->session->{'vpass' . $c->stash->{voteid}};
             $poll->gen_poll_keys($passphrase)
-                and $vote->db->commit;
+                and $vote->commit;
         } elsif ($c->req->param('notcrypted')) {
             $poll->param(public_key => undef, private_key => undef)
-                and $vote->db->commit;
+                and $vote->commit;
         }
     };
@@ -95,11 +95,11 @@
                 $upload->fh,
                 $c->req->param('delete'),
-            ) and $vote->db->commit;
+            ) and $vote->commit;
         } elsif($c->req->param('delvoting')) {
             $vote->delete_voting($c->req->param('delvoting'))
-                and $vote->db->commit;
+                and $vote->commit;
         } elsif ($c->req->param('mail')) {
             $vote->addupd_voting($id, $c->req->param('mail'), $c->req->param('id'))
-                and $vote->db->commit;
+                and $vote->commit;
         } elsif($c->req->param('mailpasswd')) {
             # TODO
@@ -137,8 +137,8 @@
             } elsif($c->req->param($bid) eq 'invalid') {
                 $vote->mark_ballot_invalid($bid, 1);
-                $vote->db->commit;
+                $vote->commit;
             } elsif($c->req->param($bid) eq 'valid') {
                 $vote->mark_ballot_invalid($bid, 0);
-                $vote->db->commit;
+                $vote->commit;
             }
         }
Index: trunk/lib/Vote/Controller/Ballot.pm
===================================================================
--- trunk/lib/Vote/Controller/Ballot.pm	(revision 197)
+++ trunk/lib/Vote/Controller/Ballot.pm	(revision 198)
@@ -24,5 +24,5 @@
 sub begin : Private {
     my ( $self, $c ) = @_;
-    $c->model('Vote')->db->rollback;
+    $c->model('Vote')->rollback;
 }
 
Index: trunk/lib/Vote/Controller/Newpoll.pm
===================================================================
--- trunk/lib/Vote/Controller/Newpoll.pm	(revision 197)
+++ trunk/lib/Vote/Controller/Newpoll.pm	(revision 198)
@@ -24,6 +24,6 @@
 sub begin : Private {
     my ( $self, $c ) = @_;
-    $c->model('Vote')->db->rollback;
-    $c->model('Vote')->clean_old_poll_request and $c->model('Vote')->db->commit;
+    $c->model('Vote')->rollback;
+    $c->model('Vote')->clean_old_poll_request and $c->model('Vote')->commit;
 }
 
Index: trunk/lib/Vote/Controller/Root.pm
===================================================================
--- trunk/lib/Vote/Controller/Root.pm	(revision 197)
+++ trunk/lib/Vote/Controller/Root.pm	(revision 198)
@@ -29,5 +29,5 @@
 sub begin : Private {
     my ( $self, $c ) = @_;
-    $c->model('Vote')->db->rollback;
+    $c->model('Vote')->rollback;
 }
 
Index: trunk/lib/Vote/Controller/Vote.pm
===================================================================
--- trunk/lib/Vote/Controller/Vote.pm	(revision 197)
+++ trunk/lib/Vote/Controller/Vote.pm	(revision 198)
@@ -24,5 +24,5 @@
 sub begin : Private {
     my ( $self, $c ) = @_;
-    $c->model('Vote')->db->rollback;
+    $c->model('Vote')->rollback;
 }
 
Index: trunk/lib/Vote/DB.pm
===================================================================
--- trunk/lib/Vote/DB.pm	(revision 197)
+++ trunk/lib/Vote/DB.pm	(revision 198)
@@ -316,4 +316,17 @@
     my $rinfo = $self->poll_request_info($rid) or return;
 
+    $self->create_poll($rinfo->{mail}, $rinfo->{label}, $passwd);
+    
+    my $delreq = $self->db->prepare_cached(
+        q{delete from poll_request where id = ?}
+    );
+
+    $delreq->execute($rid);
+    $self->commit;
+}
+
+sub create_poll {
+    my ($self, $mail, $label, $passwd) = @_;
+
     my $encpasswd = $self->gen_enc_passwd($passwd);
 
@@ -328,20 +341,15 @@
     );
 
-    $newpoll->execute($newpollid, $rinfo->{label}, $rinfo->{mail}, $encpasswd);
+    $newpoll->execute($newpollid, $label, $mail, $encpasswd);
     # set some default
     $self->poll($newpollid)->setup() or do {
-        $self->db->rollback;
+        $self->rollback;
         return;
     };
 
-    my $delreq = $self->db->prepare_cached(
-        q{delete from poll_request where id = ?}
-    );
-
-    $delreq->execute($rid);
-    $self->db->commit;
 
     $newpollid
 }
+
 
 sub create_poll_request {
@@ -356,5 +364,5 @@
 
     $addreq->execute($reqid, $info{label}, $info{mail});
-    $self->db->commit;
+    $self->commit;
     $reqid;
 }
Index: trunk/lib/Vote/DB/Poll.pm
===================================================================
--- trunk/lib/Vote/DB/Poll.pm	(revision 197)
+++ trunk/lib/Vote/DB/Poll.pm	(revision 198)
@@ -60,5 +60,5 @@
         $sth->execute((map { $attr{$_} } grep { exists $attr{$_} } @online_f), $self->voteid)
             or do {
-            $self->db->rollback;
+            $self->rollback;
             return;
         };
@@ -264,5 +264,5 @@
 
     $sth->execute($self->voteid, $label) or do {
-        $self->db->rollback;
+        $self->rollback;
         return;
     };
@@ -292,5 +292,5 @@
     );
     $sth->execute($vinfo->{key}, $referal) or do {
-        $self->db->rollback;
+        $self->rollback;
         return;
     };
@@ -306,5 +306,5 @@
         : $self->_register_ballot_clear($choice, $fchoice))
         or do {
-            self->db->rollback;
+            self->rollback;
             return;
         };
@@ -323,10 +323,10 @@
     $uid ||= Vote::DB::common::gen_uid();
     $addb->execute($uid, $self->voteid, scalar(@{$fchoice || []}) ? undef : 'f') or do {
-        self->db->rollback;
+        self->rollback;
         return;
     };
 
     $self->_register_ballot_items($uid, $choice, $fchoice) or do {
-        self->db->rollback;
+        self->rollback;
         return;
     };
@@ -357,5 +357,5 @@
     foreach (@{ $choice || []}) {
         $addbc->execute($uid, $_, 't') or do {
-            $self->db->rollback;
+            $self->rollback;
             return;
         };
@@ -365,5 +365,5 @@
         my $chkey = $self->find_choice_key($_);
         $addbc->execute($uid, $_, $chkey ? 't' : 'f') or do {
-            $self->db->rollback;
+            $self->rollback;
             return;
         };
@@ -421,8 +421,8 @@
     my $upd = $self->db->prepare_cached(q{update ballot_enc set decrypted = true where id = ?});
     if ($upd->execute($ballotid)) {
-        $self->db->commit;
+        $self->commit;
         return;
     } else {
-        $self->db->rollback;
+        $self->rollback;
         return 1;
     }
@@ -451,5 +451,5 @@
     }
     # everything went fine, saving!
-    $self->db->commit;
+    $self->commit;
 
     
@@ -715,6 +715,6 @@
     );
 
-    $sth->execute($self->voteid, $from, $to) or $self->db->rollback;
-    $self->db->commit;
+    $sth->execute($self->voteid, $from, $to) or $self->rollback;
+    $self->commit;
 }
 
@@ -754,5 +754,5 @@
         my ($mail, $name) = split(';', $line);
         $mail or do {
-            $self->db->rollback;
+            $self->rollback;
             return;
         };
Index: trunk/lib/Vote/DB/Voting.pm
===================================================================
--- trunk/lib/Vote/DB/Voting.pm	(revision 197)
+++ trunk/lib/Vote/DB/Voting.pm	(revision 198)
@@ -90,5 +90,5 @@
 
     $upd_voting->execute($encpasswd, $self->votingkey);
-    $self->db->commit;
+    $self->commit;
     $passwd
 }
Index: trunk/lib/Vote/DB/common.pm
===================================================================
--- trunk/lib/Vote/DB/common.pm	(revision 197)
+++ trunk/lib/Vote/DB/common.pm	(revision 198)
@@ -98,5 +98,5 @@
         )
     );
-    $res or $self->db->rollback;
+    $res or $self->rollback;
 }
 
@@ -111,5 +111,5 @@
     );
     $sth->execute or do {
-        $self->db->rollback;
+        $self->rollback;
         return;
     };
