def show_parcel_map (self, id, parcel_id): all_parcels = cadasta_model.get_parcel_geom(id) ctype, format = self._content_type_from_accept() response.headers['Content-Type'] = ctype context = {'model': model, 'session': model.Session, 'user': c.user or c.author, 'for_view': True, 'auth_user_obj': c.userobj} data_dict = {'id': id, 'include_tracking': True} # check if package exists try: c.pkg_dict = get_action('package_show')(context, data_dict) c.pkg = context['package'] except NotFound: abort(404, _('Dataset not found')) except NotAuthorized: abort(401, _('Unauthorized to read package %s') % id) package_type = c.pkg_dict['type'] or 'dataset' self._setup_template_variables(context, {'id': id, 'parcel_id' : parcel_id}, package_type=package_type) return render('package/map.html', extra_vars={'dataset_type': package_type, 'all_parcels': all_parcels, 'parcel_id':parcel_id })
def read_parcel_details(self, id, parcel_id): parcel_geom = cadasta_model.get_parcel_geom(id) relationship_list = cadasta_model.list_relationships(id) parcel_details = cadasta_model.get_parcel_details(parcel_id) if parcel_details: reformatted_date = parse(parcel_details['features'][0]['properties']['time_created']) reformatted_date = reformatted_date.strftime("%m/%d/%y") parcel_details['features'][0]['properties']['time_created'] = reformatted_date reformatted_time_updated = parse(parcel_details['features'][0]['properties']['time_updated']) reformatted_time_updated = reformatted_time_updated.strftime("%m/%d/%y") parcel_details['features'][0]['properties']['time_updated'] = reformatted_time_updated for relationship in parcel_details['features'][0]['properties']['relationships']: reformatted_date = parse(relationship['time_created']) reformatted_date = reformatted_date.strftime("%m/%d/%y") relationship['time_created'] = reformatted_date reformatted_date = parse(relationship['time_updated']) reformatted_date = reformatted_date.strftime("%m/%d/%y") relationship['time_updated'] = reformatted_date ctype, format = self._content_type_from_accept() response.headers['Content-Type'] = ctype context = {'model': model, 'session': model.Session, 'user': c.user or c.author, 'for_view': True, 'auth_user_obj': c.userobj} data_dict = {'id': id, 'include_tracking': True} # check if package exists try: c.pkg_dict = get_action('package_show')(context, data_dict) c.pkg = context['package'] except NotFound: abort(404, _('Dataset not found')) except NotAuthorized: abort(401, _('Unauthorized to read package %s') % id) package_type = c.pkg_dict['type'] or 'dataset' self._setup_template_variables(context, {'id': id, 'parcel_id' : parcel_id}, package_type=package_type) return render('package/parcel_details.html', extra_vars={'dataset_type': package_type, 'parcel_geom': parcel_geom, 'relationship_list':relationship_list, 'parcel_details': parcel_details})