mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
add user events
This commit is contained in:
16
utils.py
16
utils.py
@@ -13,6 +13,8 @@ from base.models import FileContributors
|
||||
|
||||
from pysearpc import SearpcError
|
||||
|
||||
import seafevents
|
||||
|
||||
from seaserv import seafserv_rpc, ccnet_threaded_rpc, seafserv_threaded_rpc, \
|
||||
get_repo, get_commits, get_group_repoids, CCNET_SERVER_ADDR, \
|
||||
CCNET_SERVER_PORT, get_org_id_by_repo_id, get_org_by_id, is_org_staff, \
|
||||
@@ -189,7 +191,7 @@ def get_accessible_repos(request, repo):
|
||||
if stat.S_ISDIR(dirent.props.mode):
|
||||
return True
|
||||
|
||||
if repo.encrypted:
|
||||
if repo and repo.encrypted:
|
||||
repo.has_subdir = check_has_subdir(repo)
|
||||
accessible_repos = [repo]
|
||||
return accessible_repos
|
||||
@@ -404,3 +406,15 @@ def get_file_contributors(repo_id, file_path, file_path_hash, file_id):
|
||||
last_modified = fc.last_modified
|
||||
|
||||
return contributors, last_modified
|
||||
|
||||
seafevents_session = None
|
||||
def get_seafevents_session():
|
||||
if not hasattr(settings, 'EVENTS_CONFIG_FILE'):
|
||||
return None
|
||||
else:
|
||||
global seafevents_session
|
||||
|
||||
if not seafevents_session:
|
||||
seafevents_session = seafevents.init_db_session(settings.EVENTS_CONFIG_FILE)
|
||||
|
||||
return seafevents_session()
|
||||
|
Reference in New Issue
Block a user