def read(self, *args, **kwargs): return RevisionController.read(self)
def old_list(self): format = request.params.get('format', '') onlycreated = request.params.get('created', '') organization = request.params.get('organization', '') feed_title=u'RSS-Feed - Geänderte Datensätze - data.gv.at' feed_description=_(u'Letzte Änderungen: ') if onlycreated == '1': feed_title=u'RSS-Feed - Neue Datensätze - data.gv.at' feed_description=_(u'Neue Datensätze: ') log.debug("organization selected: %s" % organization) lang = get_lang() if lang[0]: lang = lang[0] if format == 'atom': feed = Atom1Feed( title=_(feed_title), link=h.url_for(controller='revision', action='list', id=''), description=feed_description, language=unicode(lang), ) maxresults = 10 #revision_query = model.repo.history() #revision_query = revision_query.limit(maxresults) revision_query = model.repo.history() revision_query = revision_query.order_by(model.Revision.timestamp.desc()) revision_query = revision_query.filter(model.Revision.id!=None) #revision_query = revision_query.filter(model.Member.group_id=='4a766e5e-89a3-4a16-addd-05fa0b5953c3') #revision_query = revision_query.limit(maxresults) maintainer = 'default' for revision in revision_query: if(feed.num_items()>=maxresults): break transition = "" packName= "" package_indications = [] revision_changes = model.repo.list_changes(revision) resource_revisions = revision_changes[model.Resource] #package_revisions = revision_changes[model.Package] resource_group_revisions = revision_changes[model.ResourceGroup] package_extra_revisions = revision_changes[model.PackageExtra] group_revisions = revision_changes[model.Group] tag_revisions = revision_changes[model.PackageTag] member_revisions = revision_changes[model.Member] #Skip groups if (len(group_revisions)>0): continue #if (len(member_revisions)>0): #continue if len(revision.packages)==0: continue if (len(resource_group_revisions) + len(tag_revisions) +len(package_extra_revisions) +len(resource_revisions))==0: continue for package in revision.packages: number = len(package.all_revisions) package_revision = None count = 0 for pr in package.all_revisions: count += 1 if pr.revision.id == revision.id: package_revision = pr break if package_revision and package_revision.state == model.State.DELETED: transition = 'deleted' elif package_revision and count == number: transition = 'created' else: transition = 'updated' for resource_revision in resource_revisions: if resource_revision.continuity.resource_group.package_id == package.id: transition += ': Ressourcen' break for resource_group_revision in resource_group_revisions: if resource_group_revision.package_id == package.id: transition += ' resource_group' break for package_extra_revision in package_extra_revisions: if package_extra_revision.package_id == package.id: #if package_extra_revision.key == 'date_updated': transition += '' break indication = "%s" % ( transition) packName = package.name packId = package.id packTitle = package.title maintainer = package.maintainer package_indications.append(indication) package = model.Package.get(packId) packDict = model.Package.as_dict(package) if (onlycreated == '1') and not(transition.startswith('created')): continue log.debug('group found: %s / group wanted: %s' % (packDict.get('groups'), organization)) if (organization != ''): if not(organization in packDict.get('groups')): continue log.critical('CORRECT GROUP FOUND!!') #if len(package_indications[0]) < 3: # revision_changes.xxx() pkgs = u'%s' % ' '.join(package_indications) #item_title = u'%s ' % (revision.id) item_title = packTitle #if revision.message: # item_title += ': %s' % (revision.message or '') item_link = '/sucheDetail/?id=' + packId item_description = indication #item_description = _('Datasets affected: %s.\n') % pkgs #item_description += '%s' % (revision.message or '') #item_author_name = Authorization Group ! item_author_name = maintainer item_pubdate = revision.timestamp feed.add_item( title=item_title, link=item_link, description=item_description, author_name=item_author_name, pubdate=item_pubdate, ) log.fatal("feedlength: " + feed.num_items()) feed.content_type = 'application/atom+xml' return feed.writeString('utf-8') else: return RevisionController.list(self);
def index(self, *args, **kwargs): return RevisionController.index(self)
def edit(self, *args, **kwargs): return RevisionController.edit(self)
def diff(self, *args, **kwargs): return RevisionController.diff(self)
def list(self, *args, **kwargs): return RevisionController.list(self)
def __before__(self, action, **env): RevisionController.__before__(self, action, **env) context = {'model': model, 'user': c.user, 'auth_user_obj': c.userobj} if not getattr(c.userobj, 'sysadmin', False): base.abort(404)