def feed_rss(): q = db.session.query(Dataset) if not auth.account.is_admin(): q = q.filter_by(private=False) feed_items = q.order_by(Dataset.created_at.desc()).limit(20) items = [] for feed_item in feed_items: items.append({ 'title': feed_item.label, 'pubdate': feed_item.updated_at, 'link': url_for('dataset.view', dataset=feed_item.name), 'description': feed_item.description, 'author_name': ', '.join([person.fullname for person in feed_item.managers if person.fullname]), }) desc = _('Recently created datasets on %(site_title)s', site_title=current_app.config.get('SITE_TITLE')) feed = Rss201rev2Feed(_('Recently Created Datasets'), url_for('home.index'), desc) for item in items: feed.add_item(**item) sio = StringIO() feed.write(sio, 'utf-8') return Response(sio.getvalue(), mimetype='application/xml')
def source_to_dict(dataset, source): data = dict(source.meta.items()) data.pop('http_headers', None) data['data_url'] = url_for('sources_api.serve', dataset=dataset.name, name=source.name) data['runs_url'] = url_for('runs_api.index', dataset=dataset.name, source=source.name) data['api_url'] = url_for('sources_api.view', dataset=dataset.name, name=source.name) return data
def feed_rss(): q = db.session.query(Dataset) if not auth.account.is_admin(): q = q.filter_by(private=False) feed_items = q.order_by(Dataset.created_at.desc()).limit(20) items = [] for feed_item in feed_items: items.append({ 'title': feed_item.label, 'pubdate': feed_item.updated_at, 'link': '/datasets/%s' % feed_item.name, 'description': feed_item.description, 'author_name': ', '.join([ person.fullname for person in feed_item.managers if person.fullname ]), }) desc = gettext('Recently created datasets on %(site_title)s', site_title=current_app.config.get('SITE_TITLE')) feed = Rss201rev2Feed(gettext('Recently Created Datasets'), url_for('home.index'), desc) for item in items: feed.add_item(**item) sio = StringIO() feed.write(sio, 'utf-8') return Response(sio.getvalue(), mimetype='application/xml')
def get_reset_body(account): reset_link = url_for('account_api.do_reset', email=account.email, token=account.token) return _(RESET_MESSAGE, reset_link=reset_link, site_title=current_app.config.get('SITE_TITLE'))
def to_dict(self): return { 'id': self.id, 'api_url': url_for('runs_api.view', dataset=self.dataset.name, id=self.id), 'operation': self.operation, 'status': self.status, 'source': self.source, 'time_start': self.time_start, 'time_end': self.time_end }
def template_context_processor(): locale = get_locale() data = { 'current_language': locale.language, 'url_for': url_for, 'reserved_terms': RESERVED_TERMS, 'site_url': url_for('home.index').rstrip('/'), 'number_symbols_group': locale.number_symbols.get('group'), 'number_symbols_decimal': locale.number_symbols.get('decimal'), 'site_title': current_app.config.get('SITE_TITLE') } return data
def to_dict(self): return { 'label': self.label, 'name': self.name, 'description': self.description, 'currency': self.currency, 'category': self.category, 'private': self.private, 'created_at': self.created_at, 'updated_at': self.updated_at, 'languages': list(self.languages), 'territories': list(self.territories), 'api_url': url_for('datasets_api.view', name=self.name) }
def to_dict(self): return { 'label': self.label, 'name': self.name, 'description': self.description, 'currency': self.currency, 'category': self.category, 'private': self.private, 'created_at': self.created_at, 'updated_at': self.updated_at, 'languages': list(self.languages), 'territories': list(self.territories), 'has_model': self.has_model, 'api_url': url_for('datasets_api.view', name=self.name) }
def index(*a, **kw): from flask.ext.babel import get_locale from spendb.views.context import etag_cache_keygen etag_cache_keygen(RESERVED_TERMS) locale = get_locale() data = { 'current_language': locale.language, 'url_for': url_for, 'debug': current_app.config['DEBUG'], 'asset_link': asset_link, 'reserved_terms': RESERVED_TERMS, 'site_url': url_for('home.index').rstrip('/'), 'site_title': current_app.config.get('SITE_TITLE') } return render_template('layout.html', **data)
def index(*a, **kw): from flask.ext.babel import get_locale from spendb.views.context import etag_cache_keygen etag_cache_keygen(RESERVED_TERMS) locale = get_locale() data = { 'current_language': locale.language, 'url_for': url_for, 'reserved_terms': RESERVED_TERMS, 'templates': angular_templates(current_app), 'site_url': url_for('home.index').rstrip('/'), 'number_symbols_group': locale.number_symbols.get('group'), 'number_symbols_decimal': locale.number_symbols.get('decimal'), 'site_title': current_app.config.get('SITE_TITLE') } return render_template('layout.html', **data)
def to_dict(self): """ Return the dictionary representation of the account. """ account_dict = { 'name': self.name, 'fullname': self.fullname, 'display_name': self.display_name, 'email': self.email, 'admin': self.admin, 'gravatar': self.gravatar, 'twitter_handle': self.twitter_handle, 'api_url': url_for('account_api.view', account=self.name) } if not self.public_email: account_dict.pop('email') if not self.public_twitter: account_dict.pop('twitter_handle') return account_dict
def template_context_processor(): locale = get_locale() data = { 'DEBUG': current_app.config.get('DEBUG'), 'current_language': locale.language, 'current_locale': get_locale(), 'reserved_terms': RESERVED_TERMS, 'url_for': url_for, 'site_url': url_for('home.index').rstrip('/'), 'number_symbols_group': locale.number_symbols.get('group'), 'number_symbols_decimal': locale.number_symbols.get('decimal'), 'site_title': current_app.config.get('SITE_TITLE'), 'languages': languages(), 'logged_in': auth.account.logged_in(), 'current_user': current_user, 'can': auth } return data