Commit 642e98e1 authored by Xavier Guimard's avatar Xavier Guimard

Fix some missing "lazy" (#1545)

parent 69cdd664
......@@ -11,8 +11,9 @@ has p => ( is => 'rw', weak_ref => 1 );
# Lemonldap::NG configuration hash ref
has conf => ( is => 'rw', weak_ref => 1 );
has logger => ( is => 'rw', default => sub { $_[0]->{p}->logger } );
has userLogger => ( is => 'rw', default => sub { $_[0]->{p}->userLogger } );
has logger => ( is => 'rw', lazy => 1, default => sub { $_[0]->{p}->logger } );
has userLogger =>
( is => 'rw', lazy => 1, default => sub { $_[0]->{p}->userLogger } );
sub error {
my $self = shift;
......
......@@ -22,6 +22,7 @@ sub import {
has dbiTable => (
is => 'ro',
lazy => 1,
default => sub { $_[0]->{table} || 'notifications' }
);
......@@ -32,6 +33,7 @@ has dbiChain => (
has dbiUser => (
is => 'ro',
lazy => 1,
default => sub {
$_[0]->{p}->logger->warn('Warning: "dbiUser" parameter is not set');
return '';
......@@ -64,7 +66,9 @@ sub get {
my ( $self, $uid, $ref ) = @_;
return () unless ($uid);
$self->_execute(
"SELECT * FROM $self->{dbiTable} WHERE done IS NULL AND uid=?"
"SELECT * FROM "
. $self->dbiTable
. " WHERE done IS NULL AND uid=?"
. ( $ref ? " AND ref=?" : '' )
. "ORDER BY date",
$uid,
......
......@@ -38,6 +38,7 @@ has ldapConfBase => (
has ldapBindDN => (
is => 'ro',
lazy => 1,
default => sub {
$_[0]->p->logger->warn('Warning: "ldapBindDN" parameter is not set');
return '';
......
......@@ -34,6 +34,7 @@ has sfReq => ( is => 'rw' );
has ott => (
is => 'rw',
lazy => 1,
default => sub {
my $ott =
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
......
......@@ -21,7 +21,7 @@ has wrapUserLogger => (
lazy => 1,
default => sub {
Lemonldap::NG::Portal::Lib::Combination::UserLogger->new(
$_[0]->{userLogger} );
$_[0]->userLogger );
}
);
......
......@@ -18,6 +18,7 @@ extends 'Lemonldap::NG::Portal::Main::Plugin';
has ott => (
is => 'rw',
lazy => 1,
default => sub {
my $ott =
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
......
......@@ -498,6 +498,7 @@ has p => ( is => 'rw' );
has ini => (
is => 'rw',
lazy => 1,
default => sub { $defaultIni; },
trigger => sub {
my ( $self, $ini ) = @_;
......@@ -626,7 +627,7 @@ sub _get {
: ()
),
'REQUEST_METHOD' => $args{method} || 'GET',
'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
( $args{query} ? ( QUERY_STRING => $args{query} ) : () ),
'SCRIPT_NAME' => '',
'SERVER_NAME' => 'auth.example.com',
......@@ -678,10 +679,10 @@ sub _post {
: ()
),
'REQUEST_METHOD' => $args{method} || 'POST',
'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
'SCRIPT_NAME' => '',
'SERVER_NAME' => 'auth.example.com',
'SERVER_PORT' => '80',
'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
'SCRIPT_NAME' => '',
'SERVER_NAME' => 'auth.example.com',
'SERVER_PORT' => '80',
'SERVER_PROTOCOL' => 'HTTP/1.1',
( $args{custom} ? %{ $args{custom} } : () ),
'psgix.input.buffered' => 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment