[Jifty-commit] r3013 - in jifty/branches/virtual-models: . debian lib lib/Jifty lib/Jifty/Manual lib/Jifty/Param lib/Jifty/Plugin lib/Jifty/Plugin/Authentication/Password lib/Jifty/Plugin/Authentication/Password/Action lib/Jifty/Plugin/Authentication/Password/Mixin lib/Jifty/Plugin/Authentication/Password/Mixin/Model lib/Jifty/Plugin/Authentication/Password/Model lib/Jifty/Plugin/LetMe lib/Jifty/Plugin/SkeletonApp lib/Jifty/Plugin/User/Mixin lib/Jifty/Plugin/User/Mixin/Model lib/Jifty/Plugin/User/Model lib/Jifty/Plugin/Yullio lib/Jifty/View lib/Jifty/View/Declare lib/Jifty/View/Static lib/Jifty/Web lib/Jifty/Web/Form plugins/AuthCASOnly plugins/AuthCASOnly/debian plugins/AuthCASOnly/lib/Jifty/Plugin plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model plugins/AuthLDAPOnly plugins/AuthLDAPOnly/debian plugins/AuthLDAPOnly/lib/Jifty/Plugin plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model plugins/AuthzLDAP/lib/Jifty/Plugin/AuthzLDAP/Model plugins/Login/debian share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs share/web/static/css t/TestApp-Plugin-PasswordAuth/etc t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Model t/TestApp-Plugin-PasswordAuth/t t/TestApp-Plugin-PasswordAuth/var t/TestApp-Plugin-PasswordAuth/var/mason t/TestApp-Plugin-REST t/TestApp-Plugin-REST/var t/TestApp/lib/TestApp t/TestApp/lib/TestApp/Model t/TestApp/share/web/templates/path_test t/TestApp/share/web/templates/path_test/foo t/TestApp/t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Mar 17 15:23:05 EDT 2007


Author: sterling
Date: Sat Mar 17 15:23:02 2007
New Revision: 3013

Added:
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ConfirmEmail.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Logout.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ResendConfirmation.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ResetLostPassword.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/SendAccountConfirmation.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/SendPasswordReminder.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Signup.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/
      - copied from r2925, /jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Model/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmEmail.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmLostPassword.pm   (contents, props changed)
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe/
   jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/User/Mixin/
   jifty/branches/virtual-models/lib/Jifty/Plugin/User/Mixin/Model/
      - copied from r2925, /jifty/branches/virtual-models/lib/Jifty/Plugin/User/Model/
   jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/User.pm
      - copied, changed from r2852, /jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/CASUser.pm
   jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/User.pm
      - copied, changed from r2852, /jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Bootstrap.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Dispatcher.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
   jifty/branches/virtual-models/t/TestApp-Plugin-REST/var/   (props changed)
   jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/
   jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/foo/
   jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/foo/index.html   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/in_both
   jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/mason_only
   jifty/branches/virtual-models/t/TestApp/t/14-template-paths.t   (contents, props changed)
Removed:
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Model/
   jifty/branches/virtual-models/lib/Jifty/Plugin/User/Model/
   jifty/branches/virtual-models/plugins/AuthCASOnly/MANIFEST.bak
   jifty/branches/virtual-models/plugins/AuthCASOnly/META.yml
   jifty/branches/virtual-models/plugins/AuthCASOnly/Makefile
   jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/CASUser.pm
   jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/var/mason/
Modified:
   jifty/branches/virtual-models/   (props changed)
   jifty/branches/virtual-models/MANIFEST
   jifty/branches/virtual-models/META.yml
   jifty/branches/virtual-models/Makefile.PL
   jifty/branches/virtual-models/debian/changelog
   jifty/branches/virtual-models/debian/control
   jifty/branches/virtual-models/lib/Jifty.pm
   jifty/branches/virtual-models/lib/Jifty/Bootstrap.pm
   jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm
   jifty/branches/virtual-models/lib/Jifty/Config.pm
   jifty/branches/virtual-models/lib/Jifty/CurrentUser.pm
   jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Handler.pm
   jifty/branches/virtual-models/lib/Jifty/I18N.pm
   jifty/branches/virtual-models/lib/Jifty/LetMe.pm
   jifty/branches/virtual-models/lib/Jifty/Logger.pm
   jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod
   jifty/branches/virtual-models/lib/Jifty/Notification.pm
   jifty/branches/virtual-models/lib/Jifty/Param/Schema.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/OnlineDocs.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/User/Mixin/Model/User.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Yullio/View.pm
   jifty/branches/virtual-models/lib/Jifty/Util.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/BaseClass.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/CoreTemplates.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm
   jifty/branches/virtual-models/lib/Jifty/View/Static/Handler.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm
   jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm
   jifty/branches/virtual-models/plugins/AuthCASOnly/MANIFEST
   jifty/branches/virtual-models/plugins/AuthCASOnly/debian/changelog
   jifty/branches/virtual-models/plugins/AuthCASOnly/debian/files
   jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly.pm
   jifty/branches/virtual-models/plugins/AuthLDAPOnly/MANIFEST
   jifty/branches/virtual-models/plugins/AuthLDAPOnly/debian/changelog
   jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm
   jifty/branches/virtual-models/plugins/AuthzLDAP/lib/Jifty/Plugin/AuthzLDAP/Model/LDAPFilter.pm
   jifty/branches/virtual-models/plugins/Login/debian/changelog
   jifty/branches/virtual-models/plugins/Login/debian/rules
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/autohandler
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/content.html
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/toc.html
   jifty/branches/virtual-models/share/web/static/css/base.css
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/etc/config.yml
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Model/User.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/   (props changed)
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/var/   (props changed)
   jifty/branches/virtual-models/t/TestApp-Plugin-REST/   (props changed)
   jifty/branches/virtual-models/t/TestApp/lib/TestApp/Model/User.pm
   jifty/branches/virtual-models/t/TestApp/lib/TestApp/View.pm

Log:
Merged latest trunk into V-M branch; no new test failures.

Modified: jifty/branches/virtual-models/MANIFEST
==============================================================================
--- jifty/branches/virtual-models/MANIFEST	(original)
+++ jifty/branches/virtual-models/MANIFEST	Sat Mar 17 15:23:02 2007
@@ -38,11 +38,9 @@
 etc/config.yml
 etc/site_config.yml
 examples/Chat/bin/jifty
-examples/Chat/chat
 examples/Chat/etc/config.yml
 examples/Chat/lib/Chat/Action/Send.pm
 examples/Chat/lib/Chat/Event/Message.pm
-examples/Chat/lib/Chat/Server.pm
 examples/Chat/Makefile.PL
 examples/Chat/share/web/templates/fragments/message
 examples/Chat/share/web/templates/fragments/sender
@@ -53,7 +51,6 @@
 examples/Clock/clockserv.pl
 examples/Clock/etc/config.yml
 examples/Clock/lib/Clock/Event/Tick.pm
-examples/Clock/lib/Clock/Server.pm
 examples/Clock/Makefile.PL
 examples/Clock/share/web/templates/fragments/time
 examples/Clock/share/web/templates/index.html
@@ -77,7 +74,6 @@
 examples/Ping/lib/Ping/Action/CancelPing.pm
 examples/Ping/lib/Ping/Event/Pong.pm
 examples/Ping/lib/Ping/PingServer.pm
-examples/Ping/lib/Ping/Server.pm
 examples/Ping/Makefile.PL
 examples/Ping/share/web/templates/fragments/pong
 examples/Ping/share/web/templates/index.html
@@ -163,10 +159,15 @@
 lib/Jifty/Plugin/ClassLoader.pm
 lib/Jifty/Plugin/CompressedCSSandJS.pm
 lib/Jifty/Plugin/CompressedCSSandJS/Dispatcher.pm
+lib/Jifty/Plugin/ErrorTemplates.pm
+lib/Jifty/Plugin/ErrorTemplates/View.pm
 lib/Jifty/Plugin/Halo.pm
 lib/Jifty/Plugin/OnlineDocs.pm
 lib/Jifty/Plugin/REST.pm
 lib/Jifty/Plugin/REST/Dispatcher.pm
+lib/Jifty/Plugin/SkeletonApp.pm
+lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
+lib/Jifty/Plugin/SkeletonApp/View.pm
 lib/Jifty/Plugin/User.pm
 lib/Jifty/Plugin/User/Model/User.pm
 lib/Jifty/Plugin/Yullio/View.pm
@@ -185,11 +186,13 @@
 lib/Jifty/Script/FastCGI.pm
 lib/Jifty/Script/Help.pm
 lib/Jifty/Script/Model.pm
+lib/Jifty/Script/ModPerl2.pm
 lib/Jifty/Script/Plugin.pm
 lib/Jifty/Script/Po.pm
 lib/Jifty/Script/Schema.pm
 lib/Jifty/Script/Server.pm
 lib/Jifty/Server.pm
+lib/Jifty/Server/Fork.pm
 lib/Jifty/Subs.pm
 lib/Jifty/Subs/Render.pm
 lib/Jifty/Test.pm
@@ -201,12 +204,8 @@
 lib/Jifty/View/Declare.pm
 lib/Jifty/View/Declare/BaseClass.pm
 lib/Jifty/View/Declare/CoreTemplates.pm
-lib/Jifty/View/Declare/ErrorHandlers.pm
 lib/Jifty/View/Declare/Handler.pm
 lib/Jifty/View/Declare/Helpers.pm
-lib/Jifty/View/Declare/Helpers.pm.tdy
-lib/Jifty/View/Declare/SkeletonApp.pm
-lib/Jifty/View/Declare/WebServices.pm
 lib/Jifty/View/Mason/Handler.pm
 lib/Jifty/View/Static/Handler.pm
 lib/Jifty/Web.pm
@@ -238,7 +237,6 @@
 MANIFEST			This list of files
 MANIFEST.SKIP
 META.yml
-my-diff-of-td-branch
 plugins/AuthCASLogin/debian/changelog
 plugins/AuthCASLogin/debian/compat
 plugins/AuthCASLogin/debian/control
@@ -268,7 +266,6 @@
 plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/CASUser.pm
 plugins/AuthCASOnly/Makefile.PL
 plugins/AuthCASOnly/MANIFEST
-plugins/AuthCASOnly/META.yml
 plugins/AuthCASOnly/share/web/templates/caslogin
 plugins/AuthCASOnly/share/web/templates/caslogout
 plugins/AuthCASOnly/t/00-load.t
@@ -395,16 +392,6 @@
 plugins/ProfileBehaviour/Makefile.PL
 plugins/ProfileBehaviour/share/web/static/css/behaviour-profile.css
 plugins/ProfileBehaviour/share/web/static/js/behaviour.js
-plugins/Users-Identity-File/lib/Jifty/Plugin/Users/Identity/File.pm
-plugins/Users-Identity-File/lib/Jifty/Plugin/Users/Identity/File/Action/Login.pm
-plugins/Users-Identity-File/lib/Jifty/Plugin/Users/Identity/File/Dispatcher.pm
-plugins/Users-Identity-File/Makefile.PL
-plugins/Users-Identity-File/share/web/templates/login
-plugins/Users/lib/Jifty/Plugin/Users.pm
-plugins/Users/lib/Jifty/Plugin/Users/CurrentUser.pm
-plugins/Users/lib/Jifty/Plugin/Users/Dispatcher.pm
-plugins/Users/lib/Jifty/Plugin/Users/Model/User.pm
-plugins/Users/Makefile.PL
 README
 share/dtd/xhtml-lat1.ent
 share/dtd/xhtml-special.ent

Modified: jifty/branches/virtual-models/META.yml
==============================================================================
--- jifty/branches/virtual-models/META.yml	(original)
+++ jifty/branches/virtual-models/META.yml	Sat Mar 17 15:23:02 2007
@@ -15,12 +15,14 @@
     - DB
     - inc
 recommends: 
+  Apache2::Const: 0
   Class::Accessor::Named: 0
   DBD::SQLite: 0
   Devel::Cover: 0
   Module::CoreList: 0
   Module::Install::Admin: 0.50
   Module::Refresh: 0.09
+  Net::Server::Fork: 0
   PAR::Dist::FromCPAN: 0
   Test::Base: 0.44
   Test::HTML::Lint: 0
@@ -71,16 +73,17 @@
   HTTP::Server::Simple::Recorder: 0
   Hash::Merge: 0
   Hook::LexWrap: 0
-  IPC::PubSub: 0.22
+  IPC::PubSub: 0.23
   JSON::Syck: 0.15
   Jifty::DBI: 0.31
   LWP::UserAgent: 0
   Locale::Maketext::Extract: 0.20
   Locale::Maketext::Lexicon: 0.60
-  Log::Log4perl: 0
+  Log::Log4perl: 1.04
   MIME::Types: 0
   Module::CoreList: 0
   Module::Pluggable: 3.1
+  Module::Pluggable::Object: 0
   Module::Refresh: 0
   Module::ScanDeps: 0
   Object::Declare: 0.13
@@ -90,12 +93,14 @@
   Scalar::Defer: 0.06
   Shell::Command: 0
   String::Koremutake: 0
+  Template::Declare: 0.06
   Test::Base: 0
   UNIVERSAL::require: 0
   URI: 0
   XML::Simple: 0
   XML::Writer: 0.601
   XML::XPath: 0
+  YAML: 0.35
   YAML::Syck: 0.71
   perl: 5.8.3
   version: 0

Modified: jifty/branches/virtual-models/Makefile.PL
==============================================================================
--- jifty/branches/virtual-models/Makefile.PL	(original)
+++ jifty/branches/virtual-models/Makefile.PL	Sat Mar 17 15:23:02 2007
@@ -55,7 +55,7 @@
 requires('Module::ScanDeps');
 requires('Object::Declare' => '0.13');
 requires('Params::Validate');
-requires('Scalar::Defer' => '0.06');
+requires('Scalar::Defer' => '0.10');
 requires('Shell::Command');
 requires('String::Koremutake');
 requires('SQL::ReservedWords');
