def clone_github_repo(self, settings, dbrepo_id): dburl = settings['sqlalchemy.url'] sessionmaker = make_postgresql_session(dburl) session = sessionmaker() user_id = int(settings['default.github.user_id']) mgr = GHRepoManager(session, user_id) mgr.set_repo_path(settings['default.github.repo_path']) dbrepo = mgr.get(dbrepo_id) repo = mgr.clone_repo(dbrepo) return repo
class RepoCalendarView(BaseUserViewCallable): def __init__(self, request): super(RepoCalendarView, self).__init__(request) settings = request.registry.settings user_id = int(settings['default.github.user_id']) self.mgr = GHRepoManager(request.db, user_id) self.get_ranged_repos() def get_ranged_repos(self, timestamps=False): start, end = get_start_end_from_request(self.request, timestamps=timestamps) #print start, end, "SDFSDFDFSDF" repos = self.mgr.get_ranged_repos(start, end) rlist = list() for rp in repos: rdata = rp.serialize() #import pdb ; pdb.set_trace() #del rdata['pickle'] if 'allDay' not in rdata: rdata['allDay'] = False rdata['title'] = rp.full_name rdata['start'] = rdata['updated_at_gh'] rdata['api_url'] = rdata['url'] del rdata['url'] rlist.append(rdata) self.response = rlist
def __init__(self, request): super(BaseRepoView, self).__init__(request) settings = self.get_app_settings() user_id = int(settings['default.github.user_id']) self.mgr = GHRepoManager(request.db, user_id) self.mgr.set_repo_path(settings['default.github.repo_path']) self.mgr.set_github_client(settings['github_client']) self.taskmgr = TenyuTaskManager(request.db)
class BaseRepoView(BaseResource): def __init__(self, request): super(BaseRepoView, self).__init__(request) settings = self.get_app_settings() user_id = int(settings['default.github.user_id']) self.mgr = GHRepoManager(request.db, user_id) self.mgr.set_repo_path(settings['default.github.repo_path']) self.mgr.set_github_client(settings['github_client']) self.taskmgr = TenyuTaskManager(request.db) def serialize_object(self, dbobj): return self.mgr.serialize('ignore', dbobj=dbobj) def get(self): id = self.request.matchdict['id'] return self.mgr.serialize(id) def put(self): id = self.request.matchdict['id'] raise NotImplementedError, "do something"
def __init__(self, request): super(RepoCalendarView, self).__init__(request) settings = request.registry.settings user_id = int(settings['default.github.user_id']) self.mgr = GHRepoManager(request.db, user_id) self.get_ranged_repos()