Modify

Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#11066 closed defect (worksforme)

MultiSelectFieldPlugin shows text but not options.

Reported by: William.Greenwaldt@… Owned by: ollika
Priority: normal Component: MultiSelectFieldPlugin
Severity: normal Keywords: MultiSelect installation
Cc: Trac Release: 1.0

Description (last modified by rjollos)

I have installed the MSFP and get feedback that it is loading and is in the list of plugins via Admin >> General >> Plugins. When I go to New Ticket, the field presents as text and does not provide the options.

Feedback from trac.log that it is loading:

2013-05-09 09:42:59,220 Trac[loader] DEBUG: Loading multiselectfield.filter from c:\bitnami\tracstack\python\lib\site-packages\tracmultiselectfield-1.0.0-py2.7.egg
2013-05-09 09:43:18,549 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/multiselectfield/chosen.css'">
2013-05-09 09:43:19,282 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/multiselectfield/chosen.jquery.min.js'">
2013-05-09 09:43:19,282 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/multiselectfield/multiselectfield.js'">

The output of trac-admin for the ticket-custom widget that I created name platform:

Trac [C:\Trac\Projects\G9]> config get ticket-custom platform
text
platform.label = Platform:
platform.format = list
platform.multiselect = true
platform.options= DL380G8|DL580G9|DL3680G9
platform.order = 1

I think it is apparent by it showing in plugins, but I have enabled the plugin in trac.ini [components] with this entry:

multiselectfield.* = enabled

What other things can I review for why this doesn't present my list of values?

Thanks in advance. Bill

Attachments (11)

AboutPage.png (16.5 KB) - added by rjollos 16 months ago.
TickCust.png (9.5 KB) - added by anonymous 16 months ago.
TicketCustomProper.png (25.3 KB) - added by rjollos 16 months ago.
TicketCustomImproper.png (20.3 KB) - added by rjollos 16 months ago.
PlatformOptions.png (1.5 KB) - added by anonymous 16 months ago.
Env_MSFP.png (13.7 KB) - added by anonymous 16 months ago.
Multi_ScriptError.png (5.7 KB) - added by anonymous 16 months ago.
Multi_JS.png (3.6 KB) - added by anonymous 16 months ago.
PlatformOptions.2.png (1.5 KB) - added by anonymous 16 months ago.
Multi_Platforms.png (1.5 KB) - added by anonymous 16 months ago.
Multi_Platform_Selected.png (2.0 KB) - added by anonymous 16 months ago.

Download all attachments as: .zip

Change History (38)

comment:1 Changed 16 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 16 months ago by rjollos

  • Description modified (diff)

comment:3 follow-up: Changed 16 months ago by rjollos

I tried formatting your description to better understand what you are seeing. Does it look correct now?

In your trac.ini ticket-custom section, do you have?:

platform.label = Platform:
platform.format = list
platform.multiselect = true
platform.options= DL380G8|DL580G9|DL3680G9
platform.order = 1

OR

platform = text
platform.label = Platform:
platform.format = list
platform.multiselect = true
platform.options= DL380G8|DL580G9|DL3680G9
platform.order = 1

The latter works for me, and I also see:

(th6061)user@ubuntu:~/Workspace/th6061$ trac-admin tracdev config get ticket-custom platform
text

However, if I omit the line platform = text, it doesn't work.

comment:4 Changed 16 months ago by rjollos

I'd also suggest checking your JavaScript error console to see if there are any errors, and inspect your page source to check that you have:

<script type="text/javascript" charset="utf-8" src="/tracdev/chrome/multiselectfield/chosen.jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/tracdev/chrome/multiselectfield/multiselectfield.js"></script>

and,

<select class="multiselect" style="width:200px;" multiple="multiple">
  <option>DL380G8</option>
  <option>DL580G9</option>
  <option>DL3680G9</option>
</select>

It is possible that there is a conflict with another plugin, but it also sounds like perhaps ITemplateStreamFilter.filter_stream is not working correctly in your instance.

Do you have any other plugins installed?

comment:5 in reply to: ↑ 3 ; follow-ups: Changed 16 months ago by anonymous

Replying to rjollos:

I tried formatting your description to better understand what you are seeing. Does it look correct now?

In your trac.ini ticket-custom section, do you have?:

platform.label = Platform:
platform.format = list
platform.multiselect = true
platform.options= DL380G8|DL580G9|DL3680G9
platform.order = 1

OR

platform = text
platform.label = Platform:
platform.format = list
platform.multiselect = true
platform.options= DL380G8|DL580G9|DL3680G9
platform.order = 1

The latter works for me, and I also see:

(th6061)user@ubuntu:~/Workspace/th6061$ trac-admin tracdev config get ticket-custom platform
text

