Modify

Opened 9 months ago

Closed 7 months ago

Last modified 6 months ago

#11378 closed defect (fixed)

Missing dynfields.js

Reported by: roger@… Owned by: robguttman
Priority: normal Component: DynamicFieldsPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I get the following complaint in my Trac 1.0.1 log:

2013-11-01 10:48:08,291 Trac[chrome] WARNING: File dynfields.js not found in any of ['/usr/lib/python2.7/site-packages/TracDynamicFields-2.2.0dev-py2.7.egg/dynfields/htdocs']
2013-11-01 10:48:08,320 Trac[main] WARNING: [10.209.160.46] HTTPNotFound: 404 Not Found (File dynfields.js not found)

Should this file exist? I do not see it in the .zip file I downloaded from TracHacks. If it should not exist, how can I disable the warning? It happens a lot.

Attachments (0)

Change History (12)

comment:1 Changed 9 months ago by rjollos

You must be running the 0.12 version, which is not recommended according to the project wiki page. In the 0.12 version, the dynfields script is still implemented as a virtual script, dynamicfieldsplugin/0.12/dynfields/templates/dynfields.html@8694, and it looks like the issue you mention is an error in the code.

You should probably reinstall from the 0.11 branch, but if you decide to stick with the 0.12 version, change dynfields.js -> dynfields.html at dynamicfieldsplugin/0.12/dynfields/web_ui.py@9690:47#L40.

comment:2 follow-up: Changed 9 months ago by roger@…

I installed the 0.11 branch. I will wait for any updates.

Nonetheless, as a learning experience, the 0.12 code is:

    def post_process_request(self, req, template, data, content_type):
        if ((req.path_info.startswith('/ticket') or
            req.path_info.startswith('/newticket')) and \
                req.perm.has_permission('TICKET_MODIFY') \
            ) or ( \
            req.path_info.startswith('/query') and \
                req.perm.has_permission('REPORT_VIEW')):
            add_script(req, 'dynfields/dynfields.js')
            add_script(req, 'dynfields/layout.js')
            add_script(req, 'dynfields/rules.js')
        return template, data, content_type

In the directory tree, dynfields.html is in a directory called templates. Would you suggest I change 'dynfields/dynfields.js' to 'dynfields/templates/dynfields.html'? I will use 0.11. I am just curious.

comment:3 in reply to: ↑ 2 Changed 9 months ago by rjollos

Replying to roger@…:

In the directory tree, dynfields.html is in a directory called templates. Would you suggest I change 'dynfields/dynfields.js' to 'dynfields/templates/dynfields.html'? I will use 0.11. I am just curious.

It should work to change dynfields/dynfields.js -> dynfields/dynfields.html. The path is "chrome-relative" path, which is different from the relative path of the file in the package.

I'll plan to fix this in the 0.12 branch before closing this ticket.

comment:4 Changed 9 months ago by jun66j5

I think we could simply fix it.... The issue has been introduced in [9690#file2].

  • dynfields/web_ui.py

     
    4444            ) or ( \ 
    4545            req.path_info.startswith('/query') and \ 
    4646                req.perm.has_permission('REPORT_VIEW')): 
    47             add_script(req, 'dynfields/dynfields.js') 
     47            # don't remove leading '/' character 
     48            add_script(req, '/dynfields/dynfields.js') 
    4849            add_script(req, 'dynfields/layout.js') 
    4950            add_script(req, 'dynfields/rules.js') 
    5051        return template, data, content_type 

comment:5 follow-up: Changed 9 months ago by rjollos

Oh, right, it is not a chrome-relative path, as we also saw with #7617.

Shouldn't the 0.11 branch also be adding /dynfields/dynfields.js rather than /dynfields/dynfields.html?: dynamicfieldsplugin/0.11/dynfields/web_ui.py@11518:40#L28

comment:6 in reply to: ↑ 5 Changed 9 months ago by jun66j5

Shouldn't the 0.11 branch also be adding /dynfields/dynfields.js rather than /dynfields/dynfields.html?: dynamicfieldsplugin/0.11/dynfields/web_ui.py@11518:40#L28

Looks good to me. However, 0.11 branch currently works well even if the suffix is .html cause the suffix isn't checked, dynamicfieldsplugin/0.11/dynfields/web_ui.py@11518:47-52#L42.

comment:7 Changed 9 months ago by rjollos

Okay, cool. I think it should be okay if you go ahead and push the change. Thanks!

comment:8 follow-up: Changed 9 months ago by roger@…

In the .zip file I just downloaded, there is no file called dynfields.js:

unzip -l dynamicfieldsplugin-13437.zip| grep js

     6132  2012-04-30 02:11   dynamicfieldsplugin/0.11/dynfields/htdocs/layout.js
    11558  2012-05-15 13:10   dynamicfieldsplugin/0.11/dynfields/htdocs/rules.js
     5333  2010-12-16 00:47   dynamicfieldsplugin/0.12/dynfields/htdocs/layout.js
     5077  2010-12-16 00:50   dynamicfieldsplugin/0.12/dynfields/htdocs/rules.js

I guess that will be added as well as the changed reference.

comment:9 Changed 9 months ago by jun66j5

In 13438:

DynamicFieldsPlugin: follow-up to r9690, dynfields.js is a virtual script that is provided by DynamicFieldsModule.process_request, not a file in htdocs directory (refs #11378)

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

Replying to roger@…:

In the .zip file I just downloaded, there is no file called dynfields.js:

That is how it should be since it is a virtual script. The JavaScript code is contained in templates/dynfields.html. Have no worries, it should work correctly even on the 0.12 branch following the change that Jun just pushed.

comment:11 Changed 7 months ago by rjollos

  • Resolution set to fixed
  • Status changed from new to closed

comment:12 Changed 6 months ago by rjollos

In 13650:

Bump version to 1.2.4. Refs #11378, #11118, #11523, #10126, #9605, #9986, #9996, #8971.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from robguttman. Next status will be '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.