def _get_events_inner(ev_session, username, start, limit): '''Read events from seafevents database, and remove events that are no longer valid Return 'limit' events or less than 'limit' events if no more events remain ''' valid_events = [] next_start = start while True: events = seafevents.get_user_events(ev_session, username, next_start, limit) if not events: break for ev in events: if ev.etype == 'repo-update': repo = get_repo(ev.repo_id) if not repo: # delete the update event for repo which has been deleted seafevents.delete_event(ev_session, ev.uuid) continue if repo.encrypted: repo.password_set = seafserv_rpc.is_passwd_set(repo.id, username) ev.repo = repo ev.commit = seafserv_threaded_rpc.get_commit(repo.id, repo.version, ev.commit_id) valid_events.append(ev) if len(valid_events) == limit: break if len(valid_events) == limit: break next_start = next_start + len(valid_events) return valid_events
def _get_events_inner(ev_session, username, start, limit): '''Read events from seafevents database, and remove events that are no longer valid Return 'limit' events or less than 'limit' events if no more events remain ''' valid_events = [] next_start = start while True: events = seafevents.get_user_events(ev_session, username, next_start, limit) if not events: break for ev in events: if ev.etype == 'repo-update': repo = get_repo(ev.repo_id) if not repo: # delete the update event for repo which has been deleted seafevents.delete_event(ev_session, ev.uuid) continue if repo.encrypted: repo.password_set = seafserv_rpc.is_passwd_set(repo.id, username) ev.repo = repo ev.commit = seafserv_threaded_rpc.get_commit(ev.commit_id) valid_events.append(ev) if len(valid_events) == limit: break if len(valid_events) == limit: break next_start = next_start + len(valid_events) return valid_events
def _get_events_inner(ev_session, username, start, org_id=None): '''Read 11 events from seafevents database, and remove events that are no longer valid ''' if org_id == None: events = seafevents.get_user_events(ev_session, username, start, start + 11) else: events = seafevents.get_org_user_events(ev_session, \ org_id, username, start, start + 11) total = len(events) valid_events = [] for ev in events: if ev.etype == 'repo-update': repo = get_repo(ev.repo_id) if not repo: # delete the update event for repo which has been deleted seafevents.delete_event(ev_session, ev.uuid) continue if repo.encrypted: repo.password_set = seafserv_rpc.is_passwd_set(repo.id, username) ev.repo = repo ev.commit = seafserv_threaded_rpc.get_commit(ev.commit_id) valid_events.append(ev) return total, valid_events
def get_user_events(username, start): ev_session = SeafEventsSession() events = seafevents.get_user_events(ev_session, username, start, start + 11) ev_session.close() for ev in events: if ev.etype == 'repo-update': repo = get_repo(ev.repo_id) if not repo: ev.etype = 'dummy' continue if repo.encrypted: repo.password_set = seafserv_rpc.is_passwd_set(repo.id, username) ev.repo = repo ev.commit = seafserv_threaded_rpc.get_commit(ev.commit_id) return events
def _get_events(username, start, org_id=None): ev_session = SeafEventsSession() if org_id == None: events = seafevents.get_user_events(ev_session, username, start, start + 11) else: events = seafevents.get_org_user_events(ev_session, \ org_id, username, start, start + 11) valid_events = [] ev_session.close() for ev in events: if ev.etype == 'repo-update': repo = get_repo(ev.repo_id) if not repo: continue if repo.encrypted: repo.password_set = seafserv_rpc.is_passwd_set(repo.id, username) ev.repo = repo ev.commit = seafserv_threaded_rpc.get_commit(ev.commit_id) valid_events.append(ev) return valid_events