Forum OpenACS Development: Re: new vers of acs_object__name(object_id)

Collapse
Posted by Jim Lynch on
Gustaf,

This is a bug report with a suggested fix. The bug is, acs_object__name() returns a string from acs_objecs.title that looks like (pound sign)acs-translations.group_title_2702(pound sign), which gets looked up. The value it returns (from the table lang_messages) is blank, so that's what the old version of acs_object__name() returns. The "Recently..." comment refers to that change, which may not be complete.

To shed light on the problem, try this:

  • Create an application_group,
  • Find its object_id,
  • In psql, run: select title from acs_objects where object_id = theGroupId;
  • Still in psql, run: select acs_object__name(theGroupID);
  • Still psql, run select message from lang_messages where psckage_key = 'acs-translations' and message_key = 'group_title_(theGroupID)';
  • You should notice that the result of this query is either blank or null, and is why blank is displayed when group names are displayed.
My intent for my change to acs_object__name() is to fix the blank-group-name problem and be sufficiently nonintrusive so that (1) I'm avoiding interfering with the developer who started this change, and (2) acs_object__name() should work whether he completes his work or not.

-Jim

Collapse
Posted by Gustaf Neumann on
Jim,

the best place for bug reports is the bug tracker. The result below looks ok to me.

Do you get different results for acs_object__name()? I still don't see the connection with acs-translations.

-g

openacs.org=# select object_id, title from acs_objects where object_type = 'application_group';
 object_id |           title            
-----------+----------------------------
      3830 | Main Site Parties
     44322 | OpenACS Parties
     46079 | demo Parties
     46194 | Test Subsite Parties
     46238 | Projects Parties
     46273 | OpenACS Subsite Parties
     47519 | dotWRK Parties
     57366 | dotLRN Parties
    128847 | OpenACS Governance Parties
    179469 | CVS Committers
(10 rows)

openacs.org=# select acs_object__name(3830);
 acs_object__name  
-------------------
 Main Site Parties
(1 row)

openacs.org=# select message from lang_messages where package_key = 'acs-translations';
 message 
---------
(0 rows)
Collapse
Posted by Jim Lynch on
Gustaf,

You're right, the titles look good, and, those groups have been around on openacs.org ro maybe 10 or 20 years.

What do you find on a group created today or so?

-Jim

Collapse
Posted by Gustaf Neumann on
Applications groups created today don't look different. Today in ds/shell:
application_group::new -group_name foo
in psql
openacs.org=# select object_id, title, creation_date from acs_objects where object_type = 'application_group';
 object_id |           title            |         creation_date         
-----------+----------------------------+-------------------------------
      3830 | Main Site Parties          | 2002-07-11 22:08:20+02
     44322 | OpenACS Parties            | 2002-08-12 21:20:32+02
     46079 | demo Parties               | 2002-08-13 20:47:17+02
     46194 | Test Subsite Parties       | 2002-08-20 21:44:29+02
     46238 | Projects Parties           | 2002-08-20 21:48:27+02
     46273 | OpenACS Subsite Parties    | 2002-08-20 21:52:09+02
     47519 | dotWRK Parties             | 2002-09-23 23:10:55+02
     57366 | dotLRN Parties             | 2002-10-31 17:21:02+01
    128847 | OpenACS Governance Parties | 2003-09-28 20:15:03.255242+02
    179469 | CVS Committers             | 2004-05-04 10:52:55.872763+02
   4216650 | foo                        | 2015-01-02 09:06:42.58954+01
(11 rows)

openacs.org=# select acs_object__name(4216650);
 acs_object__name 
------------------
 foo
(1 row)
Do you get different results?

-g

Collapse
Posted by Jim Lynch on
sorry for delay... I have some results to show you, but first do you happen to know the &#...; for #?

-Jim


Collapse
Posted by Benjamin Brink on
stackoverflow.com/questions/3025171/whats-the-html-character-entity-for-the-sign
Collapse
Posted by Jim Lynch on

Hi, here are the results...

using this query:


        select 
            o.object_type, 
            o.creation_date::date, 
            o.title
        from 
            acs_objects o,
            lang_messages m,
            (select object_id, regexp_matches(title, '#([^.#]*).([^.#]*)#') as matcha from acs_objects) r
        where 
            o.object_id = r.object_id
          and
            r.matcha[1] = m.package_key
          and
            r.matcha[2] = m.message_key
          and
            (m.message is null or m.message = '')
        order by 
            o.title;
I get:

    object_type    | creation_date |                title                
-------------------+---------------+-------------------------------------
 application_group | 2014-02-05    | #acs-translations.group_title_1727#
 application_group | 2014-02-23    | #acs-translations.group_title_1958#
 application_group | 2014-12-22    | #acs-translations.group_title_2702#
(3 rows)
without the \ char at the start of the title field.

Collapse
Posted by Jim Lynch on
without the r and lang_message NULL or '', I get 70 rows.