[siesta-commit] siesta/bin nacho,1.39,1.40

[prev] [thread] [next] [lurker] [Date index for 2003/03/15]

From: clampr
Subject: [siesta-commit] siesta/bin nacho,1.39,1.40
Date: 20:16 on 15 Mar 2003
Update of /cvsroot/siesta/siesta/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv10805/bin

Modified Files:
	nacho 
Log Message:
A metric ton of changes.

* All tables now have abstract id columns, so a users email address 
  is now $user->email and a lists name is $list->name

* Storage methods take ids, not objects

* User/List methods try to be a bit less magical/vaired about 
  what they take as parameters

Since modules and tests have been changed at the same time I expect 
there to be many bugs, but those'll be squished RSN


Index: nacho
===================================================================
RCS file: /cvsroot/siesta/siesta/bin/nacho,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- nacho	15 Mar 2003 17:02:43 -0000	1.39
+++ nacho	15 Mar 2003 20:15:38 -0000	1.40
@@ -178,21 +178,21 @@
 =cut
 
 sub new_user {
-    my $user_id = shift
+    my $email = shift
       || die "You need to pass an email address as a user id\n";
     my $forename = shift || '';
     my $surname  = shift || '';
 
     my %hash = (
-                 id       => $user_id,
-                 forename => $forename,
+                email      => $email,
+                forename => $forename,
                  surname  => $surname,
-                 );
+               );
 
     my $user = Siesta::User->new_from_hash(%hash);
     $user->save || die "Errk : that failed to save";
 
-    print "User $forename $surname <$user_id> added\n";
+    print "User $forename $surname <$email> added\n";
 }
 
 =head2 show-user I<user_id>
@@ -277,7 +277,7 @@
     my $return_path = shift || die "You must supply a bounce address\n";
 
     my $list = Siesta::List->new_from_hash(
-                                            id           => $list_id,
+                                            name         => $list_id,
                                             owner        => $list_owner,
                                             post_address => $post_addr,
                                             return_path  => $return_path,
@@ -379,9 +379,9 @@
     printf "## %s mailing list\n", $list_id;
     printf "## created: %s nacho (the siesta config tool)\n",
       strftime( "%d-%b-%Y", localtime(time) );
-    printf "%s:       \"|%s%s %s\"\n",       $post, $path, 'tequila', $list->id;
-    printf "%s-sub:   \"|%s%s %s sub\"\n",   $post, $path, 'tequila', $list->id;
-    printf "%s-unsub: \"|%s%s %s unsub\"\n", $post, $path, 'tequila', $list->id;
+    printf "%s:       \"|%s%s %s\"\n",       $post, $path, 'tequila', $list->name;
+    printf "%s-sub:   \"|%s%s %s sub\"\n",   $post, $path, 'tequila', $list->name;
+    printf "%s-unsub: \"|%s%s %s unsub\"\n", $post, $path, 'tequila', $list->name;
     printf "%s-admin:  %s\n", $post, $list->owner;
     printf "%s: %s\n\n",      $ret,  $list->owner;
 
@@ -402,10 +402,10 @@
       or die "Not a valid list id\n";
 
     while ($user_id) {
-        my $user = Siesta::User->new($user_id);
+        my $user = Siesta::User->new_from_email($user_id);
 
         unless ($user) {
-            $user = Siesta::User->new_from_hash( id => $user_id )
+            $user = Siesta::User->new_from_hash( email => $user_id )
               or die "Couldn't create a new user\n";
             $user->save;
             print
@@ -413,7 +413,7 @@
         }
 
         $list->add_member($user);
-        print "User '$user_id' added to list '$list_id'\n";
+        print "User <".$user->email."> (".$user->id.") added to list '$list_id'\n";
         $user_id = shift;
     }
 }



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52