Modify

Opened 15 years ago

Closed 10 years ago

#6241 closed enhancement (worksforme)

Support TraM

Reported by: okamototk Owned by: osimons
Priority: normal Component: CustomFieldAdminPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Hi,

CustomFieldAdminPlugin had a problem with with TraM plugin which support multi project in Trac. With TraM, it custom field was not change immediate in admin panel.

The solution is reset custom_fields cache when display custom_fields. Please apply following patch:

Index: customfieldadmin/api.py
===================================================================
--- customfieldadmin/api.py     (revision 7160)
+++ customfieldadmin/api.py     (working copy)
@@ -36,10 +36,13 @@
         """ Returns the custom fields from TicketSystem component.
         Use a cfdict with 'name' key set to find a specific custom field only
         """
+        ts = TicketSystem(env.compmgr)
+        ts._custom_fields = None
+
         if not customfield:    # return full list
-            return TicketSystem(env.compmgr).get_custom_fields()
+            return ts.get_custom_fields()
         else:                  # only return specific item with cfname
-            all = TicketSystem(env.compmgr).get_custom_fields()
+            all = ts.get_custom_fields()
             for item in all:
                 if item['name'] == customfield['name']:
                     return item

best regards,

Takashi Okamoto

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by osimons

Whenever a field changes (new, update, delete), the trac.ini file is updated. And when trac.ini timestamp changes, Trac will reload the environment fetching all fresh code components (instances) for use. This is checked by Trac for every request. Resetting the cache explicitly should never really be needed.

If TraM needs it, then that suggests some larger problem with that plugin or its configuration. I don't know the plugin, what it does and how it does it, but I'm hesitant about adding workaround code for such a plugin to my code - no matter how trivial the change may look.

comment:2 Changed 10 years ago by Ryan J Ollos

Resolution: worksforme
Status: newclosed

Seems reasonable to close it as worksforme then.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.