However, if I omit the line platform = text, it doesn't work.

It presents far better with your formatting. Thanks. The only exception would be to remove the CRLF after text. It is the later. The return of the trac-admin command begins with which is the widget type. I have attempted to name the component to tracmultiselectfield and tried to create a .pth file to the location of the egg, as well as trying to move chosen.css and the other items in the htdocs within the download to my chrome path. I fear some of this may not be in a proper location but I am getting HTTP 304 vice 400 class HTTP returns. I also added a directive to my trac.conf to the explicit path of the multiselect htdocs folder.

comment:6 Changed 16 months ago by anonymous

I have the two original Trac 1.0.1 and tracaccountmanager 0.3.2, and my efforts added tracmultiselectfield 1.0.0. When I reviewed source and searched for the token <multi> I did not find entries. I am running IE10 and via the F12 option >> CSS tab, I do not see chosen.css.

comment:7 Changed 16 months ago by rjollos

I'm not sure what happened with comment:5 here as well, but it was all messed up as well. I attempted to edit it to clean it up.

comment:8 in reply to: ↑ 5 ; follow-up: Changed 16 months ago by rjollos

Replying to anonymous:

The only exception would be to remove the CRLF after text.

Are you saying that you don't have linebreaks between the options in your trac.ini configuration? That might be a problem.

With the log level set to debug and navigating to the New Ticket page, I see in the logs (t:TracLogging):

05:32:32 PM Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/newticket'">
...
05:32:33 PM Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/multiselectfield/chosen.css'">
...
127.0.0.1 - - [09/May/2013 17:32:33] "GET /tracdev/chrome/multiselectfield/chosen.css ...
05:32:33 PM Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/multiselectfield/chosen.jquery.min.js'">
...
127.0.0.1 - - [09/May/2013 17:32:33] "GET /tracdev/chrome/multiselectfield/chosen.jquery.min.js HTTP/1.1" 304 -
...
05:32:33 PM Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/multiselectfield/multiselectfield.js'">
...
/tracdev/chrome/multiselectfield/multiselectfield.js HTTP/1.1" 304 -
...
127.0.0.1 - - [09/May/2013 17:32:33] "GET /tracdev/chrome/site/your_project_logo.png HTTP/1.1" 404 -

Which looks to be the same as what you get.