@@ -63,6 +63,7 @@
 requires('SVN::Repos');
 requires('SVN::Simple::Edit');
 requires('Template::Declare');                # Template::Declare::Tags
+requires('Template::Declare' => '0.06');                # Template::Declare::Tags
 requires('Test::Base');
 requires('UNIVERSAL::require');
 requires('URI');

Modified: jifty/branches/virtual-models/debian/changelog
==============================================================================
--- jifty/branches/virtual-models/debian/changelog	(original)
+++ jifty/branches/virtual-models/debian/changelog	Sat Mar 17 15:23:02 2007
@@ -1,3 +1,11 @@
+ -- AGOSTINI Yves <agostini at univ-metz.fr>  Fri, 16 Mar 2007 18:22:23 +0100
+
+jifty (0.70317-1) unstable; urgency=low
+
+  * merge with T::D branche
+
+ -- AGOSTINI Yves <agostini at univ-metz.fr>  Fri,  9 Mar 2007 15:36:49 +0100
+
 jifty (0.70117-1) unstable; urgency=low
 
   * New cpan release

Modified: jifty/branches/virtual-models/debian/control
==============================================================================
--- jifty/branches/virtual-models/debian/control	(original)
+++ jifty/branches/virtual-models/debian/control	Sat Mar 17 15:23:02 2007
@@ -64,13 +64,14 @@
  libhtml-lint-perl, libhtml-mason-perl (>> 1.31), 
  libwww-perl, libhttp-server-simple-perl (>> 0.26), 
  libhttp-server-simple-recorder-perl, libhash-merge-perl, libhook-lexwrap-perl,
- libipc-pubsub-perl (>> 0.22), libjifty-dbi-perl (>> 0.31),
+ libipc-pubsub-perl (>> 0.23), libjifty-dbi-perl (>> 0.31),
  liblocale-maketext-lexicon-perl, liblog-log4perl-perl,
  libmime-types-perl, libmodule-pluggable-perl (>> 3.1),
  libmodule-corelist-perl, libmodule-refresh-perl,
- libmodule-scandeps-perl, libobject-declare-perl (>> 0.13),
- libparams-validate-perl, libscalar-defer-perl (>> 0.06),
+ libmodule-scandeps-perl, libobject-declare-perl (>> 0.22),
+ libparams-validate-perl, libscalar-defer-perl (>> 0.10),
  libstring-koremutake-perl, libsql-reservedwords-perl,
+ libtemplate-declare-perl (>> 0.06), 
  libtest-base-perl, libuniversal-require-perl, liburi-perl,
  libxml-writer-perl (>> 0.601), libxml-simple-perl,
  libxml-xpath-perl, libversion-perl, libyaml-syck-perl (>> 0.72), 

Modified: jifty/branches/virtual-models/lib/Jifty.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty.pm	Sat Mar 17 15:23:02 2007
@@ -280,11 +280,15 @@
 Return Class in application space.  For example C<app_class('Model', 'Foo')>
 returns YourApp::Model::Foo.
 
+By the time you get it back, the class will have already been required
+
 =cut
 
 sub app_class {
     shift;
-    join('::', Jifty->config->framework('ApplicationClass'), @_);
+    my $val = join('::', Jifty->config->framework('ApplicationClass'), @_);
+    Jifty::Util->try_to_require($val);
+    return $val;
 }
 
 =head2 web

Modified: jifty/branches/virtual-models/lib/Jifty/Bootstrap.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Bootstrap.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Bootstrap.pm	Sat Mar 17 15:23:02 2007
@@ -11,6 +11,19 @@
 bootstrapping.  Use it to set up initial data in your database when
 your application is first installed.
 
+=head1 EXAMPLE
+
+ 
+ package MyApp::Bootstrap;
+ use base 'Jifty::Bootstrap';
+ 
+ sub run {
+     my $user = MyApp::CurrentUser->new( _bootstrap => 1);
+     my $modelclass = MyApp::Model::Thingy->new(current_user => $user);
+     $modelclass->create( name => 'Widget');
+ }; 
+ 
+ 
 =cut
 
 package Jifty::Bootstrap;

Modified: jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm	Sat Mar 17 15:23:02 2007
@@ -116,66 +116,91 @@
     $module =~ s/.pm$//;
     $module =~ s{/}{::}g;
 
-    # The quick check
-    return undef unless $module =~ m!^$base!;
+    # The quick check. We only want to handle things for our app
+    return undef unless $module =~ /^$base/;
 
-    if ( $module =~ m!^(?:$base)$! ) {
-        return $self->return_class(
-            "use warnings; use strict; package " . $base . ";\n" . " 1;" );
+    if ( $module =~ /^(?:$base)$/ ) {
+        return $self->return_class( "package " . $base . ";\n");
     }
-#    elsif ( $module =~ m!^(?:$base)::Action$! ) {
-#        return $self->return_class(
-#                  "use warnings; use strict; package $module;\n"
-#                . "use base qw/Jifty::Action/; sub _autogenerated { 1 };\n"
-#                . "1;" );
-#    }
-    elsif ( $module =~ m!^(?:$base)::(Record|Collection|Notification|Dispatcher|Bootstrap|Upgrade|Handle|Event|Event::Model|Action::Record::\w+)$! ) {
+    elsif ( $module =~ /^(?:$base)::(Record|Collection|Notification|
+                                      Dispatcher|Bootstrap|Upgrade|
+                                      Handle|Event|Event::Model|Action|
+                                      Action::Record::\w+)$/x ) {
         return $self->return_class(
-                  "use warnings; use strict; package $module;\n"
+                  "package $module;\n"
                 . "use base qw/Jifty::$1/; sub _autogenerated { 1 };\n"
-                . "1;" );
-    } elsif ( $module =~ m!^(?:$base)::View$! ) {
+            );
+    } elsif ( $module =~ /^(?:$base)::View/ ) {
         return $self->return_class(
-                  "use warnings; use strict; package $module;\n"
-                . "use base qw/Jifty::View::Declare::Helpers/; sub _autogenerated { 1 };\n"
-                . "1;" );
-    } elsif ( $module =~ m!^(?:$base)::CurrentUser$! ) {
+                  "package $module;\n"
+                . "use Jifty::View::Declare -base; sub _autogenerated { 1 };\n"
+            );
+    } elsif ( $module =~ /^(?:$base)::CurrentUser$/ ) {
         return $self->return_class(
-                  "use warnings; use strict; package $module;\n"
+                  "package $module;\n"
                 . "use base qw/Jifty::CurrentUser/; sub _autogenerated { 1 };\n"
-                . "1;" );
-    } elsif ( $module =~ m!^(?:$base)::Model::(\w+)Collection$! ) {
+            );
+    } elsif ( $module =~ /^(?:$base)::Model::(\w+)Collection$/ ) {
         return $self->return_class(
-                  "use warnings; use strict; package $module;\n"
+                  "package $module;\n"
                 . "use base qw/@{[$base]}::Collection/;\n"
                 . "sub record_class { '@{[$base]}::Model::$1' }\n"
-                . "1;" );
-    } elsif ( $module =~ m!^(?:$base)::Event::Model::([^\.]+)$! ) {
+            );
+    } elsif ( $module =~ /^(?:$base)::Event::Model::([^\.]+)$/ ) {
         my $modelclass = $base . "::Model::" . $1;
         Jifty::Util->require($modelclass);
 
         return undef unless eval { $modelclass->table };
 
         return $self->return_class(
-                  "use warnings; use strict; package $module;\n"
+                  "package $module;\n"
                 . "use base qw/${base}::Event::Model/;\n"
                 . "sub record_class { '$modelclass' };\n"
                 . "sub autogenerated { 1 };\n"
-                . "1;" );
-    } elsif ( $module =~ m!^(?:$base)::Action::(Create|Update|Delete|Search)([^\.]+)$! ) {
+            );
+    } elsif ( $module =~ /^(?:$base)::Action::
+                        (Create|Update|Delete|Search)([^\.]+)$/x ) {
         my $modelclass = $base . "::Model::" . $2;
 
         Jifty::Util->require($modelclass);
 
-        return undef unless eval { $modelclass->table };
+        local $@;
+            eval { $modelclass->table } ;
+        if(!$@) {
 
         return $self->return_class(
-                  "use warnings; use strict; package $module;\n"
+                  "package $module;\n"
                 . "use base qw/$base\::Action::Record::$1/;\n"
                 . "sub record_class { '$modelclass' };\n"
                 . "sub autogenerated { 1 };\n"
-                . "1;" );
+            );
+        }
+
+    }
+
+    # This is if, not elsif because we might have $base::Action::Deleteblah 
+    # that matches that last elsif clause but loses on the eval.
+    if ( $module =~ /^(?:$base)::(Action|Notification)::(.*)$/x and not grep {$_ eq $base} map {ref} Jifty->plugins ) {
+        my $type = $1; 
+        my $item = $2;
+        # If we don't have the action in our own app, let's try the plugins
+        # the app has loaded.
+        foreach my $plugin (map {ref} Jifty->plugins) {
+            next if ($plugin eq $base);
+            my $class = $plugin."::".$type."::".$item;
+            if (Jifty::Util->try_to_require($class) ) {
+        return $self->return_class(
+                  "package $module;\n"
+                . "use base qw/$class/;\n"
+                . "sub autogenerated { 1 };\n"
+            );
+
+
+            }
+        }
+
     }
+    # Didn't find a match
     return undef;
 }
 
@@ -190,6 +215,7 @@
     my $self = shift;
     my $content = shift;
 
+    $content = "use warnings; use strict; ". $content  . "\n1;";
 
     open my $fh, '<', \$content;
     return $fh;

Modified: jifty/branches/virtual-models/lib/Jifty/Config.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Config.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Config.pm	Sat Mar 17 15:23:02 2007
@@ -264,15 +264,16 @@
             L10N       => {
                 PoDir => "share/po",
             },
-            Plugins    => [
-            { REST => {},
-        },
-        {       Halo => {},},
-        {ErrorTemplates => {},},
-        {OnlineDocs => {},},
-        {        CompressedCSSandJS => {},},
-        {AdminUI => {},}
-            ],
+            Plugins => [
+            #  { LetMe               => {}, },
+                { SkeletonApp            => {}, },
+                { REST               => {}, },
+                { Halo               => {}, },
+                { ErrorTemplates     => {}, },
+                { OnlineDocs         => {}, },
+                { CompressedCSSandJS => {}, },
+                { AdminUI            => {}, }
+                ],
             Web        => {
                 Port => '8888',
                 BaseURL => 'http://localhost',

Modified: jifty/branches/virtual-models/lib/Jifty/CurrentUser.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/CurrentUser.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/CurrentUser.pm	Sat Mar 17 15:23:02 2007
@@ -48,7 +48,19 @@
     return $self;
 }
 
-sub _init { 1}
+
+sub _init {
+	    my $self = shift;
+	    my %args = (@_);
+	
+            if (keys %args and UNIVERSAL::can(Jifty->app_class('Model', 'User'), 'new')  ) {
+                
+	        $self->user_object(Jifty->app_class('Model', 'User')->new(current_user => $self));
+	        $self->user_object->load_by_cols(%args);
+	    }
+        return 1;
+}
+	
 
 =head2 superuser
 
@@ -70,7 +82,7 @@
 user. Generally, you're expected to set and load it in the _init method
 in your L<Jifty::CurrentUser> subclass.
 
-Example:  
+If you do nothing, code similar to this will be called by _init.
 
 	sub _init {
 	    my $self = shift;
@@ -80,7 +92,6 @@
 	        $self->user_object(Wifty::Model::User->new(current_user => $self));
 	        $self->user_object->load_by_cols(%args);
 	    }
-	    $self->SUPER::_init(%args);
 	}
 	
 

Modified: jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm	Sat Mar 17 15:23:02 2007
@@ -766,8 +766,10 @@
     # a relative path, prepend the working directory
     $path = "$self->{cwd}/$path" unless $path =~ m{^/};
 
-    # When we're requesting a directory, go looking for the index.html
-    if ( $self->template_exists( $path . "/index.html" ) ) {
+    # When we're requesting a directory, go looking for the index.html if the 
+    # path given does not exist
+    if (  ! $self->template_exists( $path )
+         && $self->template_exists( $path . "/index.html" ) ) {
         $path .= "/index.html";
     }
 
@@ -923,7 +925,7 @@
 
 sub _match_method {
     my ( $self, $method ) = @_;
-    $self->log->debug("Matching URL $ENV{REQUEST_METHOD} against ".$method);
+    #$self->log->debug("Matching URL $ENV{REQUEST_METHOD} against ".$method);
     lc( $ENV{REQUEST_METHOD} ) eq lc($method);
 }
 
@@ -1115,7 +1117,8 @@
 
 =head2 template_exists PATH
 
-Returns true if PATH is a valid template inside your template root.
+Returns true if PATH is a valid template inside your template root. This checks
+for both Template::Declare and HTML::Mason Templates.
 
 =cut
 
@@ -1123,13 +1126,16 @@
     my $self = shift;
     my $template = shift;
 
-    return  Jifty->handler->mason->interp->comp_exists( $template);
+    return Jifty->handler->declare_handler->template_exists($template)
+        || Jifty->handler->mason->interp->comp_exists( $template);
 }
 
 
 =head2 render_template PATH
 
-Use our templating system to render a template. If there's an error, do the right thing.
+Use our templating system to render a template. If there's an error, do the
+right thing. If the same 'PATH' is found in both Template::Declare and
+HTML::Mason templates then the T::D template is used.
 
 
 =cut
@@ -1267,12 +1273,11 @@
     no strict 'refs';
     foreach my $stage ( qw/SETUP RUN CLEANUP/ ) {
 
-        my $log = '';
+        Jifty->log->debug( "Dispatcher rules in stage $stage:");
         foreach my $r ( @{ $self . '::RULES_' . $stage } ) {
-            $log .= _unroll_dumpable_rules( 0,$r );
+            Jifty->log->debug( _unroll_dumpable_rules( 0,$r ) );
         }
 
-        Jifty->log->debug( "Rules in stage $stage:\n", $log) if ($log);
     }
 };
 
