Esempio n. 1
0
 def login(self, user=None):
     try:
         if user is None: user = self._login()
         self.session['userid'] = user._id
         self.session.save()
         g.zarkov_event('login', user=user)
         return user
     except exc.HTTPUnauthorized:
         self.logout()
         raise
Esempio n. 2
0
 def login(self, user=None):
     try:
         if user is None: user = self._login()
         self.session['userid'] = user._id
         self.session.save()
         g.zarkov_event('login', user=user)
         return user
     except exc.HTTPUnauthorized:
         self.logout()
         raise
Esempio n. 3
0
 def after_flush(self, obj=None):
     "Update artifact references, and add/update this artifact to solr"
     if not getattr(self.session, 'disable_artifact_index', False):
         from pylons import g
         from .index import ArtifactReference, Shortlink
         from .session import main_orm_session
         # Ensure artifact references & shortlinks exist for new objects
         arefs = []
         try:
             arefs = [
                 ArtifactReference.from_artifact(obj)
                 for obj in self.objects_added + self.objects_modified ]
             for obj in self.objects_added + self.objects_modified:
                 Shortlink.from_artifact(obj)
             # Flush shortlinks
             main_orm_session.flush()
         except Exception:
             log.exception("Failed to update artifact references. Is this a borked project migration?")
         self.update_index(self.objects_deleted, arefs)
         for obj in self.objects_added:
             g.zarkov_event('create', extra=obj.index_id())
         for obj in self.objects_modified:
             g.zarkov_event('modify', extra=obj.index_id())
         for obj in self.objects_deleted:
             g.zarkov_event('delete', extra=obj.index_id())
     self.objects_added = []
     self.objects_modified = []
     self.objects_deleted = []
Esempio n. 4
0
 def after_insert(self, obj, st, sess):
     g.zarkov_event("project_create", project=obj)
Esempio n. 5
0
 def after_insert(self, obj, st, sess):
     g.zarkov_event('project_create', project=obj)