• Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 118

Show
Ignore:
Timestamp:
10/25/07 10:54:09 (10 months ago)
Author:
ola
Message:

Upload directory should not be on the project - is generated automatically when server is started

Location:
Xml/Validator/WebApp
Files:
1 removed
1 modified

  • start-validator.py (modified) (3 diffs)
  • uploads (deleted)

Legend:

Unmodified
Added
Removed
  • Xml/Validator/WebApp/start-validator.py

    r88 r118  
    1010import sys 
    1111 
     12import datetime 
     13from datetime import timedelta 
     14import os, glob, time 
     15 
     16 
    1217LOCAL_DIR = os.path.dirname(os.path.join(os.getcwd(),"uploads/")) 
    1318SESSION_PREFIX = 'session-' 
    … …  
    1823                        if (fname.startswith(SESSION_PREFIX) and not fname.endswith(LOCK))] 
    1924                         
     25        now = datetime.datetime.now() 
     26        now.timetuple() 
     27        for sfile in sessionfiles: 
     28                for file in glob.glob(LOCAL_DIR+"/"+sfile): 
     29                        stats = os.stat(file)  
     30                        dtfile = datetime.datetime.fromtimestamp(stats[8]) 
     31                        t = now-timedelta(days=2) 
     32                        if t > dtfile: 
     33                                os.remove(os.path.join((LOCAL_DIR), sfile)) 
     34                                                 
    2035        for fname in os.listdir(LOCAL_DIR): 
    2136                if (not fname.startswith(SESSION_PREFIX) and not fname.endswith(LOCK)): 
    … …  
    3853    update_config(configfile="prod.cfg",modulename="validator.config") 
    3954 
     55if not os.path.isdir(LOCAL_DIR): 
     56        try: 
     57                os.mkdir(LOCAL_DIR) 
     58        except IOError: 
     59                print "IOError: %s could not be created" % LOCAL_DIR 
    4060 
    4161from validator.controllers import Root 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/