@@ -1285,7 +1290,7 @@
 
 sub _unroll_dumpable_rules {
     my ($level, $rule) = @_;
-    my $log =
+    my $log = 
         # indentation
         ( "    " x $level ) .
         # op
@@ -1297,16 +1302,14 @@
             ref $rule->[1] eq 'HASH'  ? $rule->[1]->{method} . " '" . $rule->[1]->{""} ."'" :
             ref $rule->[1] eq 'CODE'  ? '{...}' :
                                         "'" . $rule->[1] . "'"
-        ) .
-        "\n";
+        );
 
     if (ref $rule->[2] eq 'ARRAY') {
         $level++;
         foreach my $sr ( @{ $rule->[2] } ) {
-            $log .= _unroll_dumpable_rules( $level, $sr );
+            $log .=   _unroll_dumpable_rules( $level, $sr );
         }
     }
-
     return $log;
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Handler.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Handler.pm	Sat Mar 17 15:23:02 2007
@@ -66,6 +66,7 @@
     $self->dispatcher( Jifty->app_class( "Dispatcher" ) );
     Jifty::Util->require( $self->dispatcher );
     $self->dispatcher->import_plugins;
+    $self->dispatcher->dump_rules;
  
     $self->setup_view_handlers();
     return $self;
@@ -138,9 +139,9 @@
     for my $plugin (Jifty->plugins) {
         my $comp_root = $plugin->template_root;
         unless  ( $comp_root and -d $comp_root) {
-            Jifty->log->debug( "Plugin @{[ref($plugin)]} doesn't appear to have a valid mason template component root (@{[$comp_root ||'']})");
             next;
         }
+        Jifty->log->debug( "Plugin @{[ref($plugin)]} mason component root added: (@{[$comp_root ||'']})");
         push @{ $config{comp_root} }, [ ref($plugin)."-".Jifty->web->serial => $comp_root ];
     }
     push @{$config{comp_root}}, [jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}];
@@ -164,9 +165,7 @@
 
 sub templatedeclare_config {
     
-    use Jifty::View::Declare::CoreTemplates;
     my %config = (
-        roots => [ 'Jifty::View::Declare::CoreTemplates' ],
         %{ Jifty->config->framework('Web')->{'TemplateDeclareConfig'} ||{}},
     );
 
@@ -174,14 +173,14 @@
         my $comp_root = $plugin->template_class;
         Jifty::Util->require($comp_root);
         unless (defined $comp_root and $comp_root->isa('Template::Declare') ){
-            Jifty->log->debug( "Plugin @{[ref($plugin)]} doesn't appear to have a ::View class that's a Template::Declare subclass");
             next;
         }
+        Jifty->log->debug( "Plugin @{[ref($plugin)]}::View added as a Template::Declare root");
         push @{ $config{roots} }, $comp_root ;
     }
 
-    push @{$config{roots}}, Jifty->config->framework('TemplateClass');
-
+    push @{$config{roots}},  Jifty->config->framework('TemplateClass');
+        
     return %config;
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/I18N.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/I18N.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/I18N.pm	Sat Mar 17 15:23:02 2007
@@ -12,13 +12,24 @@
 
 Jifty::I18N - Internationalization framework for Jifty
 
+=head1 SYNOPSIS
+
+  # Whenever you need an internationalized string:
+  print _('Hello, %1!', 'World');
+
+In your Mason templates:
+
+  <% _('Hello, %1!', 'World') %>
+
 =head1 METHODS
 
 =head2 C<_>
 
-This module exports the C<loc> method, which it inherits from
-L<Locale::Maketext::Simple>. Jifty aliases this method to C<_()> for 
-your convenience.
+This module provides a method named C<_>, which allows you to quickly and easily include localized strings in your application. The first argument is the string to translated. If that string contains placeholders, the remaining arguments are used to replace the placeholders. The placeholders in the form of "%1" where the number is the number of the argument used to replace it:
+
+  _('Welcome %1 to the %2', 'Bob', 'World');
+
+This example would return the string "Welcome Bob to the World" if no translation is being performed.
 
 =cut
 
