Exemplo n.º 1
0
def listPic(path, pattern):
    tnPath = os.path.split(getUploadFileName('thumbnail/' + path, '', ''))[0]
    picPath = os.path.split(getUploadFileName(path, '', ''))[0]
    flist = listFile(picPath, pattern)
    flist.sort()
    if not flist:
        return
    url = getUploadFileURL(path, '', '')
    List = []
    for f in flist:
        fname = os.path.split(f)[1]
        tname = tnPath + '/' + fname
        if not os.path.exists(tname):
            createThumbnail(f, tname)
        if 'fpimage' in path:
            name = fname.split('_')[1]
            fs = []
        else:
            fs = fname[:-4].split('_')
            name = fs[0]
            name = '%s:%s:%s' % (name[:2], name[2:4], name[4:])
        if len(fs) >= 2:
            name = (name, formatPIN(fs[1]))
        else:
            name = (name, None)
        item = (name, getUploadFileURL('thumbnail/' + path, '',
                                       fname), url + fname)
        List.append(item)

    return List
Exemplo n.º 2
0
def listPic(path, pattern):
	tnPath=os.path.split(getUploadFileName("thumbnail/"+path,"",""))[0]
	picPath=os.path.split(getUploadFileName(path,"",""))[0]
	flist=listFile(picPath, pattern)
	flist.sort()
	if not flist: return
	url=getUploadFileURL(path, "", "")
	List=[]
	for f in flist:
		fname=os.path.split(f)[1]
		tname=tnPath+"/"+fname
		if not os.path.exists(tname):
			createThumbnail(f, tname)
		if "fpimage" in path: #fp image
		 	name=fname.split("_")[1]
			fs=[]
		else:
			fs=fname[:-4].split("_")
			name=fs[0]
			name="%s:%s:%s"%(name[:2],name[2:4],name[4:])
		if len(fs)>=2:
			name=(name,formatPIN(fs[1]),)
		else:
			name=(name, None,)
		item=(name, getUploadFileURL("thumbnail/"+path, "", fname),
			url+fname,)		
		List.append(item)
	return List
Exemplo n.º 3
0
def checkUpload():
    from mysite.cab import listFile
    files = listFile(settings.cfg.FTP.SCH_LOCAL, ['*.trans.log'])
    if files:
        try:
            ftp = FTP(settings.cfg.FTP.HOST)
            ftp.login(settings.cfg.FTP.USER, settings.cfg.FTP.PASSWORD)
            ftp.cwd(settings.cfg.FTP.TRANS_PATH)
        except Exception, e:
            return
        for f in files:
            uploadSAPFile(ftp, f)
        ftp.quit()
Exemplo n.º 4
0
def checkUpload():
	from mysite.cab import listFile
	files=listFile(settings.cfg.FTP.SCH_LOCAL, ['*.trans.log'])
	if files:
		try:
			ftp=FTP(settings.cfg.FTP.HOST)
			ftp.login(settings.cfg.FTP.USER, settings.cfg.FTP.PASSWORD)
			ftp.cwd(settings.cfg.FTP.TRANS_PATH)
		except Exception, e:
			return
		for f in files:
			uploadSAPFile(ftp, f)
		ftp.quit()
Exemplo n.º 5
0
def listPic(path, pattern):
    tnPath = os.path.split(getUploadFileName("thumbnail/" + path, "", ""))[0]
    picPath = os.path.split(getUploadFileName(path, "", ""))[0]
    flist = listFile(picPath, pattern)
    flist.sort()
    if not flist: return
    url = getUploadFileURL(path, "", "")
    List = []
    for f in flist:
        fname = os.path.split(f)[1]
        tname = tnPath + "/" + fname
        if not os.path.exists(tname):
            createThumbnail(f, tname)
        if "fpimage" in path:  #fp image
            name = fname.split("_")[1]
            fs = []
        else:
            fs = fname[:-4].split("_")
            name = fs[0]
            name = "%s:%s:%s" % (name[:2], name[2:4], name[4:])
        if len(fs) >= 2:
            name = (
                name,
                formatPIN(fs[1]),
            )
        else:
            name = (
                name,
                None,
            )
        item = (
            name,
            getUploadFileURL("thumbnail/" + path, "", fname),
            url + fname,
        )
        List.append(item)
    return List