def add_task(self, task_info, priority=0):
     """
       Add task to this app
       
       :arg dict task_info: dict with info to task
       :arg float priority: priority of task (must be between 0 and 1), default = 0
       
     """
     
     if priority < 0 or priority > 1:
         logger.error(Meb_apps_exception(6, self.app_id, self.short_name))
         raise Meb_apps_exception(6, self.app_id, self.short_name)
     
     return pbclient.create_task(self.app_id, task_info, priority_0=priority)        
def create_home_app():
    try:
        
        meb_short_name = "meb_home"
        apps = pbclient.find_app(short_name=meb_short_name)
        pyb_app = None
        if len(apps) != 0:
            pyb_app = apps[0]
        else:
            ans = pbclient.create_app(name="Memória Estatística do Brasil", short_name=meb_short_name, description="Página inicial do MEB.")
            if ans:
                pyb_app = pbclient.find_app(short_name=meb_short_name)[0]
                pbclient.create_task(pyb_app.id, {})

        if pyb_app == None:
            return False

        new_long_desc_template = meb_util.set_url(urllib2.urlopen(
                                                 urllib2.Request(app.config['URL_TEMPLATES'] +
                                                                 "/templates/long_description-home.html")), meb_short_name)
        new_template = meb_util.set_url(urllib2.urlopen(
                                       urllib2.Request(app.config['URL_TEMPLATES'] +
                                                        "/templates/template-home.html")), meb_short_name)

        pyb_app.info['thumbnail'] = app.config['URL_TEMPLATES'] + "/images/meb_icon.png"

        pyb_app.category_id = 1
        pyb_app.long_description = new_long_desc_template
        pyb_app.info['task_presenter'] = new_template
        
        pbclient.update_app(pyb_app)

        return True

    except Exception as e:
        return False