Beispiel #1
0
 def check_zip(self, appname, files, **params):
     '''Test installing and uninstalling a zipfile via URL and as a file'''
     args = AttrDict(params)
     for url, suffix in ((self.zip_url, '-url'), (self.zip_file, '-file')):
         args.url = url
         subappname = appname + suffix
         install([subappname], args)
         self.check_files(subappname, files)
         self.check_uninstall(subappname)
Beispiel #2
0
    def get_stream(self, media):

        headers = {
            "Authorization": self.access_token,
            "User-agent": session.USER_AGENT,
            "Accept": "application/vnd.media-service+json; version=1",
            "x-bamsdk-version": self.BAM_SDK_VERSION,
            "x-bamsdk-platform": self.PLATFORM,
            "origin": "https://www.mlb.com"
        }
        stream_url = self.STREAM_URL_TEMPLATE.format(media_id=media.media_id)
        logger.debug("getting stream %s" % (stream_url))
        stream = self.get(stream_url, headers=headers).json()
        logger.debug("stream response: %s" % (stream))
        if "errors" in stream and len(stream["errors"]):
            raise SGStreamNotFound(stream["errors"])
        stream = AttrDict(stream)
        stream.url = stream["stream"]["complete"]
        return stream
Beispiel #3
0
def table_crud(table):
    data = AttrDict()
    data.params = ""
    old_net = request.args.get("old_net", None)
    if old_net is not None:
        data.params = "?old_net=1"
           
    if table not in table_defs:
        return "Table %s is not available" % table

    datagrid = Datagrid(name="grid1", htmldiv="grid1", table=table)

    table_def = table_defs[table]
    columns = table_def.columns
    sortdata = table_def.sortdata

    data.primary_key = table_def.primary_key
    
    data.title = table_def.title
    data.table = table
    
    data.url = "/table/crud/%s" % table

    data.columns = []
    for column in table_def.columns:
        name = column.name
        col = AttrDict()
        col.field = name 
        col.caption = column.title 
        col.size = "30%" 
        col.sortable = True
        col.type = column.type
        data.columns.append(col)
         
    data.sortdata = []
    data.sortdata.append( { 'field': sortdata[0]['name'], 
                            'direction': sortdata[0]['direction'] } )
        
    return render_template('table_crud.html', 
                           columns=columns,\
                           data = data, 
                           datajson=json.dumps(data), 
                           datagrid=datagrid)