Maciej Szulik added the comment:

I've added the search for github user name according to the discussion on IRC. 
I'm including the patch, but for the record, it's also being available at 
https://bitbucket.org/soltysh/python-dev/branch/github

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue579>
_______________________________________________________
diff --git a/extensions/pydevutils.py b/extensions/pydevutils.py
--- a/extensions/pydevutils.py
+++ b/extensions/pydevutils.py
@@ -20,6 +20,11 @@
     db = request.client.db
     return 'Coordinator' in db.user.get(user, 'roles')

+def is_developer(request):
+    user = request.client.userid
+    db = request.client.db
+    return 'Developer' in db.user.get(user, 'roles')
+
 def clean_ok_message(ok_message):
     """Remove nosy_count and message_count from the ok_message."""
     pattern = '\s*(?:nosy|message)_count,|,\s*(?:nosy|message)_count(?= 
edited)'
@@ -60,6 +65,7 @@
 def init(instance):
     instance.registerUtil('is_history_ok', is_history_ok)
     instance.registerUtil('is_coordinator', is_coordinator)
+    instance.registerUtil('is_developer', is_developer)
     instance.registerUtil('clean_ok_message', clean_ok_message)
     instance.registerUtil('issueid_and_action_from_class',
                           issueid_and_action_from_class)
diff --git a/html/style.css b/html/style.css
--- a/html/style.css
+++ b/html/style.css
@@ -177,6 +177,10 @@
   white-space: nowrap;
 }

+table.form th:last-child {
+  border-right: #ddd solid 1px;
+}
+
 table.form th.header {
   font-weight: bold;
   text-align: left;
diff --git a/html/user.index.html b/html/user.index.html
--- a/html/user.index.html
+++ b/html/user.index.html
@@ -19,7 +19,7 @@
 <table class="form" tal:define="
        search_input templates/page/macros/search_input;">

-   <tr><th class="header" colspan="5">Search for users</th></tr>
+   <tr><th class="header" colspan="7">Search for users</th></tr>
    <tr>
        <th class="header">Username</th>
        <td tal:define="name string:username">
@@ -33,6 +33,14 @@
                          name name;
                          id name"/>
        </td>
+       <tal:if condition="python:utils.is_developer(request)">
+       <th class="header">Github</th>
+       <td tal:define="name string:github">
+           <input tal:attributes="value python:request.form.getvalue(name) or 
nothing;
+                         name name;
+                         id name"/>
+       </td>
+       </tal:if>

        <td><input class="form-small" type="submit" value="Search" 
i18n:attributes="value"/></td>
    </tr>
diff --git a/html/user.item.html b/html/user.item.html
--- a/html/user.item.html
+++ b/html/user.item.html
@@ -105,7 +105,12 @@

  <tr tal:define="name string:homepage; label string:Homepage; value 
context/homepage">
   <th metal:use-macro="th_label">Home page</th>
-  <td><input name="organisation" metal:use-macro="normal_input"></td>
+  <td><input name="homepage" metal:use-macro="normal_input"></td>
+ </tr>
+
+ <tr tal:define="name string:github; label string:GitHub Name; value 
context/github">
+  <th metal:use-macro="th_label">GitHub Name</th>
+  <td><input name="github" metal:use-macro="normal_input"></td>
  </tr>

  <tr>
diff --git a/schema.py b/schema.py
--- a/schema.py
+++ b/schema.py
@@ -96,7 +96,8 @@
              contrib_form_date=Date(),
              openids=String(), # space separated list
              iscommitter=Boolean(),
-             homepage=String()
+             homepage=String(),
+             github=String()
              )
 user.setkey("username")
 db.security.addPermission(name='Register', klass='user',
@@ -349,7 +350,7 @@
 p = db.security.addPermission(name='View', klass='user',
         properties=('id', 'username', 'address', 'realname', 'phone',
                     'organisation', 'alternate_addresses', 'timezone',
-                    'roles', 'contrib_form', 'iscommitter', 'homepage'))
+                    'roles', 'contrib_form', 'iscommitter', 'homepage', 
'github'))
 db.security.addPermissionToRole('User', p)
 db.security.addPermissionToRole('Developer', p)
 # Coordinator may view all user properties.
@@ -374,8 +375,8 @@
                 'address', 'realname',
                 'phone', 'organisation',
                 'alternate_addresses',
-                'queries',
-                'timezone')) # Note: 'roles' excluded - users should not be 
able to edit their own roles.
+                'queries', 'timezone',
+                'homepage', 'github')) # Note: 'roles' excluded - users should 
not be able to edit their own roles.
                              # Also excluded: contrib_form, contrib_form_date, 
iscommitter
 for r in 'User', 'Developer':
     db.security.addPermissionToRole(r, p)
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss

Reply via email to