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):
                        create_thumbnail(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,format_pin(fs[1]),)
                else:
                        name=(name, None,)
                item=(name, getUploadFileURL("thumbnail/"+path, "", fname),
                        url+fname,)                
                List.append(item)
                #print item
        return List
Exemplo n.º 2
0
 def test_format_pin(self):
     from django.conf import settings
     pin = format_pin(self.pin)
     if settings.PIN_WIDTH > 1:
         self.assertEquals(len(pin), settings.PIN_WIDTH)
     else:
         self.assertEquals(len(pin), len(self.pin))
     self.assert_(pin.find(self.pin) >= 0)
Exemplo n.º 3
0
    def test_format_pin(self):
        from django.conf import settings

        pin = format_pin(self.pin)
        if settings.PIN_WIDTH > 1:
            self.assertEquals(len(pin), settings.PIN_WIDTH)
        else:
            self.assertEquals(len(pin), len(self.pin))
        self.assert_(pin.find(self.pin) >= 0)
Exemplo n.º 4
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):
            create_thumbnail(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,
                format_pin(fs[1]),
            )
        else:
            name = (
                name,
                None,
            )
        item = (
            name,
            getUploadFileURL("thumbnail/" + path, "", fname),
            url + fname,
        )
        List.append(item)
        #print item
    return List