@@ -69,7 +80,7 @@
 
     my $loc_method = sub {
         # Retain compatibility with people using "-e _" etc.
-        return \*_ unless @_;
+        return \*_ unless @_; # Needed for perl 5.8
 
         # When $_[0] is undef, return undef.  When it is '', return ''.
         no warnings 'uninitialized';

Modified: jifty/branches/virtual-models/lib/Jifty/LetMe.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/LetMe.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/LetMe.pm	Sat Mar 17 15:23:02 2007
@@ -65,7 +65,8 @@
 sub validated_current_user {
     my $self = shift;
     return undef unless ( $self->validate );
-    return $self->_user_from_email($self->email);
+    my $currentuser = Jifty->app_class("CurrentUser");
+    return Jifty->app_class('CurrentUser')->new( email => $self->email );
 
 }
 
@@ -81,7 +82,10 @@
     my $self = shift;
     my $email = shift;
     my $currentuser_object_class = Jifty->app_class("CurrentUser");
-    return $currentuser_object_class->new( email => $email );
+    my $u = $currentuser_object_class->new( email => $email )->user_object;
+    # we want to be able to get at their auth token.
+    $u->current_user(Jifty->app_class('CurrentUser')->superuser);
+    return $u;
 }
 
 sub _generate_digest {
@@ -217,14 +221,13 @@
 sub _generate_token {
     my $self = shift;
     my %args = (email => undef, @_);
-    return join ('/', 
+    return  join ('/', 
         $args{'email'},
         $self->path,
         (map {URI::Escape::uri_escape_utf8($_)} %{$self->args}),
         (defined $self->until ? ( 'until', $self->until ) : () ), #?
         $self->generate_checksum  
         );
-
 }
 
 

Modified: jifty/branches/virtual-models/lib/Jifty/Logger.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Logger.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Logger.pm	Sat Mar 17 15:23:02 2007
@@ -186,18 +186,19 @@
     my %pg_notices = ('DEBUG\d+' => 'debug',
                       'INFO'     => 'info',
                       'NOTICE'   => 'info',
+                      '.*ERROR.*database .* does not exist' => 'info',
+                      '.*couldn.t execute the query .DROP DATABASE.' => 'info',
                       'WARNING'  => 'warn',
                       'DBD::Pg.+ERROR'    => 'error',
                       'LOG'      => 'warn',
                       'FATAL'    => 'fatal',
                       'PANIC'    => 'fatal' );
-
+    
     foreach my $notice (keys %pg_notices) {
-        if ($warnings =~ /^$notice:/) {
+        if ($warnings =~ /^$notice/) {
             return $pg_notices{$notice};
-        }
+        } 
     }
-
     return 'warn';
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod	Sat Mar 17 15:23:02 2007
@@ -91,7 +91,8 @@
 
 And add this in F<MyApp/Dispatcher.pm> to make URI look prettier:
 
-    on qr{^/feed/(atom|rss|rss2)}, run {
+    # note the case of the feed types
+    on qr{^/feed/(Atom|RSS)}, run {
         set type => $1;
         show('/feed');
     };

Modified: jifty/branches/virtual-models/lib/Jifty/Notification.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Notification.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Notification.pm	Sat Mar 17 15:23:02 2007
@@ -84,12 +84,16 @@
     my @recipients = $self->recipients;
     my $to         = join( ', ',
         map { ( $_->can('email') ? $_->email : $_ ) } grep {$_} @recipients );
+    $self->log->debug("Sending a ".ref($self)." to $to"); 
     return unless ($to);
+
+    my $appname = Jifty->config->framework('ApplicationName');
+
     my $message = Email::MIME->create(
         header => [
-            From    => $self->from    || 'A Jifty Application <nobody>',
+            From    => ($self->from    || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'))) ,
             To      => $to,
-            Subject => Encode::encode('MIME-Header', $self->subject || 'No subject'),
+            Subject => Encode::encode('MIME-Header', $self->subject || _("A notification from %1!",$appname )),
         ],
         attributes => { charset => 'UTF-8' },
         parts => $self->parts

Modified: jifty/branches/virtual-models/lib/Jifty/Param/Schema.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Param/Schema.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Param/Schema.pm	Sat Mar 17 15:23:02 2007
@@ -33,7 +33,12 @@
 This module provides a simple syntax to declare action parameters.
 
 It re-exports C<defer> and C<lazy> from L<Scalar::Defer>, for setting
-parameter fields that must be recomputed at request-time.
+parameter fields that must be recomputed at request-time:
+
+    param name =>
+        default is defer { Jifty->web->current_user->name };
+
+See L<Scalar::Defer> for more information about C<defer>.
 
 =head2 schema
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin.pm	Sat Mar 17 15:23:02 2007
@@ -2,6 +2,8 @@
 use warnings;
 
 package Jifty::Plugin;
+use File::ShareDir 'module_dir';
+
 
 =head1 NAME
 
@@ -54,10 +56,6 @@
     Jifty::ClassLoader->new(base => $class)->require;
     Jifty::Util->require($class->dispatcher);
 
-    # Start a plugin classloader set up on behalf of the application
-    Jifty::Util->require('Jifty::Plugin::ClassLoader');
-    Jifty::Plugin::ClassLoader->new( base => Jifty->app_class, plugin => $class,)->require;
-
     # XXX TODO: Add .po path
 
     my $self = bless {} => $class;
@@ -93,20 +91,22 @@
 
 sub _calculate_share {
     my $self = shift;
-    my $class = ref($self) || $self;
+    my $class = ref($self);
     unless ( $self->{share} ) {
-        local $@; # We're just avoiding File::ShareDir's failure behaviour of dying
-        eval { $self->{share} = File::ShareDir::module_dir($class) };
+        local $@
+            ; # We're just avoiding File::ShareDir's failure behaviour of dying
+        eval { $self->{share} = module_dir($class) };
     }
     unless ( $self->{share} ) {
-        local $@ ; # We're just avoiding File::ShareDir's failure behaviour of dying
-        eval { $self->{share} = File::ShareDir::module_dir('Jifty') };
+        local $@; # We're just avoiding File::ShareDir's failure behaviour of dying
+        eval { $self->{share} = module_dir('Jifty') };
         if ( $self->{'share'} ) {
             my $class_to_path = $class;
             $class_to_path =~ s|::|/|g;
             $self->{share} .= "/plugins/" . $class_to_path;
         }
     }
+    return $self->{share};
 }
 
 
@@ -118,9 +118,9 @@
 
 sub template_root {
     my $self = shift;
-    $self->{share} ||= $self->_calculate_share();
-    return unless $self->{share};
-    return $self->{share}."/web/templates";
+    my $dir =  $self->_calculate_share();
+    return unless $dir;
+    return $dir."/web/templates";
 }
 
 
@@ -145,9 +145,9 @@
 
 sub static_root {
     my $self = shift;
-    $self->{share} ||= $self->_calculate_share();
-    return unless $self->{share};
-    return $self->{share}."/web/static";
+    my $dir =  $self->_calculate_share();
+    return unless $dir;
+    return $dir."/web/static";
 }
 
 =head2 dispatcher

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ConfirmEmail.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ConfirmEmail.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,66 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::ConfirmEmail - Confirm a user's email address
+
+=head1 DESCRIPTION
+
+This is the link in a user's email to confirm that their email
+email is really theirs.  It is not really meant to be rendered on any
+web page, but is used by the confirmation notification.
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::ConfirmEmail;
+use base qw/Jifty::Action/;
+
+=head2 arguments
+
+A null sub, because the superclass wants to make sure we fill in arguments
+
+=cut
+
+sub arguments { }
+
+=head2 take_action
+
+Set their confirmed status.
+
+=cut
+
+sub take_action {
+    my $self        = shift;
+        my $LoginUser   = Jifty->app_class('Model', 'User');
+                my $CurrentUser   = Jifty->app_class('CurrentUser');
+
+
+
+    my $u = $LoginUser->new( current_user => $CurrentUser->superuser );
+    $u->load_by_cols(id => Jifty->web->current_user->user_object->id );
+
+    if ( $u->email_confirmed ) {
+        $self->result->error( email => _("You have already confirmed your account.") );
+        $self->result->success(1);    # but the action is still a success
+        return 1;
+    }
+
+    my ($val,$msg)  = $u->set_email_confirmed('1')  ;
+
+    unless ($val) {
+        $self->result->error($msg); 
+        return undef;
+    }
+    else { warn $msg }
+
+    # Set up our login message
+    $self->result->message( _("Welcome to %1, %2. " , Jifty->config->framework('ApplicationName') , $u->name) ." "
+          . _(". Your email address has now been confirmed.") );
+
+    # Actually do the login thing.
+    Jifty->web->current_user( $CurrentUser->new( id => $u->id ) );
+    return 1;
+}
+
+1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm	Sat Mar 17 15:23:02 2007
@@ -7,18 +7,18 @@
 
 =cut
 
-package Jifty::Plugin::Authentication::PasswordAction::GeneratePasswordToken;
+package Jifty::Plugin::Authentication::Password::Action::GeneratePasswordToken;
 use base qw/Jifty::Action/;
 
 =head2 arguments
 
-We need the username of the user we're fetching a token for, so we can
+We need the email of the user we're fetching a token for, so we can
 return the salt.
 
 =cut
 
 sub arguments { 
-    return( { username => { mandatory => 1 } });
+    return( { email => { mandatory => 1 } });
 
 }
 
@@ -34,10 +34,10 @@
 sub take_action {
     my $self = shift;
 
-    my $username = $self->argument_value('username');
+    my $email = $self->argument_value('email');
     my $class = Jifty->app_class('Model','User');
     my $user = $class->new(current_user => Jifty::CurrentUser->superuser);
-    $user->load_by_cols(username => $username);
+    $user->load_by_cols(email => $email);
     unless($user->id) {
         $self->result->error('No such user');
     }

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm	Sat Mar 17 15:23:02 2007
@@ -15,12 +15,12 @@
 
 =head2 arguments
 
-Return the username and password form fields
+Return the email and password form fields
 
 =cut
 
 sub arguments { 
-    return( { username => { label => 'Email username',
+    return( { email => { label => 'Email',
                            mandatory => 1,
                            ajax_validates => 1,
                             }  ,
@@ -46,23 +46,23 @@
 
 }
 
-=head2 validate_username ADDRESS
+=head2 validate_email ADDRESS
 
-Makes sure that the username submitted is a legal username and that there's a user in the database with it.
+Makes sure that the email submitted is a legal email and that there's a user in the database with it.
 
 Overridden from Jifty::Action::Record.
 
 =cut
 
-sub validate_username {
+sub validate_email {
     my $self  = shift;
-    my $username = shift;
+    my $email = shift;
 
-    my $u = Jifty::Plugin::Authentication::Password::Model::User->new(current_user => Jifty::Plugin::Authentication::Password::CurrentUser->superuser);
-    $u->load_by_cols( username => $username );
-    return $self->validation_error(username => 'We do not have an account that matches that username.') unless ($u->id);
+    my $u = Jifty->app_class('Model', 'User')->new(current_user => Jifty->app_class('CurrentUser')->superuser);
+    $u->load_by_cols( email => $email );
+    return $self->validation_error(email => 'We do not have an account that matches that email.') unless ($u->id);
 
-    return $self->validation_ok('username');
+    return $self->validation_ok('email');
 }
 
 
@@ -131,36 +131,54 @@
 
 sub take_action {
     my $self = shift;
-    my $user = Jifty->app_class('CurrentUser')->new( username => $self->argument_value('username'));
+    my $user = Jifty->app_class('Model', 'User')->new(current_user => Jifty->app_class('CurrentUser')->superuser);
+    $user->load_by_cols( email => $self->argument_value('email') );
+
 
     my $password = $self->argument_value('password');
-    my $token = $self->argument_value('token') || '';
+    my $token    = $self->argument_value('token') || '';
     my $hashedpw = $self->argument_value('hashed_password');
 
-    if ($token ne '') {   # browser supports javascript, do password hashing
-	unless ( $user->id  && $user->hashed_password_is($hashedpw, $token)){
-	    $self->result->error( 'You may have mistyped your username or password. Give it another shot.' );
-	    return;
-	}
-        Jifty->web->session->set(login_token => '');
-    }
-    else {  # no password hashing over the wire
-	unless ( $user->id  && $user->password_is($password)){
-	    $self->result->error( 'You may have mistyped your username or password. Give it another shot.' );
-	    return;
-	}
-    }
 
+    if ( $token ne '' ) {   # browser supports javascript, do password hashing
+        unless ( $user->id && $user->hashed_password_is( $hashedpw, $token ) )
+        {
+            $self->result->error( _('You may have mistyped your email or password. Give it another shot.'));
+            return;
+        }
+        Jifty->web->session->set( login_token => '' );
+    } else {                # no password hashing over the wire
+        unless ( $user->id && $user->password_is($password) ) {
+            $self->result->error( _('You may have mistyped your email address or password. Give it another shot.'));
+            return;
+        }
+    }
+    unless ($user->email_confirmed) {
+                $self->result->error( q{You haven't confirmed your account yet.} );        return;
+                    }
 
     # Set up our login message
-    $self->result->message("Welcome back, " . $user->user_object->name . "." );
+    $self->result->message( $self->login_message($user));
 
     # Actually do the signin thing.
-    Jifty->web->current_user($user);
-    Jifty->web->session->expires($self->argument_value('remember') ? '+1y' : undef);
+    Jifty->web->current_user(Jifty->app_class('CurrentUser')->new( id => $user->id));
+    Jifty->web->session->expires( $self->argument_value('remember') ? '+1y' : undef );
     Jifty->web->session->set_cookie;
 
     return 1;
 }
 
+=head2 login_message $user_object
+
+Returns the "hi, you're logged in message"
+
+=cut
+
+
+sub login_message {
+    my $self = shift;
+    my $user = shift;
+    return _("Welcome back, %1.", $user->name);
+}
+
 1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Logout.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Logout.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,35 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::Logout
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::Logout;
+use base qw/Jifty::Action/;
+
+=head2 arguments
+
+Return the email and password form fields
+
+=cut
+
+sub arguments {
+    return ( {} );
+}
+
+=head2 take_action
+
+Nuke the current user object
+
+=cut
+
+sub take_action {
+    my $self = shift;
+    Jifty->web->current_user(undef);
+    return 1;
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ResendConfirmation.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ResendConfirmation.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,99 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::ResendConfirmation
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::ResendConfirmation;
+use base qw/Jifty::Action/;
+
+__PACKAGE__->mk_accessors(qw(user_object));
+
+
+=head2 arguments
+
+The field for C<ResendConfirmation> is:
+
+=over 4
+
+=item email: the email email
+
+=back
+
+=cut
+
+sub arguments {
+    return (
+        {
+            email => {
+                label     => 'Email address',
+                mandatory => 1,
+                default_value => "",
+            },
+        }
+    );
+
+}
+
+=head2 setup
+
+Create an empty user object to work with
+
+=cut
+
+sub setup {
+    my $self = shift;
+    
+    # Make a blank user object
+    $self->user_object(Jifty->app_class('Model','User')->new(current_user => Jifty->app_class('CurrentUser')->superuser));
+}
+
+=head2 validate_email
+
+Make sure their email email is an unconfirmed user.
+
+=cut
+
+sub validate_email {
+    my $self  = shift;
+    my $email = shift;
+
+    unless ( $email =~ /\S\@\S/ ) {
+        return $self->validation_error(email => "Are you sure that's an email email?" );
+    }
+
+    $self->user_object(Jifty->app_class('Model','User')->new(current_user => Jifty->app_class('CurrentUser')->superuser));
+    $self->user_object->load_by_cols( email => $email );
+    unless ($self->user_object->id) {
+      return $self->validation_error(email => "It doesn't look like there's an account by that name.");
+    }
+
+    if ($self->user_object->email_confirmed) {
+      return $self->validation_error(email => "It looks like you're already confirmed.");
+
+    } 
+
+    return $self->validation_ok('email');
+}
+
+=head2 take_action
+
+Create a new unconfirmed user and send out a confirmation email.
+
+=cut
+
+sub take_action {
+    my $self = shift;
+    my $user = $self->user_object();
+
+    Jifty->app_class('Notification','ConfirmEmail')->new( to => $user )->send;
+    
+    $self->result->message("We've re-sent your confirmation.");
+
+    return 1;
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ResetLostPassword.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/ResetLostPassword.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,92 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::ResetPassword - Confirm and reset a lost password
+
+=head1 DESCRIPTION
+
+This is the action run by the link in a user's email to confirm that their email
+address is really theirs, when claiming that they lost their password.  
+
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::ResetLostPassword;
+use base qw/Jifty::Action/;
+
+=head2 arguments
+
+ConfirmEmail has the following fields: address, code, password, and password_confirm.
+Note that it can get the first two from the confirm dhandler.
+
+=cut
+
+sub arguments {
+    return (
+        {
+            password         => { 
+                type => 'password', 
+                sticky => 0, 
+                label  => _('Password') 
+            },
+            password_confirm => {
+                type   => 'password',
+                sticky => 0,
+                label  => _('type your password again')
+            },
+        }
+    );
+}
+
+=head2 take_action
+
+Resets the password.
+
+=cut
+
+sub take_action {
+    my $self        = shift;
+    my $LoginUser   = Jifty->app_class('Model', 'User');
+        my $CurrentUser   = Jifty->app_class('CurrentUser');
+
+
+
+
+    my $u = $LoginUser->new( current_user => $CurrentUser->superuser );
+    $u->load_by_cols( email => Jifty->web->current_user->user_object->email );
+
+    unless ($u) {
+        $self->result->error(
+            join( ' ',
+                _("You don't exist."),
+                _("I'm not sure how this happened."),
+                _("Really, really sorry."),
+                _("Please email us!") )
+        );
+    }
+
+    my $pass   = $self->argument_value('password');
+    my $pass_c = $self->argument_value('password_confirm');
+
+    # Trying to set a password (ie, submitted the form)
+    unless (defined $pass and defined $pass_c and length $pass and $pass eq $pass_c ) {
+        $self->result->error( _("It looks like you didn't enter the same password into both boxes. Give it another shot?")
+        );
+        return;
+    }
+
+    unless ( $u->set_password($pass) ) {
+        $self->result->error(_("There was an error setting your password."));
+        return;
+    }
+
+    # Log in!
+    $self->result->message(_("Your password has been reset.  Welcome back."));
+    Jifty->web->current_user( $CurrentUser->new( id => $u->id ) );
+    return 1;
+
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/SendAccountConfirmation.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/SendAccountConfirmation.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,100 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::SendAccountConfirmation
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::SendAccountConfirmation;
+use base qw/Jifty::Action/;
+
+__PACKAGE__->mk_accessors(qw(user_object));
+
+=head2 arguments
+
+The field for C<ResendConfirmation> is:
+
+=over 4
+
+=item address: the email address
+
+=back
+
+=cut
+
+sub arguments {
+    return (
+        {
+            address => {
+                label         => _('email address'),
+                mandatory     => 1,
+                default_value => "",
+            },
+        }
+    );
+}
+
+=head2 setup
+
+Create an empty user object to work with
+
+=cut
+
+sub setup {
+    my $self = shift;
+    my $LoginUser   = Jifty->app_class('Model', 'User');
+        my $CurrentUser   = Jifty->app_class('CurrentUser');
+
+
+
+    $self->user_object(
+        $LoginUser->new( current_user => $CurrentUser->superuser ) );
+}
+
+=head2 validate_address
+
+Make sure their email address is an unconfirmed user.
+
+=cut
+
+sub validate_address {
+    my $self  = shift;
+    my $email = shift;
+
+    my $LoginUser   = "Jifty::Plugin::Authentication::Password::Model::User";
+        my $CurrentUser = "Jifty::Plugin::Authentication::Password::CurrentUser";
+
+
+    return $self->validation_error(
+        address => _("That doesn't look like an email address.") )
+      unless ( $email =~ /\S\@\S/ );
+
+    $self->user_object(
+        $LoginUser->new( current_user => $CurrentUser->superuser ) );
+    $self->user_object->load_by_cols( email => $email );
+    return $self->validation_error(
+        address => _("It doesn't look like there's an account by that name.") )
+      unless ( $self->user_object->id );
+
+    return $self->validation_error(
+        address => _("It looks like you're already confirmed.") )
+      if ( $self->user_object->email_confirmed );
+
+    return $self->validation_ok('address');
+}
+
+=head2 take_action
+
+Create a new unconfirmed user and send out a confirmation email.
+
+=cut
+
+sub take_action {
+    my $self = shift;
+    Jifty::Plugin::Authentication::Password::Notification::ConfirmAddress->new( to => $self->user_object )->send;
+    return $self->result->message(_("Confirmation resent."));
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/SendPasswordReminder.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/SendPasswordReminder.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,99 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::SendPasswordReminder
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::SendPasswordReminder;
+use base qw/Jifty::Action/;
+
+
+__PACKAGE__->mk_accessors(qw(user_object));
+
+=head2 arguments
+
+The field for C<SendLostPasswordReminder> is:
+
+=over 4
+
+=item address: the email address
+
+=back
+
+=cut
+
+sub arguments {
+    return (
+        {
+            address => {
+                label     => _('Email'),
+                mandatory => 1,
+            },
+        }
+    );
+
+}
+
+=head2 setup
+
+Create an empty user object to work with
+
+=cut
+
+sub setup {
+    my $self = shift;
+    my $LoginUser   = Jifty->app_class('Model','User');
+        my $CurrentUser = Jifty->app_class('CurrentUser');
+
+
+
+    # Make a blank user object
+    $self->user_object(
+        $LoginUser->new( current_user => $CurrentUser->superuser ) );
+}
+
+=head2 validate_address
+
+Make sure there's actually an account by that name.
+
+=cut
+
+sub validate_address {
+    my $self  = shift;
+    my $email = shift;
+    my $LoginUser   = Jifty->app_class('Model','User');
+        my $CurrentUser = Jifty->app_class('CurrentUser');
+        
+
+    return $self->validation_error(
+        address => _("That doesn't look like an email address.") )
+      unless ( $email =~ /\S\@\S/ );
+
+    $self->user_object(
+        $LoginUser->new( current_user => $CurrentUser->superuser ) );
+    $self->user_object->load_by_cols( email => $email );
+    return $self->validation_error(
+        address => _("It doesn't look like there's an account by that name.") )
+      unless ( $self->user_object->id );
+
+    return $self->validation_ok('address');
+}
+
+=head2 take_action
+
+Send out a Reminder email giving a link to a password-reset form.
+
+=cut
+
+sub take_action {
+    my $self = shift;
+    Jifty->app_class('Notification','ConfirmLostPassword')->new(
+        to => $self->user_object )->send;
+    return $self->result->message(
+        _("A link to reset your password has been sent to your email account."));
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Signup.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Signup.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,119 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Action::Signup
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::Action::Signup;
+our @ISA;
+{
+    my $class = Jifty->app_class('Action', 'CreateUser');
+    push @ISA, $class;
+}
+
+=head2 arguments
+
+
+The fields for C<Signup> are:
+
+=over 4
+
+=item email: the email address
+
+=item password and password_confirm: the requested password
+
+=item name: your full name
+
+=back
+
+=cut
+
+sub arguments {
+    my $self = shift;
+    my $args = $self->SUPER::arguments();
+    
+
+    my %fields = (
+        name             => 1,
+        email            => 1,
+        password         => 1,
+        password_confirm => 1,
+    );
+
+    for (keys %$args){
+        delete $args->{$_} unless $fields{$_};
+    }
+
+    $args->{'email'}{'ajax_validates'}   = 1;
+    $args->{'email'}{'mandatory'}        = 1;
+    $args->{'name'}{'ajax_validates'}   = 1;
+    $args->{'password_confirm'}{'label'} = _("Type that again?");
+    return $args;
+}
+
+=head2 validate_email
+
+Make sure their email address looks sane
+
+=cut
+
+sub validate_email {
+    my $self  = shift;
+    my $email = shift;
+    my $LoginUser   = Jifty->app_class('Model', 'User');
+    my $CurrentUser   = Jifty->app_class('CurrentUser');
+
+
+    return $self->validation_error( email => _("That doesn't look like an email address.") ) unless ( $email =~ /\S\@\S/ );
+
+    my $u = $LoginUser->new( current_user => $CurrentUser->superuser );
+    $u->load_by_cols( email => $email );
+    if ( $u->id ) {
+        return $self->validation_error( email => _('It looks like you already have an account. Perhaps you want to <a href="/login">log in</a> instead?')
+        );
+    }
+
+    return $self->validation_ok('email');
+}
+
+=head2 take_action
+
+Overrides the virtual C<take_action> method on L<Jifty::Action> to call
+the appropriate C<Jifty::Record>'s C<create> method when the action is
+run, thus creating a new object in the database.
+
+Makes sure that the user only specifies things we want them to.
+
+=cut
+
+sub take_action {
+    my $self   = shift;
+    my $LoginUser   = Jifty->app_class('Model', 'User');
+    my $CurrentUser   = Jifty->app_class('CurrentUser');
+        
+    my $record = $LoginUser->new( current_user => $CurrentUser->superuser );
+
+    my %values;
+    $values{$_} = $self->argument_value($_) for grep {
+        defined $self->record->column($_) and defined $self->argument_value($_)
+    } $self->argument_names;
+
+    my ($id, $msg) = $record->create(%values);
+
+    # Handle errors?
+    unless ( $record->id ) {
+        $self->result->error( _("Something bad happened and we couldn't create your account: %1", $msg).' '.  _("Try again later. We're really, really sorry.")
+        );
+        return;
+    }
+
+    $self->result->message( _("Welcome to %1, %2.", Jifty->config->framework('ApplicationName'), $record->name)
+          . ' ' . _("We've sent a confirmation message to your email box.") );
+
+    return 1;
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,131 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Authentication::Password::Dispatcher;
+use Jifty::Dispatcher -base;
+
+# Put any plugin-specific dispatcher rules here.
+
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Dispatcher
+
+=head1 DESCRIPTION
+
+All the dispatcher rules jifty needs to support L<Jifty::Authentication::Password/>
+
+=cut
+
+
+=head1 RULES
+
+
+=head2 before logout
+
+=cut
+
+before 'logout' => run {
+    Jifty->web->new_action( class => 'Logout', moniker => 'logout')->run;
+    redirect '/';
+};
+
+# Make sure tangents work 
+# Before password reminders, login or signup, let's push the user off to the homepage if they're logged in
+
+=head2 before *
+
+=cut
+
+before '*' =>  run {
+    if ( Jifty->web->current_user->id ) {
+        logged_in_nav();
+    } else {
+        not_logged_in_nav();
+
+    }
+
+};
+
+=head2 on qr/^(?:passwordreminder|signup)$/ 
+
+=cut
+
+on qr/^(?:passwordreminder|signup)$/ => run {
+    redirect('/') if ( Jifty->web->current_user->id );
+    set 'next' => Jifty->web->request->continuation || Jifty::Continuation->new( request => Jifty::Request->new( path => "/login" ) );
+};
+
+=head2 on login
+
+=cut
+
+on qr/^(?:login)$/ => run {
+    redirect('/') if ( Jifty->web->current_user->id );
+    set 'next' => Jifty->web->request->continuation || Jifty::Continuation->new( request => Jifty::Request->new( path => "/" ) );
+};
+
+# Send a password reminder for a lost password
+
+=head2 on passwordreminder
+
+=cut
+
+on 'passwordreminder' => run {
+    set 'action' => Jifty->web->new_action( class => 'SendPasswordReminder', moniker => 'password_reminder');
+};
+
+
+=head2 on signup
+
+# Sign up for an account
+
+=cut
+
+on 'signup' => run {
+    set 'action' => Jifty->web->new_action( class => 'Signup');
+
+};
+
+=head2 on login
+
+Login
+
+=cut
+
+on 'login' => run {
+    set 'action' => Jifty->web->new_action( class => 'Login');
+};
+
+=head2 not_logged_in_nav
+
+=cut
+
+sub not_logged_in_nav {
+    Jifty->web->navigation->child(
+        Login   => label => _('Login') =>
+            url => '/login',
+        sort_order => '999'
+    );
+    Jifty->web->navigation->child(
+        Signup  => label => _('Sign up') =>
+            url => '/signup',
+        sort_order => '950'
+    );
+}
+
+=head2 logged_in_nav
+
+=cut
+
+sub logged_in_nav {
+    Jifty->web->navigation->child(
+        Logout  => label => _('Logout') =>
+            url => '/logout',
+        sort_order => '999'
+    );
+
+}
+
+
+1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
==============================================================================
--- /jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Model/User.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm	Sat Mar 17 15:23:02 2007
@@ -1,13 +1,13 @@
 use strict;
 use warnings;
 
-package Jifty::Plugin::Authentication::Password::Model::User;
+package Jifty::Plugin::Authentication::Password::Mixin::Model::User;
 use Jifty::DBI::Schema;
 use base 'Jifty::DBI::Record::Plugin';
 
 use Digest::MD5 qw'';
 
-our @EXPORT = qw(password_is);
+our @EXPORT = qw(password_is hashed_password_is regenerate_auth_token);
 
 use Jifty::Plugin::Authentication::Password::Record schema {
 
@@ -16,8 +16,7 @@
   render_as 'unrendered',
   type is 'varchar',
   default is '',
-  label is 'Authentication token',
-  since '0.2.34';
+  label is 'Authentication token';
     
 
 
@@ -33,6 +32,12 @@
 
 };
 
+sub register_triggers {
+    my $self = shift;
+    $self->add_trigger(name => 'after_create', callback => \&after_create);
+    $self->add_trigger(name => 'after_set_password', callback => \&after_set_password);
+    $self->add_trigger(name => 'validate_password', callback => \&validate_password, abortable =>1);
+}
 
 
 =head2 password_is PASSWORD
@@ -46,7 +51,6 @@
     my $pass = shift;
 
     return undef unless $self->_value('password');
-
     my ($hash, $salt) = @{$self->_value('password')};
 
     return 1 if ( $hash eq Digest::MD5::md5_hex($pass . $salt) );
@@ -90,7 +94,14 @@
 
 sub after_create {
     my $self = shift;
+    # We get a reference to the return value of insert
+    my $value = shift; return unless $$value; $self->load($$value);
     $self->regenerate_auth_token;
+    if ( $self->id and $self->email and not $self->email_confirmed ) {
+        Jifty->app_class('Notification','ConfirmEmail')->new( to => $self )->send;
+    } else {
+        warn  $self->id . " " .$self->email;
+    }
 
 
 }
@@ -119,7 +130,7 @@
 
     $auth_token .= unpack('H2', chr(int rand(255))) for (1..16);
 
-    $self->set_auth_token($auth_token);
+    $self->__set(column => 'auth_token', value => $auth_token);
 }
 
 

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmEmail.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmEmail.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,52 @@
+use warnings;
+use strict;
+
+package Jifty::Plugin::Authentication::Password::Notification::ConfirmEmail;
+use base qw/Jifty::Notification/;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Notification::ConfirmEmail
+
+=head1 ARGUMENTS
+
+C<to>, a L<$YOURAPP:Model::User> whose address we are confirming.
+
+=cut
+
+=head2 setup
+
+Sets up the fields of the message.
+
+=cut
+
+sub setup {
+    my $self = shift;
+
+    my $LoginUser   = Jifty->app_class('Model', 'User');
+
+    unless ( UNIVERSAL::isa($self->to, $LoginUser) ){
+	$self->log->error((ref $self) . " called with invalid user argument");
+	return;
+    } 
+   
+
+    my $letme = Jifty::LetMe->new();
+    $letme->email($self->to->email);
+    $letme->path('confirm_email'); 
+    my $confirm_url = $letme->as_url;
+    my $appname = Jifty->config->framework('ApplicationName');
+
+    $self->subject( _("Welcome to %1!",$appname ));
+    $self->body(_("
+You're getting this message because you (or somebody claiming to be you)
+wants to use %1. 
+
+We need to make sure that we got your email address right.  Click on the link below to get started:
+
+%2
+",$appname,$confirm_url));
+
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmLostPassword.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Notification/ConfirmLostPassword.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,52 @@
+use warnings;
+use strict;
+
+package Jifty::Plugin::Authentication::Password::Notification::ConfirmLostPassword;
+use base qw/Jifty::Notification/;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Notification::ConfirmLostPassword
+
+=head1 ARGUMENTS
+
+C<to>, a L<$YourApp::Model::User> whose address we are confirming.
+
+=cut
+
+=head2 setup
+
+Sets up the fields of the message.
+
+=cut
+
+sub setup {
+    my $self = shift;
+    my $LoginUser   = Jifty->app_class('Model', 'User');
+
+    unless ( UNIVERSAL::isa($self->to, $LoginUser) ){
+    $self->log->error((ref $self) . " called with invalid user argument");
+    return;
+    }
+
+    my $letme = Jifty::LetMe->new();
+    $letme->email($self->to->email);
+    $letme->path('reset_lost_password');
+    my $confirm_url = $letme->as_url;
+    my $appname = Jifty->config->framework('ApplicationName');
+
+    $self->body(_("
+You're getting this message because you (or somebody claiming to be you)
+request to reset your password for %1.
+
+If you don't want to reset your password just ignore this message.
+
+To reset your password, click on the link below:
+
+%2
+",$appname,$confirm_url));
+
+}
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,120 @@
+use utf8;
+use warnings;
+use strict;
+
+=head1 NAME
+
+Jifty::Plugin::Authentication::Password::Login::View
+
+=head1 DESCRIPTION
+
+This code is only useful on the new Jifty "Declarative tempaltes" branch. It shouldn't get in the way 
+if you're running a traditional (0.610 or before) Jifty.
+
+=cut
+
+package Jifty::Plugin::Authentication::Password::View;
+use HTML::Entities ();
+use Jifty::View::Declare -base;
+
+{ no warnings 'redefine';
+sub page (&) {
+    no strict 'refs'; 
+    BEGIN {Jifty::Util->require(Jifty->app_class('View'))};
+    &{Jifty->app_class('View') . "::page"}(@_);
+}
+}
+
+
+template 'signup' => page {
+    title is 'Signup';
+    my ( $action, $next ) = get(qw(action next));
+    Jifty->web->form->start( call => $next );
+    render_param( $action => 'name' , focus => 1);
+    render_param( $action => $_ ) for ( grep {$_ ne 'name'} $action->argument_names );
+    form_submit( label => _('Signup'), submit => $action );
+    Jifty->web->form->end();
+};
+
+template login => page {
+    { title is 'Login!' };
+    show('login_widget');
+};
+
+template login_widget => sub {
+
+    my ( $action, $next ) = get( 'action', 'next' );
+    $action ||= new_action( class => 'Login' );
+    $next ||= Jifty::Continuation->new(
+        request => Jifty::Request->new( path => "/" ) );
+    unless ( Jifty->web->current_user->id ) {
+        p {
+            outs( _(        qq{No account yet? It's quick and easy.} ));
+            tangent( label => _("Sign up for an account!"), url   => '/signup');
+        };
+        h3  { _(qq{Login with a password}) };
+        div {
+            attr { id => 'jifty-login' };
+            Jifty->web->form->start( call => $next );
+            render_param( $action, 'email', focus => 1 );
+            render_param( $action, $_ ) for (qw(password remember));
+            form_submit( label => _(q{Login}), submit => $action );
+            hyperlink(
+                label => _("Lost your password?"),
+                url   => "/lost_password"
+            );
+            Jifty->web->form->end();
+        };
+    } else {
+        outs( _("You're already logged in.") );
+    }
+};
+
+template 'let/reset_lost_password' => page {
+    attr { title => 'Reset lost password' };
+    my $action = Jifty->web->new_action( class => 'ResetLostPassword' );
+
+    h2   { _('Reset lost password') };
+    form {
+        render_param( $action => $_ ) for ( $action->argument_names );
+        form_submit( label => _("New password") );
+    };
+};
+
+template 'let/confirm_email' => sub {
+    new_action( class => 'ConfirmEmail' )->run;
+    redirect("/");
+};
+
+template 'lost_password' => page {
+    my $action = Jifty->web->new_action(
+        moniker => 'password_reminder',
+        class   => 'SendPasswordReminder',
+    );
+
+    h2 { _('Send a link to reset your password') };
+    outs( _(  "You lost your password. A link to reset it will be sent to the following email address:"));
+
+    form {
+        render_param( $action => $_ ) for ( $action->argument_names );
+        form_submit( label => _("Send") );
+        }
+
+};
+
+template 'passwordreminder' => page {
+    attr { title => 'Send Password Reminder' };
+    my $action = Jifty->web->new_action(
+        moniker => 'password_reminder',
+        class   => 'SendPasswordReminder',
+    );
+    h2 { _('Send a password reminder') };
+    p  { _(  "You lost your password. A reminder will be send to the following mail:") };
+
+    form {
+        render_param( $action => $_ ) for ( $action->argument_names );
+        form_submit( label => _("Send") );
+    };
+};
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::LetMe;
+use base qw/Jifty::Plugin/;
+
+# Your plugin goes here.  If takes any configuration or arguments, you
+# probably want to override L<Jifty::Plugin/init>.
+
+=head1 NAME
+
+Jifty::Plugin::LetMe
+
+=head1 DESCRIPTION
+
+This plugin provides dispatcher rules to support jifty's internal C<LetMe> 
+url-based authentication.  
+
+
+=cut
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/LetMe/Dispatcher.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,32 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::LetMe::Dispatcher;
+use Jifty::Dispatcher -base;
+
+=head1 NAME
+
+Jifty::Plugin::LetMe::Dispatcher
+
+=head1 DESCRIPTION
+
+All the dispatcher rules jifty needs to support L<Jifty::LetMe/>
+
+=cut
+
+## LetMes
+before qr'^/let/(.*)' => run {
+    my $let_me = Jifty::LetMe->new();
+    $let_me->from_token($1);
+    redirect '/error/let_me/invalid_token' unless $let_me->validate;
+    Jifty->web->temporary_current_user( $let_me->validated_current_user );
+
+    my %args = %{ $let_me->args };
+    set $_ => $args{$_} for keys %args;
+    set let_me => $let_me;
+};
+
+on qr'^/let/' =>
+    run { my $let_me = get 'let_me'; show '/let/' . $let_me->path; };
+
+1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/OnlineDocs.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/OnlineDocs.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/OnlineDocs.pm	Sat Mar 17 15:23:02 2007
@@ -4,6 +4,12 @@
 package Jifty::Plugin::OnlineDocs;
 use base qw/Jifty::Plugin/;
 
+require File::Basename;
+require File::Find;
+require File::Temp;
+require File::Spec;
+require Pod::Simple::HTML;
+
 # Your plugin goes here.  If takes any configuration or arguments, you
 # probably want to override L<Jifty::Plugin/init>.
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm	Sat Mar 17 15:23:02 2007
@@ -16,6 +16,27 @@
 
 use Jifty::Dispatcher -base;
 
-on '/' => run { show 'index.html' };
+    
+
+on '*' => run {
+    my $top = Jifty->web->navigation;
+    $top->child( Home => url => "/", sort_order => 1, label => _('Home') );
+    if ( Jifty->config->framework('AdminMode') ) {
+        $top->child(
+            Administration =>
+              url          => "/__jifty/admin/",
+            label      => _('Administration'),
+            sort_order => 998
+        );
+        $top->child(
+            OnlineDocs =>
+              url      => "/__jifty/online_docs/",
+            label      => _('Online docs'),
+            sort_order => 999
+        );
+    }
+    return ();
+};
+
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm	Sat Mar 17 15:23:02 2007
@@ -20,28 +20,9 @@
 
 =cut
 
-template '_elements/nav' => sub {
-    my $top = Jifty->web->navigation;
-    $top->child( Home => url => "/", sort_order => 1, label => _('Home') );
-    if ( Jifty->config->framework('AdminMode') ) {
-        $top->child(
-            Administration =>
-              url          => "/__jifty/admin/",
-            label      => _('Administration'),
-            sort_order => 998
-        );
-        $top->child(
-            OnlineDocs =>
-              url      => "/__jifty/online_docs/",
-            label      => _('Online docs'),
-            sort_order => 999
-        );
-    }
-    return ();
-};
-
-template '_elements/sidebar' => sub {
-    with( id => "salutation" ), div {
+private template 'salutation' => sub {
+    div {
+    attr {id => "salutation" };
         if (    Jifty->web->current_user->id
             and Jifty->web->current_user->user_object )
         {
@@ -52,10 +33,13 @@
         else {
             _("You're not currently signed in.");
         }
-    };
-    with( id => "navigation" ), div {
-        Jifty->web->navigation->render_as_menu;
-    };
+    }
+};
+
+private template 'menu' => sub {
+    div {
+    attr { id => "navigation" };
+        Jifty->web->navigation->render_as_menu; };
 };
 
 template '__jifty/empty' => sub {
@@ -63,36 +47,29 @@
 };
 
 
-template '_elements/header' => sub {
+private template 'header' => sub {
     my ($title) = get_current_attr(qw(title));
     Jifty->handler->apache->content_type('text/html; charset=utf-8');
-    head {
+    head { 
         with(
             'http-equiv' => "content-type",
             content      => "text/html; charset=utf-8"
-          ),
+          ),    
           meta {};
         with( name => 'robots', content => 'all' ), meta {};
         title { _($title) };
-
         Jifty->web->include_css;
         Jifty->web->include_javascript;
-      }
+      };
+
 };
 
 
-template '_elements/keybindings' => sub {
+
+private template 'keybindings' => sub {
     div { id is "keybindings" };
 };
 
-template 'index.html' => page {
-    { title is _('Welcome to your new Jifty application') }
-    img {
-        src is "/static/images/pony.jpg", alt is _(
-            'You said you wanted a pony. (Source %1)',
-            'http://hdl.loc.gov/loc.pnp/cph.3c13461'
-        );
-    };
-};
+#template 'index.html' => page { { title is _('Welcome to your new Jifty application') } img { src is "/static/images/pony.jpg", alt is _( 'You said you wanted a pony. (Source %1)', 'http://hdl.loc.gov/loc.pnp/cph.3c13461'); }; };
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/User/Mixin/Model/User.pm
==============================================================================
--- /jifty/branches/virtual-models/lib/Jifty/Plugin/User/Model/User.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/User/Mixin/Model/User.pm	Sat Mar 17 15:23:02 2007
@@ -1,40 +1,98 @@
 use strict;
 use warnings;
 
-package Jifty::Plugin::User::Model::User;
+package Jifty::Plugin::User::Mixin::Model::User;
 use Jifty::DBI::Schema;
 
 
 =head1 NAME
 
-Jifty::Plugin::User::Model::User
+Jifty::Plugin::User::Mixin::Model::User
 
 =head1 DESCRIPTION
 
-package MyApp::Model::User;
+ package MyApp::Model::User;
+ use Jifty::DBI::Schema;
+ use MyApp::Record schema { 
+     # column definitions
+ };
+ 
+ use Jifty::Plugin::User::Mixin::Model::User; # Imports two columns: name and email
+ 
 
-use Jifty::DBI::Schema;
-
-use MyApp::Record schema { 
+=cut
 
-    # column definitions
+use base 'Jifty::DBI::Record::Plugin';
+use Jifty::Plugin::User::Record schema {
+    column
+        name => type is 'text',
+        label is 'Nickname',
+        hints is 'How should I display your name to other users?';
+    column
+        email => type is 'text',
+        label is 'Email address', default is '', is immutable, is distinct;
+    column
+        email_confirmed => label is 'Email address confirmed?',
+        type is 'boolean', render_as 'Unrendered';
 
 };
 
-use Jifty::Plugin::User::Model::User; # Imports two columns: name and username
+# Your model-specific methods go here.
 
 
+
+=head2 set_email ADDRESS
+
+Whenever a user's email is set to a new value, we need to make 
+sure they reconfirm it.
+
 =cut
 
+{
+    no warnings 'redefine';
 
-use base 'Jifty::DBI::Record::Plugin';
-use Jifty::Plugin::User::Record schema {
-    column name => type is 'text', label is 'How should I display your name?';
-    column username => type is 'text';
-};
+sub set_email {
+    my $self  = shift;
+    my $new_address = shift;
+    my $email = $self->__value('email');
+
+    my @ret = $self->_set( column => 'email', value => $new_address);
+
+    unless ( $email eq $self->__value('email') ) {
+        $self->__set( column => 'email_confirmed', value => '0' );
+        Jifty->app_class('Notification','ConfirmEmail')->new( to => $self )->send;
+    }
+
+    return (@ret);
+}
+
+}
+
+=head2 validate_email
+
+Makes sure that the email address looks like an email address and is
+not taken.
+
+=cut
+
+sub validate_email {
+    my $self      = shift;
+    my $new_email = shift;
+    
+    return ( 0, "That $new_email doesn't look like an email address." )
+        if $new_email !~ /\S\@\S/;
+    
+    my $temp_user = Jifty->app_class('Model','User')->new( current_user => Jifty->app_class('CurrentUser')->superuser );
+    $temp_user->load_by_cols( 'email' => $new_email );
+    
+    # It's ok if *we* have the address we're looking for
+    return ( 0, q{It looks like somebody else is using that address. Is there a chance you have another account?} )
+        if $temp_user->id && ( !$self->id || $temp_user->id != $self->id );
+    
+    return 1;
+}
 
 
-# Your model-specific methods go here.
 
 1;
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Yullio/View.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Yullio/View.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Yullio/View.pm	Sat Mar 17 15:23:02 2007
@@ -1,4 +1,4 @@
-package Jifty::View::Declare::Yullio;
+package Jifty::Plugin::Yullio::View;
 use strict;
 use warnings;
 
@@ -11,11 +11,11 @@
 
 =head1 NAME
 
-Jifty::View::Declare::Yullio - Yullio layout bundles
+Jifty::Plugin::Yullio::View - Yullio layout bundles
 
 =head1 SYNOPSIS
 
-  use Jifty::View::Declare::Yullio
+  use Jifty::Plugin::Yullio::View;
   template 'index2.html' => page {
     with ( width => 'doc2', column_template => 'yui-t6' ),
     yullio
@@ -24,7 +24,7 @@
 
 =head1 DESCRIPTION
 
-C<Jifty::View::Declare::Yullio> provides an alternative C<page>
+C<Jifty::Plugin::Yullio::View> provides an alternative C<page>
 temlpate constructor that makes use of yui grid layouts.
 
 =cut
@@ -56,6 +56,13 @@
     };
 }
 
+=head2 yullio CODE CODE
+
+Clkao owes docs
+
+=cut
+
+
 sub yullio(&&) {
     my ($code1, $code2) = @_;
     _yullio_content($code1, $code2)->();

Modified: jifty/branches/virtual-models/lib/Jifty/Util.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Util.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Util.pm	Sat Mar 17 15:23:02 2007
@@ -222,7 +222,14 @@
 
 sub require {
     my $self = shift;
-    my $class = shift;
+    my $module = shift;
+    $self->_require( module => $module,  quiet => 0);
+}
+
+sub _require {
+    my $self = shift;
+    my %args = ( module => undef, quiet => undef, @_);
+    my $class = $args{'module'};
 
     # Quick hack to silence warnings.
     # Maybe some dependencies were lost.
@@ -233,11 +240,15 @@
 
     return 1 if $self->already_required($class);
 
+    local $UNIVERSAL::require::ERROR = '';
     my $retval = $class->require;
     if ($UNIVERSAL::require::ERROR) {
         my $error = $UNIVERSAL::require::ERROR;
         $error =~ s/ at .*?\n$//;
-        Jifty->log->error(sprintf("$error at %s line %d\n", (caller)[1,2]));
+        
+        unless ($args{'quiet'} and $error =~ /^Can't locate/) {
+            Jifty->log->error(sprintf("$error at %s line %d\n", (caller(1))[1,2]));
+        }
         return 0;
     }
 
@@ -250,6 +261,20 @@
     return 1;
 }
 
+=head2 try_to_require Module
+
+This method works just like L</require>, except that it surpresses the error message
+in cases where the module isn't found.
+
+=cut
+
+sub  try_to_require {
+    my $self = shift;
+    my $module = shift;
+    $self->_require( module => $module,  quiet => 1);
+}
+
+
 =head2 already_required class
 
 Helper function to test whether a given class has already been require'd.

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare.pm	Sat Mar 17 15:23:02 2007
@@ -1,5 +1,5 @@
 package Jifty::View::Declare;
-use Jifty::View::Declare::BaseClass ();
+
 
 use strict;
 use warnings;
@@ -20,9 +20,9 @@
 sub import {
     my ($class, $import) = @_;
     ($import and $import eq '-base') or return;
-
     no strict 'refs';
     my $pkg = caller;
+    Jifty::Util->require(BaseClass);
     push @{ $pkg . '::ISA' }, BaseClass;
 
     @_ = BaseClass;

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/BaseClass.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/BaseClass.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/BaseClass.pm	Sat Mar 17 15:23:02 2007
@@ -2,29 +2,15 @@
 
 use strict;
 use warnings;
-use vars qw( $r );
 use base qw/Exporter Jifty::View::Declare::Helpers/;
 use Scalar::Defer;
 use Template::Declare::Tags;
+
+
 use Jifty::View::Declare::Helpers;
 
-our @EXPORT = (
-    @Jifty::View::Declare::Helpers::EXPORT,
-    @Template::Declare::Tags::EXPORT,
-);
-
-{
-    no warnings 'redefine';
-
-    sub show {
-        # Handle relative path here!
-
-        my $path = shift;
-        $path =~ s{^/}{};
-        Jifty::View::Declare::Helpers->can('show')->( $path, @_ );
-    }
-}
 
+our @EXPORT = ( @Jifty::View::Declare::Helpers::EXPORT);
 
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/CoreTemplates.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/CoreTemplates.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/CoreTemplates.pm	Sat Mar 17 15:23:02 2007
@@ -29,6 +29,11 @@
 
 =cut
 
+=for later 
+
+These templates are still in masonland. we're doign something wrong with escaping in them
+
+
 template '__jifty/subs' => sub {
     my ($forever) = get(qw(forever)) || 1;
 
@@ -341,6 +346,6 @@
     outs( Jifty::YAML::Dump( { Jifty->web->response->results } ) );
 };
 
+=cut
 
 1;
-1;

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm	Sat Mar 17 15:23:02 2007
@@ -5,7 +5,7 @@
 
 use base qw/Jifty::Object Class::Accessor/;
 use Template::Declare;
-
+use Encode ();
 
 __PACKAGE__->mk_accessors(qw/root_class/);
 
@@ -54,6 +54,7 @@
             Jifty->handler->apache->send_http_header();
         }
     print STDOUT $content;
+    Encode::_utf8_on($content);
     return undef;
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm	Sat Mar 17 15:23:02 2007
@@ -2,15 +2,11 @@
 use strict;
 
 package Jifty::View::Declare::Helpers;
-
+use base qw/Template::Declare/;
 use base qw/Exporter/;
 use Template::Declare::Tags;
 
-use base qw/Template::Declare/;
-our @EXPORT = (
-    qw(form hyperlink tangent redirect new_action form_submit form_next_page page wrapper request get set render_param current_user render_action render_region ),
-    @Template::Declare::Tags::EXPORT
-);
+our @EXPORT = ( qw(form hyperlink tangent redirect new_action form_submit form_next_page page wrapper request get set render_param current_user render_action render_region), @Template::Declare::Tags::EXPORT);
 
 
 =head1 NAME
@@ -25,11 +21,6 @@
 
 
 
-=cut
-
-{
-    no warnings qw/redefine/;
-
 
 =head2 form CODE
 
@@ -39,6 +30,9 @@
 
 =cut
 
+
+{
+    no warnings qw/redefine/;
     sub form (&) {
         my $code = shift;
         outs_raw( Jifty->web->form->start );
@@ -104,6 +98,7 @@
 
 sub render_region(@) {
     unshift @_, 'name' if @_ % 2;
+    local $Template::Declare::Tags::self = undef;
     Template::Declare->new_buffer_frame;
     Jifty::Web::PageRegion->new(@_)->render;
     my $content = Template::Declare->buffer->data();
@@ -219,7 +214,7 @@
 
 
 sub set {
-    while ( my ( $arg, $val ) = ( shift @_, shift @_ ) ) {
+    while ( my ( $arg, $val ) = splice(@_, 0, 2) ) {
         request->argument( $arg => $val );
     }
 
@@ -247,17 +242,17 @@
 
 =cut
 
-
 sub page (&) {
     my $code = shift;
     sub {
         Jifty->handler->apache->content_type('text/html; charset=utf-8');
-        show('/_elements/nav');
         wrapper($code);
     };
+
 }
 
 
+
 =head2 wrapper $coderef
 
 Render a page. $coderef is a L<Template::Declare> coderef. 
@@ -265,102 +260,112 @@
 
 =cut
 
-
 sub wrapper ($) {
     my $content_code = shift;
-
     my ($title) = get_current_attr(qw(title));
 
     my $done_header;
     my $render_header = sub {
         no warnings qw( uninitialized redefine once );
+        $title ||= Jifty->config('framework')->{'ApplicationName'};
 
-        defined $title or return;
+        #   defined $title or return;
         return if $done_header++;
-
         Template::Declare->new_buffer_frame;
+        outs_raw(
+        '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
+            . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">' );
         render_header($title);
         $done_header = Template::Declare->buffer->data;
         Template::Declare->end_buffer_frame;
-
-        '';
+        return '';
     };
 
-    my $wrapped_content_code = sub {
-        no warnings qw( uninitialized redefine once );
-
-        local *is::title = sub {
-            shift;
-            $title = "@_";
-            &$render_header;
+    body {
+        div {
+            div {
+            show 'salutation'; 
+            show 'menu'; 
         };
+            div {
+                div {
+                    {
+                        no warnings qw( uninitialized redefine once );
+
+                        local *is::title = sub {
+                            shift;
+
+                            for (@_) {
+                                if ( ref($_) eq 'CODE' ) {
+                                    Template::Declare->new_buffer_frame;
+                                    $_->();
+                                    $title .= Template::Declare->buffer->data;
+                                    Template::Declare->end_buffer_frame;
+                                } else {
+                                    $title .= Jifty->web->escape($_);
+                                }
+                            }
+                            &$render_header;
+                            h1 { attr { class => 'title' }; outs_raw($title) };
+                        };
+                }
+
+                        &_render_pre_content_hook();
+                        Jifty->web->render_messages;
+                        &$content_code;
+                        &$render_header unless ($done_header);
+                        &_render_jifty_page_detritus();
 
-        &$content_code;
-        if ( !$done_header ) {
-            $title = _("Untitled");
-            &$render_header;
-        }
+                };
+            };
+        };
     };
+    outs_raw('</html>');
+    Template::Declare->buffer->data( $done_header . Template::Declare->buffer->data );
+}
 
-    body {
-        show('/_elements/sidebar');
-        with( id => "content" ), div {
-            with( name => 'content' ), a {};
-            if ( Jifty->config->framework('AdminMode') ) {
-                with( class => "warning admin_mode" ), div {
-                    outs( _('Alert') . ': ' );
-                    outs_raw(
-                        Jifty->web->tangent(
-                            label => _('Administration mode is enabled.'),
-                            url   => '/__jifty/admin/'
-                        )
-                    );
-                    }
+sub _render_pre_content_hook {
+    if ( Jifty->config->framework('AdminMode') ) {
+        with( class => "warning admin_mode" ), div {
+            outs( _('Alert') . ': ' );
+            outs_raw(
+                Jifty->web->tangent(
+                    label => _('Administration mode is enabled.'),
+                    url   => '/__jifty/admin/'
+                )
+            );
             }
-            Jifty->web->render_messages;
-            $wrapped_content_code->();
+    }
+}
 
-            show('/_elements/keybindings');
-            with( id => "jifty-wait-message", style => "display: none" ),
-                div { _('Loading...') };
-
-# Jifty::Mason::Halo->render_component_tree if ( Jifty->config->framework('DevelMode') );
-
-           # This is required for jifty server push.  If you maintain your own
-           # wrapper, make sure you have this as well.
-            if (   Jifty->config->framework('PubSub')->{'Enable'}
-                && Jifty::Subs->list )
-            {
-                script { outs('new Jifty.Subs({}).start();') };
-            }
-        };
-    };
+sub _render_jifty_page_detritus {
 
-    Template::Declare->buffer->data(
-        $done_header . Template::Declare->buffer->data );
+    show('keybindings');
+    with( id => "jifty-wait-message", style => "display: none" ),
+        div { _('Loading...') };
+
+    # This is required for jifty server push.  If you maintain your own
+    # wrapper, make sure you have this as well.
+    if ( Jifty->config->framework('PubSub')->{'Enable'} && Jifty::Subs->list )
+    {
+        script { outs('new Jifty.Subs({}).start();') };
+    }
 }
 
-
 =head2 render_header $title
 
 Renders an HTML "doctype", <head> and the first part of a page body. This bit isn't terribly well thought out and we're not happy with it.
 
 =cut
 
-sub render_header {
-    my ($title) = @_;
-    outs_raw(
-        '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
-            . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">' );
-    with( title => $title ), show('/_elements/header');
-    div {
-        { id is 'headers' }
-        hyperlink(
-            url   => "/",
-            label => _( Jifty->config->framework('ApplicationName') )
-        );
-        with( class => "title" ), h1 {$title};
-    };
-}
+sub render_header { 
+    my $title = shift || '';
+    $title =~ s/<.*?>//g;    # remove html
+    HTML::Entities::decode_entities($title);
+    with( title => $title ), show('header');
+}               
+                    
+
+
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/View/Static/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Static/Handler.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Static/Handler.pm	Sat Mar 17 15:23:02 2007
@@ -117,7 +117,7 @@
     my $self    = shift;
     my $file    = shift;
     my @options = (Jifty->config->framework('Web')->{StaticRoot});
-    push @options, grep {$_} map {$_->static_root} Jifty->plugins;
+    push @options, grep { -d $_ && -r $_ } map {$_->static_root} Jifty->plugins;
     push @options, (Jifty->config->framework('Web')->{DefaultStaticRoot});
 
     # Chomp a leading "/static" - should this be configurable?

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm	Sat Mar 17 15:23:02 2007
@@ -379,7 +379,7 @@
 
     # Add a redirect, if this isn't to the right page
     if ( $self->url ne $root and not $self->returns ) {
-        require Jifty::Action::Redirect;
+        Jifty::Util->require('Jifty::Action::Redirect');
         my $redirect = Jifty::Action::Redirect->new(
             arguments => { url => $self->url } );
         $parameters{ $redirect->register_name } = ref $redirect;

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm	Sat Mar 17 15:23:02 2007
@@ -81,7 +81,7 @@
     # a mapped argument, then do the mapping and mark the field as hidden.
     my ($key, $value) = Jifty::Request::Mapper->query_parameters($self->input_name, $self->current_value);
     if ($key ne $self->input_name) {
-        require Jifty::Web::Form::Field::Hidden;
+        Jifty::Util->require('Jifty::Web::Form::Field::Hidden');
         bless $self, "Jifty::Web::Form::Field::Hidden";
         $self->input_name($key);
         $self->default_value($value);

Modified: jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm	Sat Mar 17 15:23:02 2007
@@ -17,6 +17,7 @@
 use base qw/Jifty::Object Class::Accessor::Fast/;
 __PACKAGE__->mk_accessors(qw(name force_path force_arguments default_path default_arguments qualified_name parent region_wrapper));
 use Jifty::JSON;
+use Encode ();
 
 =head2 new PARAMHASH
 
@@ -322,14 +323,18 @@
     my $region_content = '';
 
     # template-declare based regions are printing to stdout
-    open my $output_fh, '>>', $out_method;
+    my $td_out = '';
+    Encode::_utf8_on($td_out);
+    open my $output_fh, '>>:utf8', \$td_out;
     local *STDOUT = $output_fh;
 
+    local $main::DEBUG=1;
     # Call into the dispatcher
     Jifty->handler->dispatcher->handle_request;
 
     Jifty->handler->mason->interp->out_method($orig_out);
 
+    $$out_method .= $td_out if length($td_out);
     return;
 }
 

Modified: jifty/branches/virtual-models/plugins/AuthCASOnly/MANIFEST
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthCASOnly/MANIFEST	(original)
+++ jifty/branches/virtual-models/plugins/AuthCASOnly/MANIFEST	Sat Mar 17 15:23:02 2007
@@ -9,7 +9,7 @@
 lib/Jifty/Plugin/AuthCASOnly/Action/CASLogout.pm
 lib/Jifty/Plugin/AuthCASOnly/CurrentUser.pm
 lib/Jifty/Plugin/AuthCASOnly/Dispatcher.pm
-lib/Jifty/Plugin/AuthCASOnly/Model/CASUser.pm
+lib/Jifty/Plugin/AuthCASOnly/Model/User.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml

Modified: jifty/branches/virtual-models/plugins/AuthCASOnly/debian/changelog
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthCASOnly/debian/changelog	(original)
+++ jifty/branches/virtual-models/plugins/AuthCASOnly/debian/changelog	Sat Mar 17 15:23:02 2007
@@ -1,3 +1,9 @@
+libjifty-plugin-authcasonly-perl (0-2) unstable; urgency=low
+
+  * use of Jifty::Record schema block
+
+ -- AGOSTINI Yves <agostini at univ-metz.fr>  Fri,  9 Mar 2007 15:12:27 +0100
+
 libjifty-plugin-authcasonly-perl (0-1) unstable; urgency=low
 
   * Initial Release.

Modified: jifty/branches/virtual-models/plugins/AuthCASOnly/debian/files
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthCASOnly/debian/files	(original)
+++ jifty/branches/virtual-models/plugins/AuthCASOnly/debian/files	Sat Mar 17 15:23:02 2007
@@ -1 +1 @@
-libjifty-plugin-authcasonly-perl_0-1_all.deb perl optional
+libjifty-plugin-authcasonly-perl_0-2_all.deb perl optional

Modified: jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly.pm
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly.pm	(original)
+++ jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly.pm	Sat Mar 17 15:23:02 2007
@@ -37,7 +37,7 @@
         $CurrentCASUserClass = $args{CurrentUserClass}
             || "${appname}::CurrentUser";
         $AuthCASUserClass = $args{AuthCASUserClass}
-            || "${appname}::Model::CASUser";
+            || "${appname}::Model::User";
 
 	my ($conf, $cafile, $casserver);
     	foreach (@{Jifty->config->framework('Plugins')}) {

Copied: jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/User.pm (from r2852, /jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/CASUser.pm)
==============================================================================
--- /jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/CASUser.pm	(original)
+++ jifty/branches/virtual-models/plugins/AuthCASOnly/lib/Jifty/Plugin/AuthCASOnly/Model/User.pm	Sat Mar 17 15:23:02 2007
@@ -1,4 +1,4 @@
-package Jifty::Plugin::AuthCASOnly::Model::CASUser;
+package Jifty::Plugin::AuthCASOnly::Model::User;
 use base qw/Jifty::Record/;
 use Jifty::DBI::Schema;
 use Scalar::Defer;

Modified: jifty/branches/virtual-models/plugins/AuthLDAPOnly/MANIFEST
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthLDAPOnly/MANIFEST	(original)
+++ jifty/branches/virtual-models/plugins/AuthLDAPOnly/MANIFEST	Sat Mar 17 15:23:02 2007
@@ -3,7 +3,7 @@
 lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogout.pm
 lib/Jifty/Plugin/AuthLDAPOnly/CurrentUser.pm
 lib/Jifty/Plugin/AuthLDAPOnly/Dispatcher.pm
-lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm
+lib/Jifty/Plugin/AuthLDAPOnly/Model/User.pm
 Makefile.PL
 MANIFEST
 share/po/en.po

Modified: jifty/branches/virtual-models/plugins/AuthLDAPOnly/debian/changelog
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthLDAPOnly/debian/changelog	(original)
+++ jifty/branches/virtual-models/plugins/AuthLDAPOnly/debian/changelog	Sat Mar 17 15:23:02 2007
@@ -1,3 +1,9 @@
+libjifty-plugin-authldaponly-perl (0-2) unstable; urgency=low
+
+  * Jifty::Record schema 
+
+ -- AGOSTINI Yves <agostini at univ-metz.fr>  Fri,  9 Mar 2007 15:31:57 +0100
+
 libjifty-plugin-authldaponly-perl (0-1) unstable; urgency=low
 
   * Initial Release.

Modified: jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm	(original)
+++ jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm	Sat Mar 17 15:23:02 2007
@@ -50,7 +50,7 @@
         $CurrentLDAPUserClass = $args{CurrentUserClass}
             || "${appname}::CurrentUser";
         $AuthLDAPUserClass = $args{AuthLDAPUserClass}
-            || "${appname}::Model::LDAPUser";
+            || "${appname}::Model::User";
 
     	$params{'Hostname'} = $args{LDAPhost};
     	$params{'base'} = $args{LDAPbase};

Copied: jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/User.pm (from r2852, /jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm)
==============================================================================
--- /jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm	(original)
+++ jifty/branches/virtual-models/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/User.pm	Sat Mar 17 15:23:02 2007
@@ -1,4 +1,4 @@
-package Jifty::Plugin::AuthLDAPOnly::Model::LDAPUser;
+package Jifty::Plugin::AuthLDAPOnly::Model::User;
 use base qw/Jifty::Record/;
 use Jifty::DBI::Schema;
 use Scalar::Defer;

Modified: jifty/branches/virtual-models/plugins/AuthzLDAP/lib/Jifty/Plugin/AuthzLDAP/Model/LDAPFilter.pm
==============================================================================
--- jifty/branches/virtual-models/plugins/AuthzLDAP/lib/Jifty/Plugin/AuthzLDAP/Model/LDAPFilter.pm	(original)
+++ jifty/branches/virtual-models/plugins/AuthzLDAP/lib/Jifty/Plugin/AuthzLDAP/Model/LDAPFilter.pm	Sat Mar 17 15:23:02 2007
@@ -1,7 +1,8 @@
-package Jifty::Plugin::AuthzLDAP::Model::LDAPFilter::Schema;
+package Jifty::Plugin::AuthzLDAP::Model::LDAPFilter;
 use Jifty::DBI::Schema;
 use Scalar::Defer;
 
+use Jifty::Record schema {
 column
   name => type is 'text',
   label is 'Name',
@@ -22,10 +23,7 @@
   is immutable,
   default is defer { DateTime->now },
   filters are 'Jifty::DBI::Filter::DateTime';
-
-
-package Jifty::Plugin::AuthzLDAP::Model::LDAPFilter;
-use base qw/Jifty::Record/;
+};
 
 sub create {
     my $self  = shift;

Modified: jifty/branches/virtual-models/plugins/Login/debian/changelog
==============================================================================
--- jifty/branches/virtual-models/plugins/Login/debian/changelog	(original)
+++ jifty/branches/virtual-models/plugins/Login/debian/changelog	Sat Mar 17 15:23:02 2007
@@ -1,3 +1,9 @@
+libjifty-plugin-login-perl (0.01-6) unstable; urgency=low
+
+  * Jifty::Record schema
+
+ -- AGOSTINI Yves <agostini at univ-metz.fr>  Fri,  9 Mar 2007 15:30:21 +0100
+
 libjifty-plugin-login-perl (0.01-3) unstable; urgency=low
 
   * Add dependencies, update fr po

Modified: jifty/branches/virtual-models/plugins/Login/debian/rules
==============================================================================
--- jifty/branches/virtual-models/plugins/Login/debian/rules	(original)
+++ jifty/branches/virtual-models/plugins/Login/debian/rules	Sat Mar 17 15:23:02 2007
@@ -45,7 +45,7 @@
 	dh_clean -k
 
 	# Add commands to install the package into debian/$PACKAGE_NAME here
-	$(MAKE) test
+	#$(MAKE) test
 	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
 
 	# As this is a architecture independent package, we are not

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/autohandler
==============================================================================
--- jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/autohandler	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/autohandler	Sat Mar 17 15:23:02 2007
@@ -5,6 +5,5 @@
     $m->redirect('/__jifty/error/permission_denied'); 
     $m->abort();
 }
-#$m->comp('_elements/nav');
 $m->call_next();
 </%init>

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/content.html
==============================================================================
--- jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/content.html	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/content.html	Sat Mar 17 15:23:02 2007
@@ -61,10 +61,3 @@
 $Target    => '&method=content'
 $n  => 'Jifty'
 </%ARGS>
-<%once>
-require File::Basename;
-require File::Find;
-require File::Temp;
-require File::Spec;
-require Pod::Simple::HTML;
-</%once>

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/toc.html
==============================================================================
--- jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/toc.html	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/OnlineDocs/web/templates/__jifty/online_docs/toc.html	Sat Mar 17 15:23:02 2007
@@ -78,13 +78,6 @@
 
 </%PERL>
 </body></html>
-<%INIT>
-require File::Basename;
-require File::Find;
-require File::Temp;
-require File::Spec;
-require Pod::Simple::HTML;
-</%INIT>
 <%ARGS>
 $n  => ''
 $method => ''

Modified: jifty/branches/virtual-models/share/web/static/css/base.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/base.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/base.css	Sat Mar 17 15:23:02 2007
@@ -65,7 +65,7 @@
 div.warning {
  position: absolute;
  top: 0;
- left: 0;
+ left: 50%;
  right: 0;
 
  background-color: red;

Modified: jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/etc/config.yml
==============================================================================
--- jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/etc/config.yml	(original)
+++ jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/etc/config.yml	Sat Mar 17 15:23:02 2007
@@ -16,9 +16,10 @@
   DevelMode: 1
   L10N: 
     PoDir: share/po
-  LogLevel: INFO
-  Mailer: Sendmail
-  MailerArgs: []
+  LogLevel: DEBUG
+  Mailer: IO
+  MailerArgs:
+    - %log/mail.log%
 
   Plugins: 
     - User: {}

Added: jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Bootstrap.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Bootstrap.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,23 @@
+use warnings;
+use strict;
+
+package TestApp::Plugin::PasswordAuth::Bootstrap;
+
+use base 'Jifty::Bootstrap';
+
+sub run {
+    my $curuser
+        = TestApp::Plugin::PasswordAuth::CurrentUser->new( _bootstrap => 1 );
+    my $user = TestApp::Plugin::PasswordAuth::Model::User->new(
+        current_user => $curuser );
+    my ( $val, $msg ) = $user->create(
+        email     => 'gooduser at example.com',
+        color        => 'gray',
+        swallow_type => 'african',
+        password     => 'secret'
+
+    );
+
+}
+
+1;

Added: jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Dispatcher.pm	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+package TestApp::Plugin::PasswordAuth::Dispatcher;
+use Jifty::Dispatcher -base;
+
+
+1;

Modified: jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Model/User.pm
==============================================================================
--- jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Model/User.pm	(original)
+++ jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/lib/TestApp/Plugin/PasswordAuth/Model/User.pm	Sat Mar 17 15:23:02 2007
@@ -10,10 +10,10 @@
 
 };
 
-use Jifty::Plugin::User::Model::User;
 use TestApp::Plugin::FavoriteColor;
 use TestApp::Plugin::FasterSwallow;
-use Jifty::Plugin::Authentication::Password::Model::User 'password_is';
+use Jifty::Plugin::User::Mixin::Model::User;
+use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
 
 # Your model-specific methods go here.
 

Modified: jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t
==============================================================================
--- jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t	(original)
+++ jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t	Sat Mar 17 15:23:02 2007
@@ -22,7 +22,7 @@
 # Try testing a create
 my $o = TestApp::Plugin::PasswordAuth::Model::User->new(current_user => $system_user);
 my ($id) = $o->create( name => 'jesse',
-                       username => 'jrv',
+                       email => 'jrv',
                        color => 'gray',
                        swallow_type => 'african',
                        password => 'secret');
@@ -42,7 +42,7 @@
 
 my $p = TestApp::Plugin::PasswordAuth::Model::User->new(current_user => $system_user);
  ($id) = $p->create( name => 'jesse2',
-                       username => 'jrv2',
+                       email => 'jrv2',
                        color => 'blue',
                        swallow_type => 'african',
                        password => 'secret');
@@ -50,7 +50,7 @@
 
 my $q = TestApp::Plugin::PasswordAuth::Model::User->new(current_user => $system_user);
 ($id) = $p->create( name => 'jesse2',
-                       username => 'jrv2',
+                       email => 'jrv2',
                        color => 'gray',
                        swallow_type => 'european',
                        password => 'secret');
@@ -58,7 +58,7 @@
 
 my $r = TestApp::Plugin::PasswordAuth::Model::User->new(current_user => $system_user);
  ($id) = $r->create( name => 'jesse2',
-                       username => 'jrv2',
+                       email => 'jrv2',
                        color => 'grey',
                        swallow_type => 'african',
                        password => 'secret');

Added: jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,46 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+This is a template for your own tests. Copy it and modify it.
+
+=cut
+
+
+use lib 't/lib';
+use Jifty::SubTest;
+
+use Jifty::Test tests => 6;
+use Jifty::Test::WWW::Mechanize;
+
+my $server  = Jifty::Test->make_server;
+
+isa_ok($server, 'Jifty::Server');
+
+my $URL     = $server->started_ok;
+my $mech    = Jifty::Test::WWW::Mechanize->new();
+ok(1, "Loaded the test script");
+
+# {{{ Get token for logging in with a JS-based md5-hashed password
+my $service='/__jifty/webservices/yaml';
+my $service_request ="$URL$service?J:A-moniker=GeneratePasswordToken&J:A:F-email-moniker=gooduser\@example.com"; 
+$mech->get_ok($service_request, "Token-generating webservice $service_request exists");
+
+# XXX needs to be more precise in checking for the token, but this works
+# as long as we're using time() for the token
+$mech->content_like(qr/\d+/);
+
+use Jifty::YAML;
+my $data = Jifty::YAML::Load($mech->content);
+
+my $token = $data->{'moniker'}->{'_content'}->{'token'};
+my $salt = $data->{'moniker'}->{'_content'}->{'salt'};
+like($salt, qr/^[0-9A-F]{8}$/i, 'Got a salt');
+
+1;
+
+
+

Modified: jifty/branches/virtual-models/t/TestApp/lib/TestApp/Model/User.pm
==============================================================================
--- jifty/branches/virtual-models/t/TestApp/lib/TestApp/Model/User.pm	(original)
+++ jifty/branches/virtual-models/t/TestApp/lib/TestApp/Model/User.pm	Sat Mar 17 15:23:02 2007
@@ -10,6 +10,8 @@
 use Jifty::Record schema  {
 column 'name' =>
   type is 'text',
+  label is _('Name'),
+  hints is _('I18N test'),
   is mandatory;
 column 'email' =>
   type is 'text',

Modified: jifty/branches/virtual-models/t/TestApp/lib/TestApp/View.pm
==============================================================================
--- jifty/branches/virtual-models/t/TestApp/lib/TestApp/View.pm	(original)
+++ jifty/branches/virtual-models/t/TestApp/lib/TestApp/View.pm	Sat Mar 17 15:23:02 2007
@@ -4,17 +4,35 @@
 
 use Jifty::View::Declare -base;
 
-template 'concrete2.html' => sub  {
-   html {
-   body {
-    h1 { _( 'I have %1 concrete mixers', 2) };
-    }
-    }
+template 'concrete2.html' => sub {
+    html {
+        body {
+            h1 { _( 'I have %1 concrete mixers', 2 ) };
+        };
+    };
 };
 
-
 template 'die.html' => sub {
     die "this is an error";
 };
 
+# The following templates are used to test the precedence of T::D over Mason and
+# also that '/index.html' is only added to the path if the given path does not
+# match.
+template '/path_test/foo' => sub {
+    outs('/path_test/foo - T::D');
+};
+
+template '/path_test/bar/index.html' => sub {
+    outs('/path_test/bar/index.html - T::D');
+};
+
+template '/path_test/in_both' => sub {
+    outs('/path_test/in_both - T::D');
+};
+
+template '/path_test/td_only' => sub {
+    outs('/path_test/td_only - T::D');
+};
+
 1;

Added: jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/foo/index.html
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/foo/index.html	Sat Mar 17 15:23:02 2007
@@ -0,0 +1 @@
+/path_test/foo/index.html - Mason

Added: jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/in_both
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/in_both	Sat Mar 17 15:23:02 2007
@@ -0,0 +1 @@
+/path_test/in_both - Mason

Added: jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/mason_only
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp/share/web/templates/path_test/mason_only	Sat Mar 17 15:23:02 2007
@@ -0,0 +1 @@
+/path_test/mason_only - Mason
\ No newline at end of file

Added: jifty/branches/virtual-models/t/TestApp/t/14-template-paths.t
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp/t/14-template-paths.t	Sat Mar 17 15:23:02 2007
@@ -0,0 +1,56 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+use lib 't/lib';
+use Jifty::SubTest;
+
+use Jifty::Test;
+use Jifty::Test::WWW::Mechanize;
+
+my @tests = (
+    {
+        url  => "/path_test/foo",
+        text => '/path_test/foo - T::D',
+    },
+    {
+        url  => "/path_test/foo/",
+        text => '/path_test/foo - T::D',
+    },
+    {
+        url  => "/path_test/foo/index.html",
+        text => '/path_test/foo/index.html - Mason',
+    },
+    {
+        url  => "/path_test/bar",
+        text => '/path_test/bar/index.html - T::D',
+    },
+    {
+        url  => "/path_test/bar/index.html",
+        text => '/path_test/bar/index.html - T::D',
+    },
+    {
+        url  => "/path_test/in_both",
+        text => '/path_test/in_both - T::D',
+    },
+    {
+        url  => "/path_test/mason_only",
+        text => '/path_test/mason_only - Mason',
+    },
+    {
+        url  => "/path_test/td_only",
+        text => '/path_test/td_only - T::D',
+    },
+);
+
+plan tests => 2 + scalar(@tests) * 2;
+
+my $server = Jifty::Test->make_server;
+isa_ok( $server, 'Jifty::Server' );
+my $URL = $server->started_ok;
+
+my $mech = Jifty::Test::WWW::Mechanize->new;
+foreach my $test (@tests) {
+    $mech->get_ok( $URL . $test->{url}, "get '$URL$test->{url}'" );
+    $mech->content_contains( $test->{text}, "found content '$test->{text}'" );
+}


More information about the Jifty-commit mailing list