当前位置: 首页>>代码示例>>Python>>正文


Python Folder.create方法代码示例

本文整理汇总了Python中models.Folder.create方法的典型用法代码示例。如果您正苦于以下问题:Python Folder.create方法的具体用法?Python Folder.create怎么用?Python Folder.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Folder的用法示例。


在下文中一共展示了Folder.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_vin

# 需要导入模块: from models import Folder [as 别名]
# 或者: from models.Folder import create [as 别名]
def create_vin(request):
	topics = ['NBA']
	for fld in topics:
		logging.info('Entra en bucle para %s' % fld)
		directory = "media/%s" % fld
		root = Folder.create(fld,request.user.profile,None,'/media/example_folder.png')
		root.save()
		for serie in os.listdir(directory):
			logging.info('Entra en bucle series para %s' % serie)
			if not serie.startswith('.'):
				s = Folder.create(serie,request.user.profile,root,None)
				s.pic = None #TODO revisar codigo inutil
				for season in os.listdir(directory+'/'+serie):
					if not season.startswith('.'):
						if fld == 'NBA':
							pic = '/media/example_folder.png'
						else:
							pic = '/'+directory+'/'+serie+'/'+season+'/season.jpeg'
						if s.pic == None:
							s.pic = pic
							s.save()
						ss = Folder.create(season,request.user.profile,s,pic)
						ss.save()
						for episode in os.listdir(directory+'/'+serie+'/'+season+'/'):
							if not episode.startswith('.') and '.jpeg' not in episode:
								# if fld == 'NBA':
								# 	pic = '/media/example_folder.png'
								# else:
								# 	pic = '/'+directory+'/'+serie+'/'+season+'/season.jpeg'
								url = open(directory+'/'+serie+'/'+season+'/'+episode,'r').readline()
								if url.__len__ > 0:
									c = Card.create(episode,url,ss)
									if fld == 'NBA':
										c.pic = fld+'/'+serie+'/'+season +'/'+ episode+'.jpeg'
									c.save()
开发者ID:albertorb,项目名称:vincula,代码行数:37,代码来源:miscellanea.py

示例2: folders

# 需要导入模块: from models import Folder [as 别名]
# 或者: from models.Folder import create [as 别名]
def folders():
    if request.method == 'POST':
        req = request.get_json()
        try:
            f = Folder.create(name=req['name'])
            f.save()
            return jsonify(message='OK'), 201
        except peewee.IntegrityError as e:
            print e
            return jsonify(message='error'), 409

    if request.method == 'GET':
        folders = Folder.select()
        items = [x.name for x in folders]
        return jsonify(message='OK', items=items)
开发者ID:kissthink,项目名称:MyCloud,代码行数:17,代码来源:app.py

示例3: import_data

# 需要导入模块: from models import Folder [as 别名]
# 或者: from models.Folder import create [as 别名]
def import_data(request, parent, data):
	"""
	Transform json file into vincula objects
	Every key of the json input will be transformed to a folder, and every
	value to links (Even arrays).
	Maximum depth allowed is 1, for security reasons, at the moment.
	"""
	# if not isinstance(data, dict):
	# 	data = json.loads(data)
	for folder, cards in data.iteritems():
		f_parent = Folder.create(folder, request.user.profile, parent, '/media/example_folder.png')
		f_parent.save()
		for name, url in cards.iteritems():
			card = Card.create(name, url, f_parent)
			card.save()
	return True
开发者ID:albertorb,项目名称:vincula,代码行数:18,代码来源:miscellanea.py


注:本文中的models.Folder.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。