Exemple #1
0
def upload_recursive(subdir):
	# check subdir
	subdir_real=os.path.join(config.PUBLISH_DIR, subdir)
	if not os.path.isdir(subdir_real):
		print("Directory not found: {} Returning...".format(subdir))
		return False
	
	# get subdirs
	subdirs=get_dirs(subdir)
	
	connect()
	return_state_list=[]
	for subdir in subdirs:
		# get dirlist
		real_subdir=os.path.join(config.PUBLISH_DIR, subdir)
		dirlist=os.listdir(real_subdir)
		# upload
		return_state_curr=upload(dirlist, subdir)
		return_state_list.append(return_state_curr)
	
	disconnect()
	if False in return_state_list:
		return_state=False
	else:
		return_state=True
	return return_state
def refresh_subdirs_recursive(refresh_dir):
	'''Control function acting recursively from given directory on.

- Initiate refresh/creation.
- Copy the remaining folder content.'''
	subdirs=get_dirs(refresh_dir)
	
	# process dirs
	for subdir in subdirs:
		print('Processing: ', subdir)
		# (call process_dir)
		pages_struct=process_dir(subdir)
		
		# if no index page is found a directory listing will be created
		if pages_struct != []:
			make_regular_pages(pages_struct, subdir)
			copy_remaining_content(subdir)
		else:
			make_listing_page(subdir)
			copy_listing_content(subdir)