From ed58eba697e9bb593fa2fe8189a197538a25cef3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 3 Mar 2010 19:48:32 -0800 Subject: [PATCH] More instanciator cleanup in Asset.pm --- lib/WebGUI/Asset.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 865d0e668..69f1c86b1 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -2066,7 +2066,7 @@ asset open in a new window. sub prepareWidgetView { my $self = shift; my $templateId = shift; - my $template = WebGUI::Asset::Template->new($self->session, $templateId); + my $template = WebGUI::Asset::Template->newById($self->session, $templateId); my $extras = $self->session->config->get('extrasURL'); $template->prepare; @@ -2469,7 +2469,7 @@ sub www_add { return undef unless (defined $class); return $self->session->privilege->insufficient() unless ($class->canAdd($self->session)); if ($self->session->form->process('prototype')) { - my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class); + my $prototype = WebGUI::Asset->newById($self->session, $self->session->form->process("prototype")); foreach my $property ($prototype->getProperties) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab my $definition = $prototype->getProperty($property); next if (isIn($property,qw(title menuTitle url isPrototype isPackage))); @@ -2551,8 +2551,8 @@ sub www_changeUrlConfirm { $self->update({url=>$self->session->form->process("url","text")}); my $rs = $self->session->db->read("select revisionDate from assetData where assetId=? and revisionDate<>?",[$self->getId, $self->get("revisionDate")]); while (my ($version) = $rs->array) { - my $old = WebGUI::Asset->new($self->session, $self->getId, $self->get("className"), $version); - $old->purgeRevision if defined $old; + my $old = eval { WebGUI::Asset->newById($self->session, $self->getId, $version); }; + $old->purgeRevision if ! Exception::Class->caught(); } }