How to handle usernames in TRAC

29 views
Skip to first unread message

Eliya Voldman

unread,
Dec 2, 2020, 3:07:06 PM12/2/20
to Trac Users

I am completely new in TRAC. I was able to install it on my Windows server and the version is 1.4.2

I created a few users using 'session' command. Now I have users with parameters like name e.g. "John Smith", SID like jsmith and email like jsm...@gmali.com. I create a new ticket and assign it to user e.g. jsmith . This is OK but it's not very friendly for other users to see only jsmith I now that it's possible to provide either SID like jsmith or name like "John Smith" and TRAC will automatically convert it to 'readable' name or even provide the option in drop-down to select the name.

I assume it should be plugin that could manage this. Could someone explain/help how to locate and install plugin to handle names?

Thanks

RjOllos

unread,
Dec 2, 2020, 3:11:35 PM12/2/20
to Trac Users
It's not necessary to create sessions. They'll be automatically created when a user authenticates the first time, and the user can then set their email and name in /prefs. However, you can use the command if you wish to populate the session data before the user authenticates.

You may want to set the following option to true: https://trac.edgewall.org/wiki/TracIni#ticket-restrict_owner-option 

Alternatively, here is a plugin that we should integrate into Trac (it would be a long time coming):

Ryan

Jeff McKenna

unread,
Dec 3, 2020, 10:53:30 AM12/3/20
to trac-...@googlegroups.com
On 2020-12-02 4:11 p.m., RjOllos wrote:

>
> You may want to set the following option to true:
> https://trac.edgewall.org/wiki/TracIni#ticket-restrict_owner-option
>
> Alternatively, here is a plugin that we should integrate into Trac (it
> would be a long time coming):
> https://trac-hacks.org/wiki/AutocompleteUsersPlugin
>
>

Thanks Ryan, I've enabled both of these as you recommended. (love the
AutocompleteUsersPlugin !!! Agreed that this should be included in core)

-jeff



--
Jeff McKenna
MapServer Consulting and Training Services
co-founder of FOSS4G
http://gatewaygeo.com/







Eliya Voldman

unread,
Dec 3, 2020, 12:26:17 PM12/3/20
to Trac Users

Hi Ryan, Jeff

Setting option restrict_owner=true worked perfectly fine but I want to use autocompletion.

Here’s what I did:

  1. pip install TracAutocompleteUsersPlugin
  2. Added to trac.ini

        [components]

autocompleteusers.* = enabled

 

[autocomplete]

fields = tester, reviewer

multi_fields = users

Unfortunately ‘autocompletion’ does not work. What I was missing?

Thanks

RjOllos

unread,
Dec 3, 2020, 12:59:11 PM12/3/20
to Trac Users
On Thursday, December 3, 2020 at 9:26:17 AM UTC-8 evol...@gmail.com wrote:

Hi Ryan, Jeff

Setting option restrict_owner=true worked perfectly fine but I want to use autocompletion.

Here’s what I did:

  1. pip install TracAutocompleteUsersPlugin
  2. Added to trac.ini

        [components]

autocompleteusers.* = enabled

 

[autocomplete]

fields = tester, reviewer

multi_fields = users

Unfortunately ‘autocompletion’ does not work. What I was missing?

Thanks


Which Trac version?

Depending on your web server configuration you may need to redeploy static assets:

For further debugging, please check the logs and browser console:

You should see the JS files fetched by the browser, but that could be a source of error:

Ryan

Eliya Voldman

unread,
Dec 3, 2020, 1:14:31 PM12/3/20
to Trac Users
hi Ryan,
Here's what I've got about my package from pip show trac:

Name: Trac

Version: 1.4.2

Summary: Integrated SCM, wiki, issue tracker and project environment

Home-page: https://trac.edgewall.org/

Author: Edgewall Software

Author-email: trac...@googlegroups.com

License: BSD

Location: d:\trac\python27\lib\site-packages

Requires: jinja2, setuptools

Required-by: TracAutocompleteUsersPlugin

--

FYI: I tried to install jinja2 and setuptools but got: Requirement already satisfied.



RjOllos