Maybe this is a webserver configuration issue? Or you need to trac-admin $TRACENV deploy (as described in t:TracFaq#Q:Tracaboutsays1.0butthestylelookspre-1.0)?

comment:9 in reply to: ↑ 8 Changed 16 months ago by rjollos

Replying to rjollos:

... Or you need to trac-admin $TRACENV deploy (as described in t:TracFaq#Q:Tracaboutsays1.0butthestylelookspre-1.0)?

Here's a better link for info on that: t:TracUpgrade#a5.Refreshstaticresources.

comment:10 in reply to: ↑ 5 ; follow-up: Changed 16 months ago by rjollos

Replying to anonymous:

I have attempted to name the component to tracmultiselectfield and tried to create a .pth file to the location of the egg, as well as trying to move chosen.css and the other items in the htdocs within the download to my chrome path. I fear some of this may not be in a proper location but I am getting HTTP 304 vice 400 class HTTP returns. I also added a directive to my trac.conf to the explicit path of the multiselect htdocs folder.

If you can't successfully navigate to and download http://yourhost/chrome/multiselectfield/chosen.css, and similarly for the other files that are served, then I think we have narrowed the problem to either a webserver configuration or static deployment of the files.

Since the egg is loading, I don't think you need to worry about messing with the python file. Further, you shouldn't need to set any options in trac.ini or move/rename the resources if the plugin has installed correctly (which I think we can be fairly certain of) and your webserver is properly configured to serve the files. Let's focus on the latter.

comment:11 in reply to: ↑ 10 ; follow-up: Changed 16 months ago by william.greenwaldt@…

  • Keywords MultiSelect added; MultSelect removed

Replying to rjollos:

Replying to anonymous:

I have attempted to name the component to tracmultiselectfield and tried to create a .pth file to the location of the egg, as well as trying to move chosen.css and the other items in the htdocs within the download to my chrome path. I fear some of this may not be in a proper location but I am getting HTTP 304 vice 400 class HTTP returns. I also added a directive to my trac.conf to the explicit path of the multiselect htdocs folder.

If you can't successfully navigate to and download http://yourhost/chrome/multiselectfield/chosen.css, and similarly for the other files that are served, then I think we have narrowed the problem to either a webserver configuration or static deployment of the files.

Since the egg is loading, I don't think you need to worry about messing with the python file. Further, you shouldn't need to set any options in trac.ini or move/rename the resources if the plugin has installed correctly (which I think we can be fairly certain of) and your webserver is properly configured to serve the files. Let's focus on the latter.

Regarding:

Are you saying that you don't have linebreaks between the options in your
trac.ini configuration? That might be a problem.

It has them but when viewing in Notepad they don't appear, my presumption was due to the utf-8 encoding. This is representative of the first field of the original that I preserved prior to modification:

# -*- coding: utf-8 -*-
[account-manager]
account_changes_notify_addresses=
password_format=htpasswd
password_store=HtPasswdStore
password_file=C:\BitNami\TracStack\apps\trac/users/htpasswd
[attachment]

Once the file is parsed this is all represented to a single blob. Like this:

# -*- coding: utf-8 -*-[account-manager]account_changes_notify_addresses = William.Greenwaldt@hp.com

I found that I had to be cautious of the white space and edit this file by trac-admin or to be aware of the CR LF characters in the file, that I could determine by counting the unprintable characters as I field marked through the file. This was the case when dealing with the [ticket-custom] header that is not in the original trac.ini. I had difficulty adding my first entry in ticket-custom due to it's multiple fields using trac-admin config set, so I used added only the widget name and then modified the trac.ini directly to add the attributes. Once this field was added I found it impossible to alter it via trac-admin config set], so I modified trac.ini directly to add the entry for the multiselectfield widget. I presumed it to be once I could call config get on both widgets and get the return off all attributes.

Regarding:

... Or you need to trac-admin $TRACENV deploy (as described in

I had not run deploy. I did and now have the following list of folders in my htdocs location in addition to all of the resources I had placed there.

  • acct_mgr
  • common
  • multiselectfield
  • site

Additionally I see the chosen.css in the CSS list, and have entries for the load of the multiselectfield via browse source and don't see errors, but it still doesn't show the widget. View source has these messages:

  • href="/trac/G9/chrome/multiselectfield/chosen.css" type="text/css" />
  • <script type="text/javascript" charset="utf-8" src="/trac/G9/chrome/multiselectfield/chosen.jquery.min.js"></script>
  • <script type="text/javascript" charset="utf-8" src="/trac/G9/chrome/multiselectfield/multiselectfield.js"></script>

It does not have entries regarding options. I am attempting to run the JavaScript error console and will provide that feedback when I am able.

comment:12 in reply to: ↑ 11 ; follow-up: Changed 16 months ago by rjollos

Replying to william.greenwaldt@hp.com:

It has them but when viewing in Notepad they don't appear, my presumption was due to the utf-8 encoding.

I don't think the encoding would have anything to do with it, but the file could have unix-style line endings. You might want to use Notepad++ or similar.

Hints:

  • If you want text to appear as you have pasted in the comment, surround the text with {{{ and }}}. Here is an example:
    {{{
    # -*- coding: utf-8 -*-
    [account-manager]
    account_changes_notify_addresses=
    password_format=htpasswd
    password_store=HtPasswdStore
    password_file=C:\BitNami\TracStack\apps\trac/users/htpasswd
    [attachment]
    }}}
    
  • If you prefix your line with >>, it will have the "reply styling". I've removed the >> from the lines above, and it reads now it a more normal way.

Changed 16 months ago by rjollos

comment:13 in reply to: ↑ 12 ; follow-up: Changed 16 months ago by rjollos

Replying to william.greenwaldt@hp.com:

Additionally I see the chosen.css in the CSS list, and have entries for the load of the multiselectfield via browse source and don't see errors, but it still doesn't show the widget.

Okay, looking good. It seems likely at this point that the custom ticket field configuration in the ticket-custom section is not correct, due to a line ending problem or whatever.

If you have the CONFIG_VIEW permission, you should be able to navigate to the /about page and see your configuration. Here is an example:


Does it look correct?

Changed 16 months ago by anonymous

comment:14 in reply to: ↑ 13 Changed 16 months ago by william.greenwaldt@…

Replying to rjollos:

Replying to william.greenwaldt@hp.com:

Additionally I see the chosen.css in the CSS list, and have entries for the load of the multiselectfield via browse source and don't see errors, but it still doesn't show the widget.

Okay, looking good. It seems likely at this point that the custom ticket field configuration in the ticket-custom section is not correct, due to a line ending problem or whatever.

If you have the CONFIG_VIEW permission, you should be able to navigate to the /about page and see your configuration. Here is an example:


Does it look correct?

The CONFIG_VIEW looks reasonable and it looks correct in Notepad++.

comment:15 Changed 16 months ago by rjollos

Something has gone wrong here. The line endings are probably not correct, as it should look like this:


I would hope that there would be some error in the logs as Trac shouldn't be able to properly parse that line. Do you see anything?

Changed 16 months ago by rjollos

Changed 16 months ago by rjollos

comment:16 Changed 16 months ago by rjollos

If I remove the line endings, I get the same as you:


Changed 16 months ago by anonymous

comment:17 follow-up: Changed 16 months ago by william.greenwaldt@…

I saw the difference between mine and yours and the equal chars. I re-opened trac.ini in Notepad++ and removed all the white space between the attributes and the = and line wrapped the values for [Ticket-custom] and now it shows the list of values and also the default value of None for my other entry.


There were no errors in trac.log to the affect that it wasn't properly parsed.

Thanks for your help and direction. Should I mark the ticket as resolved or will you? Thanks again!

comment:18 in reply to: ↑ 17 ; follow-up: Changed 16 months ago by rjollos

  • Keywords installation added
  • Resolution set to worksforme
  • Status changed from new to closed

Replying to william.greenwaldt@hp.com:

There were no errors in trac.log to the affect that it wasn't properly parsed.

I'm not seeing anything either when I put an equivalent configuration. I'll follow-up on that issue in the Trac core and see if we can add some error logging.

Thanks for your help and direction. Should I mark the ticket as resolved or will you? Thanks again!

I'm glad it's working for you. Happy to help.

comment:19 in reply to: ↑ 18 Changed 16 months ago by rjollos

Replying to rjollos:

I'm not seeing anything either when I put an equivalent configuration. I'll follow-up on that issue in the Trac core and see if we can add some error logging.

I see now what was happening. The relevant code is here. With an invalid configuration like you had, the custom field falls back to being treated as a normal text field even though field['type'] is u'text platform.format = list platform.label = Platform: platform.multiselect = true platform.options = DL380G8|DL580G9|DL3680G9 platform.order = 1. My initial thinking was to add some logging when the type wasn't recognized, but I'm not sure this would be the right thing to do. Is it possible that a plugin could extend the allowed types for a custom field (t:TracTicketsCustomFields#AvailableFieldTypesandOptions)? I'm not sure, but if not, then it shouldn't be a problem to log a WARNING.

comment:20 follow-up: Changed 16 months ago by ollika

Sorry to hijack the comment thread, but it's nice to see that the plugin is actually working for someone else as well. It was my first Trac plugin, so I was not 100% sure I got everything right.

Also nice to see that there is someone responding to the tickets so fast.

comment:21 in reply to: ↑ 20 Changed 16 months ago by rjollos

Replying to ollika:

Sorry to hijack the comment thread, but it's nice to see that the plugin is actually working for someone else as well. It was my first Trac plugin, so I was not 100% sure I got everything right.

Please do jump in! I tend to just jump on ticket to try and help people out in order to promote trac-hacks. Most issues that people have are pretty general in nature.

I looked over the code for your plugin. It looks good.

Changed 16 months ago by anonymous

comment:22 Changed 16 months ago by william.greenwaldt@…

I fear that I still don't have something configured correctly. I can not select the items. I have added the field to my custom-ticket table and updated the table. I do not desire to set a default value. I have one entry where I had set a value when it was a text field but now I cannot select a single or multiple values from the plugin. The image on the plugin page makes it appear that when you select an option it will prefix the remaining items and will have a checkbox, presumably to deselect the value.


Changed 16 months ago by anonymous

Changed 16 months ago by anonymous

Changed 16 months ago by anonymous

Changed 16 months ago by anonymous

Changed 16 months ago by anonymous

comment:23 Changed 16 months ago by william.greenwaldt@…

All,
I reduced my ticket-custom section of the .ini to just the plugin in an attempt to figure out what was affecting this. I found that this caused IE 10 to report the following script error:


Given this and a search, I found some info on the debug method being deprecated, so I commented out and updated the following two lines of code:


This changed my view of the widget in the Create Ticket view:


And allowed selection of the multiple fields:


I verified this all the way through the database.
Thanks rjollos for your support!
Thanks ollika for creating and distributing the plugin!

comment:24 Changed 16 months ago by rjollos

Nice catch! ollika, I'd be happy to push this change if you are busy at the moment.

comment:25 Changed 16 months ago by rjollos

Actually, we may want to do something like this for cross-browser compatibility.

comment:26 Changed 16 months ago by ollika

Thanks. I fixed it by removing the logging code.

comment:27 Changed 16 months ago by rjollos

Thanks, ollika. From looking at [13144], I thought you may have been trying to use t:CommitTicketUpdater with the Ticket #11066. Unfortunately Ticket is not a recognized keyword. Refs and some other are ... you can find them on the t:CommitTicketUpdater page.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.