|
0 |
-- a/component/ucsschool/ucs-school-umc-distribution/umc-distribution |
0 |
++ b/component/ucsschool/ucs-school-umc-distribution/umc-distribution |
Lines 135-140
def initProject( project ):
|
Link Here
|
---|
|
135 |
for fileitem in filelist: |
135 |
for fileitem in filelist: |
136 |
# copy to sender directory |
136 |
# copy to sender directory |
137 |
target = os.path.join( project['sender']['projectdir'], fileitem['filename'] ) |
137 |
target = os.path.join( project['sender']['projectdir'], fileitem['filename'] ) |
|
|
138 |
target = str(target) |
138 |
debugmsg( ud.ADMIN, ud.INFO, 'coping %s to %s' % ( fileitem['tmpfname'], target ) ) |
139 |
debugmsg( ud.ADMIN, ud.INFO, 'coping %s to %s' % ( fileitem['tmpfname'], target ) ) |
139 |
try: |
140 |
try: |
140 |
shutil.copy( fileitem['tmpfname'], target ) |
141 |
shutil.copy( fileitem['tmpfname'], target ) |
Lines 143-149
def initProject( project ):
|
Link Here
|
---|
|
143 |
debugmsg( ud.ADMIN, ud.ERROR, 'failed to copy/chown "%s" to "%s": %s' % (fileitem['tmpfname'], target, str(e))) |
144 |
debugmsg( ud.ADMIN, ud.ERROR, 'failed to copy/chown "%s" to "%s": %s' % (fileitem['tmpfname'], target, str(e))) |
144 |
|
145 |
|
145 |
# move to cache directory |
146 |
# move to cache directory |
146 |
target = os.path.join( project_data_dir, fileitem['filename'] ) |
147 |
target = str( os.path.join( project_data_dir, fileitem['filename'] ) ) |
147 |
debugmsg( ud.ADMIN, ud.INFO, 'moving %s to %s' % ( fileitem['tmpfname'], target ) ) |
148 |
debugmsg( ud.ADMIN, ud.INFO, 'moving %s to %s' % ( fileitem['tmpfname'], target ) ) |
148 |
try: |
149 |
try: |
149 |
shutil.move( fileitem['tmpfname'], target ) |
150 |
shutil.move( fileitem['tmpfname'], target ) |
Lines 253-260
def distributeData( project ):
|
Link Here
|
---|
|
253 |
|
254 |
|
254 |
# copy files from cache to recipient |
255 |
# copy files from cache to recipient |
255 |
for fn in project['files']: |
256 |
for fn in project['files']: |
256 |
src = os.path.join( project['cachedir'], fn ) |
257 |
src = str( os.path.join( project['cachedir'], fn ) ) |
257 |
target = os.path.join( user['projectdir'], fn ) |
258 |
target = str( os.path.join( user['projectdir'], fn ) ) |
258 |
try: |
259 |
try: |
259 |
shutil.copyfile( src, target ) |
260 |
shutil.copyfile( src, target ) |
260 |
except Exception, e: |
261 |
except Exception, e: |
Lines 266-272
def distributeData( project ):
|
Link Here
|
---|
|
266 |
|
267 |
|
267 |
# cleanup cache directory |
268 |
# cleanup cache directory |
268 |
try: |
269 |
try: |
269 |
shutil.rmtree( project['cachedir'] ) |
270 |
shutil.rmtree( str( project['cachedir'] ) ) |
270 |
except Exception, e: |
271 |
except Exception, e: |
271 |
debugmsg( ud.ADMIN, ud.ERROR, 'failed to cleanup cache directory "%s": %s' % (project['cachedir'], str(e))) |
272 |
debugmsg( ud.ADMIN, ud.ERROR, 'failed to cleanup cache directory "%s": %s' % (project['cachedir'], str(e))) |
272 |
|
273 |
|
Lines 325-332
def collectData( project, forced=False ):
|
Link Here
|
---|
|
325 |
} ) |
326 |
} ) |
326 |
|
327 |
|
327 |
for fn in project['files']: |
328 |
for fn in project['files']: |
328 |
src = os.path.join( recipient['projectdir'], fn ) |
329 |
src = str( os.path.join( recipient['projectdir'], fn ) ) |
329 |
target = os.path.join( targetdir, fn ) |
330 |
target = str( os.path.join( targetdir, fn ) ) |
330 |
if os.path.isfile( src ): |
331 |
if os.path.isfile( src ): |
331 |
try: |
332 |
try: |
332 |
shutil.copy( src, target ) |
333 |
shutil.copy( src, target ) |
|
420 |
# remove project cache dir if existant |
421 |
# remove project cache dir if existant |
421 |
if os.path.exists( project['cachedir'] ): |
422 |
if os.path.exists( project['cachedir'] ): |
422 |
try: |
423 |
try: |
423 |
shutil.rmtree( project['cachedir'] ) |
424 |
shutil.rmtree( str( project['cachedir'] ) ) |
424 |
except Exception, e: |
425 |
except Exception, e: |
425 |
debugmsg( ud.ADMIN, ud.ERROR, 'failed to cleanup cache directory "%s": %s' % (project['cachedir'], str(e))) |
426 |
debugmsg( ud.ADMIN, ud.ERROR, 'failed to cleanup cache directory "%s": %s' % (project['cachedir'], str(e))) |
426 |
exitcode = 40 |
427 |
exitcode = 40 |