unread,
Dec 3, 2020, 1:16:51 PM12/3/20
to Trac Users
On Thursday, December 3, 2020 at 10:14:31 AM UTC-8 evol...@gmail.com wrote:
hi Ryan,
Here's what I've got about my package from pip show trac:

Name: Trac

Version: 1.4.2

Summary: Integrated SCM, wiki, issue tracker and project environment

Home-page: https://trac.edgewall.org/

Author: Edgewall Software

Author-email: trac...@googlegroups.com

License: BSD

Location: d:\trac\python27\lib\site-packages

Requires: jinja2, setuptools

Required-by: TracAutocompleteUsersPlugin

--

FYI: I tried to install jinja2 and setuptools but got: Requirement already satisfied.


That looks good. TracAutocompleteUsers should work with Trac 1.4.2. Let me know what the debug steps yield. 

Eliya Voldman

unread,
Dec 3, 2020, 3:02:30 PM12/3/20
to Trac Users
Well ... I tried to debug and set log to DEBUG level but did not find any errors.

Ryan Ollos

unread,
Dec 3, 2020, 3:06:34 PM12/3/20
to Trac Users
On Thu, Dec 3, 2020 at 12:02 PM Eliya Voldman <evol...@gmail.com> wrote:
Well ... I tried to debug and set log to DEBUG level but did not find any errors.

I'd look for resource fetching in the browser request via Browser console next. 

Jeff McKenna

unread,
Dec 3, 2020, 7:31:20 PM12/3/20
to trac-...@googlegroups.com
Hi Eliya,

I used the trunk version (for all my plugins, with 1.4.2), such as:


It was then enabled automatically.  I didn't have to make any other changes, after that install command.


-jeff




--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/81a99af2-d605-484f-bd6b-6af811308fa3n%40googlegroups.com.

RjOllos

unread,
Dec 3, 2020, 7:49:49 PM12/3/20
to Trac Users
On Thursday, December 3, 2020 at 4:31:20 PM UTC-8 jeffm...@gmail.com wrote:
Hi Eliya,

I used the trunk version (for all my plugins, with 1.4.2), such as:


It was then enabled automatically.  I didn't have to make any other changes, after that install command.


-jeff

Hmmm, well you definitely need to enable the plugin if you install to site-packages rather than dropping an egg in the env plugins directory.  In the latter case, the plugin would be implicitly enabled, but not installing to site-packages. If you look at your trac.ini, you must have:

[components]
autocompleteusers.* = enabled

Ryan

Eliya Voldman

unread,
Dec 3, 2020, 8:07:05 PM12/3/20
to Trac Users
Hi Ryan, jeff
Actually I am not 'true' web developer and mostly could only follow someone's instructions. Thanks for above suggestions.
- Ryan, I do have in trac.ini those lines. I also see in Admin Tab - Plugins that plugin TracAutocompleteUsersPlugin 0.4.6 is 'Enabled'
Following Ryan recommendation I tried to open/create a ticket and check Console. When I click on Tab 'Create Ticket' I've got errors in Console. (see attachments). Are they related to my issue? 

console.txt
Console.PNG

RjOllos

unread,
Dec 3, 2020, 8:33:51 PM12/3/20
to Trac Users
On Thursday, December 3, 2020 at 5:07:05 PM UTC-8 evol...@gmail.com wrote:
Hi Ryan, jeff
Actually I am not 'true' web developer and mostly could only follow someone's instructions. Thanks for above suggestions.
- Ryan, I do have in trac.ini those lines. I also see in Admin Tab - Plugins that plugin TracAutocompleteUsersPlugin 0.4.6 is 'Enabled'
Following Ryan recommendation I tried to open/create a ticket and check Console. When I click on Tab 'Create Ticket' I've got errors in Console. (see attachments). Are they related to my issue? 

The resources aren't available from the webserver. Did you restart the webserver? If yes, then you may need to redeploy static assets, depending on your server config. See the link I sent earlier. 

Eliya Voldman

unread,
Dec 4, 2020, 11:20:41 AM12/4/20
to Trac Users
hi Ryan,
Looks that the next step is to 're-deploy' static assets.
In my case Project is located under D:\Trac\NBDR hence I did the following:

D:\Trac\NBDR>trac-admin . deploy  D:\Trac\NBDR

Error: Resources cannot be deployed to a target directory that is equal to or below the source directory 'd:\trac\NBDR\htdocs'.

