Re: Displaying username and realname in the HTML pages

John Kristensen <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hello Andreas,

I've had a quick dig through the roundup code and I think I may have 
found some answers for you.

On 08/06/13 22:44, Andreas Flöter wrote:
> the username in our use case is the AD login name and cryptic. I would like to
> display the combination of username (realname), preferably sorted by realname
> in the different HTML pages.
>
> For page "issue.item.html" I changed
>
>    <td tal:content="structure context/assignedto/menu">assignedto menu</td>
>
> to
>
>    <td tal:content="structure
> python:context.assignedto.menu(additional=['realname',])">assignedto menu</td>
>
> and get a menue with a list of "username (Lastname, Firstname)".
> Unfortunately, it is not sorted on last name and firstname.

Assuming that the 'realname' field stores the name as "Lastname, 
Firstname" then you may be able to use the 'sort_on' menu parameter. So 
you probably want to use something like:

   <td tal:content="structure
      python:context.assignedto.menu(
        additional=['realname',],
        sort_on=('+', 'realname')
      )"
   >assignedto menu</td>

The docstring for the menu method probably has the best documentation:
 
https://github.com/jerrykan/roundup/blob/master/roundup/cgi/templating.py#L1929

(apologies for linking to an old clone on github, but the sourceforge 
code viewer is really slow for me at the moment).

>
> For page "issue.index.html" I don't know what I could do to get the
> equivalent.
>
>     <td tal:condition="request/show/assignedto"
>         tal:content="python:i.assignedto.plain() or default">&nbsp;</td>
>
> I can exchange "plain()" by "realname" and I get the realname part of the user
> but I don't know how to get both.
>

For this you are going to need to fill out the '<td>' a bit . You are 
probably after something like:

   <td tal:condition="request/show/assignedto">
     <tal:x content="python:i.assignedto.plain() or default" />
     ( <tal:x content="python:i.realname.plain() or default" /> )
   </td>


> In a previous communication on the mailing list I saw it was mentioned that
> there is a documentation on the API but I don't know where to find it. Could
> you please point me to it?

Not sure about this. I have found the roundup documentation a bit 
limited in some areas (something I would like to help improve one day) 
so I tend to learn how things work by digging through the code (which I 
fully understand not all people are willing/able to do).

I hope the examples help though.

SeeYa,
John.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.