#102 Removes redudent instructions in README for fas_credentials.py and credentials.py
Closed 8 years ago by dhrish20. Opened 8 years ago by dhrish20.
dhrish20/fedora-hubs issue100  into  develop

file modified
+6 -20
@@ -33,21 +33,6 @@ 

  

      $ pip install -r requirements.txt

  

- Give fedora-hubs some FAS credentials.  It's going to need these to query FAS

- for information about other users.  When we deploy this thing to production,

- we'll use a system account for this but for now, just use your personal

- account.  Copy the following into a new file under the fedmsg.d directory

- called fas_credentials.py (``fedmsg.d/fas_credentials.py``) ::

- 

-     config = {

-         'fas_credentials': {

-             'username': 'YOUR_FAS_USERNAME_GOES_HERE',

-             'password': 'YOUR_FAS_PASSWORD_GOES_HERE',

-         }

-     }

- 

- Make sure to leave the '' around you username and password - don't delete them!

- 

  With that, try running the app with::

  

      $ PYTHONPATH=. python populate.py  # To create the db
@@ -84,9 +69,11 @@ 

  -------------------

  

  You need to add a new file to the ``fedmsg.d/`` directory.

- Call it ``fedmsg.d/credentials.py``.  It should have some

- secrets in it that you don't want to accidentally share with

- anyone else.. so be sure to keep it private.  It should have

+ Call it ``fedmsg.d/credentials.py``. It's needed to query FAS 

+ for information about other users. When we deploy this thing to

+ production, we'll use a system account for this but for now, just

+ use your personal account. You don't want to accidentally share this

+ with anyone else. so be sure to keep it private.  It should have

  contents like this::

  

      config = {
@@ -101,8 +88,7 @@ 

          'github.oauth_token': 'YOUR_GITHUB_TOKEN',

      }

  

- Some widgets will work without the above info being present..

- but it is needed for a subset of them.

+ Make sure to leave the '' around you username and password - don't delete them! Some widgets will work without the above information being present but it is needed for a subset of them.

  

  Feed Widget - the Extra Mile

  ----------------------------

file modified
+6
@@ -73,4 +73,10 @@ 

              'display_number': 15,

          }))

      hub.widgets.append(widget)

+     widget = hubs.models.Widget(

+         plugin='bugzilla', index=8,

+         _config=json.dumps({

+             'username': username,

+         }))

+     hub.widgets.append(widget)

      return hub

@@ -14,6 +14,7 @@ 

  from hubs.widgets import github_pr

  from hubs.widgets import pagureissues

  from hubs.widgets import githubissues

+ from hubs.widgets import bugzilla

  

  from hubs.widgets.workflow import pendingacls

  from hubs.widgets.workflow import updates2stable
@@ -37,6 +38,7 @@ 

      'github_pr': github_pr,

      'pagureissues': pagureissues,

      'githubissues': githubissues,

+     'bugzilla': bugzilla,

  

      'workflow.pendingacls': pendingacls,

      'workflow.updates2stable': updates2stable,

@@ -0,0 +1,69 @@ 

+ import requests

+ import jinja2

+ import pkgwat.api

+ 

+ import hubs.validators as validators

+ from hubs.widgets.base import argument

+ from hubs.widgets.chrome import panel

+ from hubs.hinting import hint, prefixed as _

+ 

+ chrome = panel("Bugzilla: Issues")

+ 

+ template = jinja2.Template("""

+ <ul class="media-list">

+   {% for issue in all_issues[:3] %}

+     <li class="media">

+       <div class="media-left">

+         <a href="https://bugzilla.redhat.com/show_bug.cgi?id={{ issue['id'] }}" target="_blank">

+ 	  <span class="label label-default">#{{ issue['id'] }}</span>

+ 	</a>

+       </div>

+       <div class="media-body">

+         <h4 class="media-heading">

+           <a href="https://admin.fedoraproject.org/pkgdb/package/rpms/{{ issue['pkg_name'] }}" target="_blank">{{ issue['pkg_name'] }}</a> -

+           {{ issue['title'] }}

+         </h4>

+       </div>

+     </li>

+   {% endfor %}

+ </ul>

+ """)

+ 

+ @argument(name="username",

+           default=None,

+           validator=validators.username,

+           help="A FAS username.")

+ def data(session, widget, username):

+     pkgdb_url = "https://admin.fedoraproject.org/pkgdb/api/packager/package"

+     url = "/".join([pkgdb_url, username])

+     response = requests.get(url)

+     data = response.json()

+     

+     all_issues = []

+     

+     for package in data["point of contact"]:

+       pkg_details=pkgwat.api.bugs(package['name'])

+       for row in pkg_details['rows']:

+         all_issues=(

+           all_issues+[dict(

+               pkg_name=package['name'],

+               id=row['id'],

+               title=row['description'])])[:3] 

+       

+     for package in data["co-maintained"]:

+       pkg_details=pkgwat.api.bugs(package['name'])

+       for row in pkg_details['rows']:

+           all_issues=(

+             all_issues+[dict(

+               pkg_name=package['name'],

+               id=row['id'],

+               title=row['description'])])[:3]

+ 

+     return dict(

+       username=username,

+       all_issues=all_issues,

+     )

+ 

+ @hint()

+ def should_invalidate(message, session, widget):

+     raise NotImplementedError

no initial comment

Pull-Request has been closed by dhrish20

8 years ago