Please choose a different target directory and try again.

D:\Trac\NBDR>

Obviously I can't re-deploy at the same location. I want to leave my Project at the same location as it now.

My question: how could I handle it? Could I deploy e.g. to D:\Temp and then move back to D:\Trac\NBDR? Could you advice?

Thanks


RjOllos

unread,
Dec 4, 2020, 11:31:36 AM12/4/20
to Trac Users
On Friday, December 4, 2020 at 8:20:41 AM UTC-8 evol...@gmail.com wrote:
hi Ryan,
Looks that the next step is to 're-deploy' static assets.
In my case Project is located under D:\Trac\NBDR hence I did the following:

D:\Trac\NBDR>trac-admin . deploy  D:\Trac\NBDR

Error: Resources cannot be deployed to a target directory that is equal to or below the source directory 'd:\trac\NBDR\htdocs'.

This is a common mistake, which is why that error message was added. If you deploy to D:\Trac\NBDR, the cgi-bin and htdocs directories will be created:
D:\Trac\NBDR\cgi-bin
D:\Trac\NBDR\htdocs

But there's already a D:\Trac\NBDR\htdocs directory containing the custom site code, and files are extracted from that location in the deploy operation, which leads to a recursion error.

Usually, you want to separate out the private and public assets. 

D:\Trac\NBDR is the Trac environment. The static assets should be deployed outside this location, to a location served public. This might be D:\Trac\public or D:\Trac\www.

$ trac-admin D:\Trac\NBDR deploy D:\Trac\www

and point the webserver Aliases to D:\Trac\www per:

Please choose a different target directory and try again.

D:\Trac\NBDR>

Obviously I can't re-deploy at the same location. I want to leave my Project at the same location as it now.

My question: how could I handle it? Could I deploy e.g. to D:\Temp and then move back to D:\Trac\NBDR? Could you advice?

I advise against putting your public resources in D:\Trac\NBDR\htdocs. If you want to deploy below D:\Trac\NBDR, use D:\Trac\NBDR\www:

$ trac-admin D:\Trac\NBDR deploy D:\Trac\NBDR\www

and point the webserver Aliases to D:\Trac\NBDR\www
 

Thanks

Eliya Voldman

unread,
Dec 4, 2020, 1:14:46 PM12/4/20
to Trac Users
Hi Ryan,

I already have www directory under Trac\NBDR :

$ ls /d/Trac/NBDR/www/

cgi-bin/  chrome/  htdocs/  web.config

 

Currently webserver alias points to -> D:\Trac\nbdr\www

You suggested to deploy to D:\Trac\NBDR\www and point the webserver Aliases to D:\Trac\NBDR\www

I'm affraid it'll cause a conflict because it's already exist.

Could I deploy to existing D:\Trac\nbdr\www like this and don't change Aliases. It sounds to me like deploying to location which already exist. Won't it break anything?

Could I run the following:

trac-admin D:\Trac\NBDR deploy D:\Trac\NBDR\www

 

Thanks



Ryan Ollos

unread,
Dec 4, 2020, 4:34:53 PM12/4/20
to Trac Users
On Fri, Dec 4, 2020 at 10:14 AM Eliya Voldman <evol...@gmail.com> wrote:
Hi Ryan,

I already have www directory under Trac\NBDR :

$ ls /d/Trac/NBDR/www/

cgi-bin/  chrome/  htdocs/  web.config

 

Currently webserver alias points to -> D:\Trac\nbdr\www

You suggested to deploy to D:\Trac\NBDR\www and point the webserver Aliases to D:\Trac\NBDR\www

I'm affraid it'll cause a conflict because it's already exist.

Could I deploy to existing D:\Trac\nbdr\www like this and don't change Aliases. It sounds to me like deploying to location which already exist. Won't it break anything?

Could I run the following:

trac-admin D:\Trac\NBDR deploy D:\Trac\NBDR\www


You should be okay to redeloy to  "Trac/NBDR/www/". I'd do the following:
* Make a backup copy of the dir.
* Delete cgi-bin and htdocs
* Run deploy

cgi-bin and htdocs will be recreated. What's in the chrome directory? It's probably not needed. I'm not sure about web.config. You may want to relocate that file.

