Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: devel

autocomplete_categories.html bug ?

 

 

Bricolage devel RSS feed   Index | Next | Previous | View Threaded


rs at plusw

Mar 19, 2009, 1:40 PM

Post #1 of 8 (1793 views)
Permalink
autocomplete_categories.html bug ?

Im running a system with bric 1.11.1 with multiple sites installed

my autocomplete_categories.html is rev 8288
and I got the error Too many Bric::Biz::Categories found.

After replacing the line

my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri });
with
my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri, ($site_id ? (site_id => $site_id) : () ) });

it worked well.

Now I've seen that in the svn the current code looks like :


==== snip

if ( FULL_SEARCH ) {
@categories = Bric::Biz::Category->list({
uri => "%" . $new_category_autocomplete . "%",
site_id => $site_id || $story->get_site_id,
});
} else {
my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri });
.....
}

===== /snip
checked this out and with FULL_SEARCH disabled the same error
happes again (if you have more than one site ).


So am I missing something or is this a bug ?


Rolf Schaufelberger
rs at plusw.de


david at kineticode

Mar 19, 2009, 9:28 PM

Post #2 of 8 (1680 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

On Mar 19, 2009, at 1:40 PM, Rolf Schaufelberger wrote:

> if ( FULL_SEARCH ) {
> @categories = Bric::Biz::Category->list({
> uri => "%" . $new_category_autocomplete . "%",
> site_id => $site_id || $story->get_site_id,
> });
> } else {
> my $parent_cat = Bric::Biz::Category->lookup({ uri =>
> $parent_cat_uri });
> .....
> }
>
> ===== /snip
> checked this out and with FULL_SEARCH disabled the same error
> happes again (if you have more than one site ).
>
>
> So am I missing something or is this a bug ?

Hrm. It should not happen, but I've seen it myself. Anyone know what
the proper fix it?

Best,

David


rs at plusw

Mar 20, 2009, 7:29 AM

Post #3 of 8 (1669 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

> On Mar 19, 2009, at 1:40 PM, Rolf Schaufelberger wrote:
>
> > if ( FULL_SEARCH ) {
> > @categories = Bric::Biz::Category->list({
> > uri => "%" . $new_category_autocomplete . "%",
> > site_id => $site_id || $story->get_site_id,
> > });
> > } else {
> > my $parent_cat = Bric::Biz::Category->lookup({ uri =>
> > $parent_cat_uri });
> > .....
> > }
> >
> > ===== /snip
> > checked this out and with FULL_SEARCH disabled the same error
> > happes again (if you have more than one site ).
> >
> >
> > So am I missing something or is this a bug ?
>
> Hrm. It should not happen, but I've seen it myself. Anyone know what
> the proper fix it?
>
> Best,
>
> David

If you have several sites it's obvious to me that lookup fails
because it returns
more than 1 result as long as you have the same category name in
different sites ( and each site has a root category '/' ..) .
I just don't understand, why the site_id parameter is not passed to
lookup ?


Rolf


david at kineticode

Mar 20, 2009, 7:49 AM

Post #4 of 8 (1664 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

On Mar 20, 2009, at 7:29 AM, Rolf Schaufelberger wrote:

> If you have several sites it's obvious to me that lookup fails
> because it returns
> more than 1 result as long as you have the same category name in
> different sites ( and each site has a root category '/' ..) .
> I just don't understand, why the site_id parameter is not passed to
> lookup ?

Clearly it should be. If you make sure it's always passed, does the
error go away for you?

Thanks,

David


paulo at digitalcraftsmen

Mar 20, 2009, 8:04 AM

Post #5 of 8 (1669 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

Rolf Schaufelberger wrote:

> I just don't understand, why the site_id parameter is not passed to
> lookup ?

Because you're right and it is a bug and it should be being passed ?

Does this patch fix your issue ?

===================================================================
--- comp/widgets/story_prof/autocomplete_categories.html (revision 8514)
+++ comp/widgets/story_prof/autocomplete_categories.html (working copy)
@@ -20,7 +20,10 @@
site_id => $site_id || $story->get_site_id,
});
} else {
- my $parent_cat = Bric::Biz::Category->lookup({ uri => $parent_cat_uri });
+ ( my $parent_cat ) = Bric::Biz::Category->list({
+ uri => $parent_cat_uri });
+ site_id => $site_id || $story->get_site_id,
+ });

regards,

Paul

--
Paul Orrock Digital Craftsmen
Lead SysAdmin www.digitalcraftsmen.net
Exmouth House, 3 Pine Street, London, EC1R 0JH
Tel: 020 7183 1410 Fax: 020 7099 5140


rs at plusw

