Skip to content

Instantly share code, notes, and snippets.

@naoyeye
Created November 9, 2012 08:53
Show Gist options
  • Save naoyeye/4044560 to your computer and use it in GitHub Desktop.
Save naoyeye/4044560 to your computer and use it in GitHub Desktop.
class post_image_delete:
@session.login_required
def POST(self, arg):
data = web.input()
path = data.path
part_name = data.part_name
homedir = os.getcwd()
imgPath = homedir + path
if os.path.isfile(imgPath + '/.DS_Store'):
os.remove(imgPath + '/.DS_Store')
files = glob.glob(imgPath + '/' + part_name + '*')
for file in files:
os.remove(file)
success = "s"
return success
@bjjay
Copy link

bjjay commented Nov 9, 2012

class post_image_delete:
    @session.login_required
    def POST(self, arg):
        data = web.input()
        path = data.path
        part_name = data.part_name
        homedir = os.getcwd()
        imgPath = homedir + path

        files = glob.glob(imgPath + '/' + part_name + '*')
        files += glob.glob(imgPath + '/.DS*')
        for item in files:
            os.remove(item)
        return "s"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment