def create_app(): form = CreateAppForm(request.form) if form.validate_on_submit(): app = Application.create(form.name.data, form.domain.data, form.description.data, warden.current_user()) return redirect(url_for('developer.app_details', domain=app.domain)) return render_template('developer/create_app.html', form=form)
def edit_app(domain): app = Application.get(domain=domain, author=warden.current_user()) form = EditAppForm(request.form, name=app.domain, description=app.description) if form.validate_on_submit(): file = request.files['zipfile'] if zipfile.is_zipfile(file): with zipfile.ZipFile(file) as _zipfile: os.umask(022) path2appfiles = apps_files_path(app.author.nickname, app.domain) _zipfile.extractall(path2appfiles) return render_template('developer/edit_app.html', form=form)
def app_details(domain): app = Application.get(domain=domain, author=warden.current_user()) return render_template('developer/app_details.html', app=app)
def index(): developers_app = Application.find(author=warden.current_user()) return render_template('developer/index.html', apps=developers_app)
def validate_domain(self, field): app = Application.get(domain=field.data, author=warden.current_user()) if app: raise ValidationError("Domain already taken")
def details(nickname, domain): app = Application.get(domain, nickname) return render_template('appstore/details.html', app=app)
def by_author(nickname): author = User.get(nickname) apps = Application.find(author) return render_template('appstore/by_author.html', apps=apps, author=author)
def index(): apps = Application.all() return render_template('appstore/index.html', apps=apps)