#266 some more make up on code
Merged 7 years ago by sayanchowdhury. Opened 7 years ago by vivekanand1101.
vivekanand1101/fedora-hubs more_beauty  into  develop

file modified
+5
@@ -14,11 +14,16 @@ 

            validator=validators.text,

            help="Text about a user.")

  def data(session, widget, text):

+     ''' Data for the About widget '''

+ 

      return dict(text=text)

  

  

  @hint(topics=[_('hubs.widget.update')])

  def should_invalidate(message, session, widget):

+     ''' Checks whether the about widget cache needs an update or not

+     Called by backend daemon which listens to fedmsg '''

+ 

      if not message['topic'].endswith('hubs.widget.update'):

          return False

      if message['msg']['widget']['id'] != widget.idx:

file modified
+5 -3
@@ -5,6 +5,7 @@ 

  

  def filter_img_src(name, value):

      ''' Filter in img html tags images coming from a different domain. '''

+ 

      import hubs.app

      if name in ('alt', 'height', 'width', 'class'):

          return True
@@ -16,14 +17,15 @@ 

  

  

  def clean(text, ignore=None):

-     """ For a given html text, escape everything we do not want to support

+     ''' For a given html text, escape everything we do not want to support

      to avoid potential security breach.

-     """

+     '''

+ 

      if ignore and not isinstance(ignore, (tuple, set, list)):

          ignore = [ignore]

  

      attrs = bleach.ALLOWED_ATTRIBUTES

-     if not ignore or not 'img' in ignore:

+     if not ignore or 'img' not in ignore:

          attrs['img'] = filter_img_src

  

      tags = bleach.ALLOWED_TAGS + [

file modified
+8 -1
@@ -1,9 +1,10 @@ 

+ import requests

+ 

  from hubs.hinting import hint

  from hubs.widgets.chrome import panel

  from hubs.widgets.base import argument

  from hubs.widgets import templating

  import hubs.validators as validators

- import requests

  

  pagure_url = "https://pagure.io/api/0"

  
@@ -17,6 +18,9 @@ 

            validator=validators.pagure_repo,

            help="Pagure repo name")

  def data(session, widget, repo):

+     ''' Data for pagure issues widget

+     Queries Pagure api for issues '''

+ 

      repo = "pagure"

  

      url = '/'.join([pagure_url, repo, "issues"])
@@ -65,4 +69,7 @@ 

  

  @hint()

  def should_invalidate(message, session, widget):

+     ''' Checks whether pagureissues widget cache needs an update

+     Run by backend daemon listening to fedmsg '''

+ 

      raise NotImplementedError

no initial comment

Change to Data for the About widget?

rebased

7 years ago

rebased

7 years ago

rebased

7 years ago

rebased

7 years ago

Pull-Request has been merged by sayanchowdhury

7 years ago