Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11378 closed defect (fixed)

Missing dynfields.js

Reported by: roger@… Owned by: Rob Guttman
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 11 years ago by Ryan J Ollos

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 Changed 11 years 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 11 years ago by Ryan J Ollos

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 11 years ago by Jun Omae

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 Changed 11 years ago by Ryan J Ollos

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 11 years ago by Jun Omae

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 11 years ago by Ryan J Ollos

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

comment:8 Changed 11 years 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 11 years ago by Jun Omae

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 11 years ago by Ryan J Ollos

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 11 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

comment:12 Changed 11 years ago by Ryan J Ollos

In 13650:

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Rob Guttman.
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.