Ryan

Eliya Voldman

unread,
Dec 4, 2020, 7:19:55 PM12/4/20
to Trac Users

Hi Ryan,

I deleted cgi-bin and htdocs

I ran the script:

D:\Trac\NBDR>trac-admin D:\Trac\NBDR deploy D:\Trac\NBDR\www

Copying resources from:

  trac.web.chrome.Chrome

    d:\trac\python27\lib\site-packages\trac\htdocs

    d:\trac\NBDR\htdocs

  autocompleteusers.autocompleteusers.AutocompleteUsers

    d:\trac\python27\lib\site-packages\autocompleteusers\htdocs

Creating scripts.

 

D:\Trac\NBDR>

--

It created new scripts:

$ ls /d/Trac/NBDR/www/htdocs/autocomplete/*

/d/Trac/NBDR/www/htdocs/autocomplete/css:

autocomplete.css  indicator.gif

 

/d/Trac/NBDR/www/htdocs/autocomplete/js:

autocomplete.js  autocomplete_perms.js  autocomplete_query.js  autocomplete_ticket.js  format_item.js

--

I restarted webserver.

It failed to start TRAC with 500.

Then I realized that 'new' cgi-bin miss 2 files:

old: $ls /d/Trac/NBDR/www/cgi-bin/

trac.cgi*  trac.fcgi*  trac.wsgi*  trac_wsgi.py*  trac_wsgi.pyc

new: $ls /d/Trac/NBDR/www/cgi-bin/

trac.cgi*  trac.fcgi*  trac.wsgi* 

Hence I copied those 2 files and was able to start TRAC.

 

trac.ini has these blocks:

[components]

autocompleteusers.* = enabled

 

[autocomplete]

fields = tester, reviewer

multi_fields = users

--

I tried to create a new ticket. I used Cc field to check but it still does not autocomplete users

What else could be wrong?

Thanks

RjOllos

unread,
Dec 4, 2020, 7:32:02 PM12/4/20
to Trac Users
On Friday, December 4, 2020 at 4:19:55 PM UTC-8 evol...@gmail.com wrote:

Hi Ryan,

I deleted cgi-bin and htdocs


The pyc file is created automatically by the Python interpretter.

For trac_wsgi.py, I'd recommend locating it somewhere other than cgi-bin. Or, write a deploy script that delete www, runs deploy, and then copies $env/trac_wsgi.py to $www/cgi-bi

You'll need to redeploy every time you upgrade Trac and when installing or upgrading most plugins (any plugins that have static assets: JS, CC, Images).
 

trac.ini has these blocks:

[components]

autocompleteusers.* = enabled

 

[autocomplete]

fields = tester, reviewer

multi_fields = users

--

I tried to create a new ticket. I used Cc field to check but it still does not autocomplete users

What else could be wrong?

Thanks


You've disabled [ticket] restrict_owner, correct?:  https://trac.edgewall.org/wiki/TracIni#ticket-restrict_owner-option

The reporter (if available), CC and owner field (in the ticket workflow controls) should be autocompleted. The [autocomplete] section isn't needed unless you have additional fields that you'd like to autocomplete.

Make sure to do a hard-refresh of your browser and then retest. How to do so is described in the box here:

Check the console again for errors if the issue persists.

Ryan

Eliya Voldman

unread,
Dec 4, 2020, 9:20:13 PM12/4/20
to Trac Users
Hi Ryan,
Finally I was able to implement 'autocompleteusers' option.
The trick was to copy 'autocomplete' directory from cgi-bin to chrome directory
Now both 'autocomplete' and 'drop-down' works fine

Highly appreciate your help

Ryan Ollos

unread,
Dec 4, 2020, 9:45:56 PM12/4/20
to Trac Users
On Fri, Dec 4, 2020 at 6:20 PM Eliya Voldman <evol...@gmail.com> wrote:
Hi Ryan,
Finally I was able to implement 'autocompleteusers' option.
The trick was to copy 'autocomplete' directory from cgi-bin to chrome directory
Now both 'autocomplete' and 'drop-down' works fine

Highly appreciate your help

autocomplete in cgi-bin? Are you sure? Hopefully the directory is named "autocompleteusers" and is not found in cgi-bin after deployment.

Here is an example:

$ trac-admin ../tracenvs/proj-1.4 deploy www
Copying resources from:
  trac.web.chrome.Chrome
    /Users/rjollos/.pyenv/versions/trac-2.7/lib/python2.7/site-packages/Trac-1.4.2-py2.7.egg/trac/htdocs
    /Users/rjollos/Documents/Workspace/trac-dev/tracenvs/proj-1.4/htdocs
  autocompleteusers.autocompleteusers.AutocompleteUsers
    /Users/rjollos/.pyenv/versions/trac-2.7/lib/python2.7/site-packages/TracAutocompleteUsersPlugin-1.0.dev0-py2.7.egg/autocompleteusers/htdocs
Creating scripts.

$ find www/htdocs/autocompleteusers/
www/htdocs/autocompleteusers/
www/htdocs/autocompleteusers//css
www/htdocs/autocompleteusers//css/autocomplete.css
www/htdocs/autocompleteusers//css/indicator.gif
www/htdocs/autocompleteusers//js
www/htdocs/autocompleteusers//js/autocomplete_ticket.js
www/htdocs/autocompleteusers//js/autocomplete.js
www/htdocs/autocompleteusers//js/format_item.js
www/htdocs/autocompleteusers//js/autocomplete_query.js
www/htdocs/autocompleteusers//js/autocomplete_perms.js 

It works for me.

What are your Alias directives in the Apache config?

Ryan

RjOllos

unread,
Dec 4, 2020, 10:27:26 PM12/4/20
to Trac Users
Another possibility, your Alias is too specific. Currently, we recommend:

Alias /trac/chrome D:\Trac\NBDR\www\htdocs 

See:

In the past our documentation defined more specific aliases:

Alias /trac/chrome/common D:\Trac\NBDR\www\htdocs\common
Alias /trac/chrome/site D:\Trac\NBDR\www\htdocs\site

See:

However, there's no real advantage to the latter and it can cause problems like the one you are experiencing. Adding TracAutocompleteUsers plugin adds the path:
D:\Trac\NBDR\www\htdocs\autocompleteusers
which wouldn't be picked up by the latter set of aliases. An additional alias would be needed.

We had a long discussion about that on trac-dev a few years back.

Ryan

Eliya Voldman

unread,
Dec 4, 2020, 10:41:37 PM12/4/20
to Trac Users

Sorry, it was my typo about 'autocomplete' in cgi-bin above 

I don't have autocompleteusers directory or file under $env. I have only autocomplete

$ ls www/chrome/ www/htdocs/

www/chrome/:

autocomplete/  common/  site/  web.config

 

www/htdocs/:

autocomplete/  common/  site/

 

We are not using Apache but IIS and the path is D:\Trac\nbdr\www

Thanks again, it wasn't easy but I am happy now that with your help I  completed the task

Ryan Ollos

unread,
Dec 4, 2020, 10:44:54 PM12/4/20
to Trac Users
On Fri, Dec 4, 2020 at 7:41 PM Eliya Voldman <evol...@gmail.com> wrote:

Sorry, it was my typo about 'autocomplete' in cgi-bin above 

I don't have autocompleteusers directory or file under $env.

You shouldn't. I didn't suggest it should be the case.
 

I have only autocomplete

$ ls www/chrome/ www/htdocs/

www/chrome/:

autocomplete/  common/  site/  web.config

 

www/htdocs/:

autocomplete/  common/  site/

 

We are not using Apache but IIS and the path is D:\Trac\nbdr\www

Thanks again, it wasn't easy but I am happy now that with your help I  completed the task


Okay, so you had to copy www/htdocs/autocomplete to www/chrome/autocomplete? I think this is due to your Alias configuration. The manual copy operation shouldn't be needed. 

I don't know how IIS configures Aliases, but there is probably something similar.

RjOllos

unread,
Dec 4, 2020, 10:53:42 PM12/4/20
to Trac Users
The reason I'm suggesting to get to the bottom of this, and make it works without the manual directory copy, is that I think there's something off or not fully understood with your configuration, and you may run into problems later if you upgrade Trac. Anyway, just keep in mind in case you have trouble later. 
Reply all
Reply to author
Forward
0 new messages