Mar 20, 2009, 8:38 AM

Post #6 of 8 (1663 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

Yes,
changing line 23 of r8386 to

} else {
my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri,
site_id => $site_id
|| $story->get_site_id,});


works . Tested in creating a new story and in story edit when adding
another category.

Am 20.03.2009 um 15:49 schrieb David E. Wheeler:

> On Mar 20, 2009, at 7:29 AM, Rolf Schaufelberger wrote:
>
>> If you have several sites it's obvious to me that lookup fails
>> because it returns
>> more than 1 result as long as you have the same category name in
>> different sites ( and each site has a root category '/' ..) .
>> I just don't understand, why the site_id parameter is not passed to
>> lookup ?
>
> Clearly it should be. If you make sure it's always passed, does the
> error go away for you?
>
> Thanks,
>
> David
>

Rolf Schaufelberger


rs at plusw

Mar 20, 2009, 8:39 AM

Post #7 of 8 (1657 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

Yep, just see my reply to david

Am 20.03.2009 um 16:04 schrieb Paul Orrock:

>
>
> Rolf Schaufelberger wrote:
>
>> I just don't understand, why the site_id parameter is not passed
>> to lookup ?
>
> Because you're right and it is a bug and it should be being passed ?
>
> Does this patch fix your issue ?
>
> ===================================================================
> --- comp/widgets/story_prof/autocomplete_categories.html (revision
> 8514)
> +++ comp/widgets/story_prof/autocomplete_categories.html (working
> copy)
> @@ -20,7 +20,10 @@
> site_id => $site_id || $story->get_site_id,
> });
> } else {
> - my $parent_cat = Bric::Biz::Category->lookup({ uri =>
> $parent_cat_uri });
> + ( my $parent_cat ) = Bric::Biz::Category->list({
> + uri => $parent_cat_uri });
> + site_id => $site_id || $story->get_site_id,
> + });
>
> regards,
>
> Paul
>
> --
> Paul Orrock Digital Craftsmen
> Lead SysAdmin www.digitalcraftsmen.net
> Exmouth House, 3 Pine Street, London, EC1R 0JH
> Tel: 020 7183 1410 Fax: 020 7099 5140

Mt freundlchen Grüßen
Rolf Schaufelberger

plusW GmbH
Stuttgarter Str. 26 Tel. 07183 30 21 36
73635 Rudersberg Fax 07183 30 21 85

www.plusw.de
www.mypixler.com
www.calendrino.de


paulo at digitalcraftsmen

Mar 20, 2009, 8:56 AM

Post #8 of 8 (1659 views)
Permalink
Re: autocomplete_categories.html bug ? [In reply to]

Committed in rev 8515

regards,

Paul

Rolf Schaufelberger wrote:
> Yep, just see my reply to david
>
> Am 20.03.2009 um 16:04 schrieb Paul Orrock:
>
>>
>>
>> Rolf Schaufelberger wrote:
>>
>>> I just don't understand, why the site_id parameter is not passed to
>>> lookup ?
>>
>> Because you're right and it is a bug and it should be being passed ?
>>
>> Does this patch fix your issue ?
>>
>> ===================================================================
>> --- comp/widgets/story_prof/autocomplete_categories.html (revision
>> 8514)
>> +++ comp/widgets/story_prof/autocomplete_categories.html (working
>> copy)
>> @@ -20,7 +20,10 @@
>> site_id => $site_id || $story->get_site_id,
>> });
>> } else {
>> - my $parent_cat = Bric::Biz::Category->lookup({ uri =>
>> $parent_cat_uri });
>> + ( my $parent_cat ) = Bric::Biz::Category->list({
>> + uri => $parent_cat_uri });
>> + site_id => $site_id || $story->get_site_id,
>> + });
>>
>> regards,
>>
>> Paul
>>
>> --
>> Paul Orrock Digital Craftsmen
>> Lead SysAdmin www.digitalcraftsmen.net
>> Exmouth House, 3 Pine Street, London, EC1R 0JH
>> Tel: 020 7183 1410 Fax: 020 7099 5140
>
> Mt freundlchen Grüßen
> Rolf Schaufelberger
>
> plusW GmbH
> Stuttgarter Str. 26 Tel. 07183 30 21 36
> 73635 Rudersberg Fax 07183 30 21 85
>
> www.plusw.de
> www.mypixler.com
> www.calendrino.de
>
>
>
>

--
Paul Orrock Digital Craftsmen
Lead SysAdmin www.digitalcraftsmen.net
Exmouth House, 3 Pine Street, London, EC1R 0JH
Tel: 020 7183 1410 Fax: 020 7099 5140

Bricolage devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.