Beispiel #1
0
	def get(self, id):
		_bucket = Bucket.get_for_id(id)
		if _bucket != "":
			result = True
		else:
			result = False

		return result, date_time_today(), 'get()'
Beispiel #2
0
	def get_all(self):
		_bucket = Bucket.get_all()
		if _bucket != []:
			result = True
		else:
			result = False

		return result, date_time_today(), 'get_all()'
Beispiel #3
0
def index():
    if request.method == 'POST':
        bucket = request.form['bucket']
        session['bucket'] = bucket
        return redirect(url_for('files'))
    else:
        _bucket = Bucket.get_for_name(current_user.bucket[0].name)

        return render_template("index.html", bucket=_bucket)
Beispiel #4
0
def files():
    # my_bucket = get_bucket()
    # summaries = my_bucket.objects.all()
    _bucket = Bucket.get_for_name(
        name=current_user.bucket[0].name
    )  #Saber o usuário que está logado no momento
    files = _bucket.files

    return render_template('files.html', my_bucket=_bucket, files=files)
Beispiel #5
0
	def insert(self, _user):
		data = {'name': _user.usercpf, 'creation_date': self.creation_date,
				'_user': _user}

		_bucket = Bucket.insert(data, db)

		if _bucket != "":
			result = True
		else:
			result = False

		return result, date_time_today(), 'insert()'
Beispiel #6
0
def insert_db(file, fileExtension):
    dataFile = {
        'name': os.path.splitext(file.filename)[0],
        'path': file.filename,
        'insertion_date': datetime.now(),
        'size': get_size(file),
        'extension': fileExtension,
        'expiration_date': datetime.now(),
        '_bucket': Bucket.get_for_name(name=current_user.bucket[0].name),
        '_user': User.get(id=current_user.id)
    }

    _file = File().insert(data=dataFile, db=db)

    if _file:
        return True

    return False
Beispiel #7
0
dicResult['User'] = listResult
listResult = []

#Teste com Bucket
_bucketTeste = BucketTest()
listResult.append(_bucketTeste.insert(_user=User.get(1)))
listResult.append(_bucketTeste.insert(_user=User.get(2)))
listResult.append(_bucketTeste.get_all())
listResult.append(_bucketTeste.get(id=1))

dicResult['Bucket'] = listResult
listResult = []

#Teste com File
_fileTest = FileTest()
listResult.append(_fileTest.insert('txt', _user=User.get(1),
								   _bucket=Bucket.get_for_name(User.get(1).usercpf)))
listResult.append(_fileTest.get_all())
listResult.append(_fileTest.get(id=1))

dicResult['File'] = listResult
listResult = []





clear_screen()

message(dicResult)