refactor!: drop github connector from ERPNext (#31316)
This commit is contained in:
parent
1646fbe478
commit
3a3d13622d
@ -1,44 +0,0 @@
|
||||
import frappe
|
||||
from frappe.data_migration.doctype.data_migration_connector.connectors.base import BaseConnection
|
||||
from github import Github
|
||||
|
||||
class GithubConnection(BaseConnection):
|
||||
def __init__(self, connector):
|
||||
self.connector = connector
|
||||
|
||||
try:
|
||||
password = self.get_password()
|
||||
except frappe.AuthenticationError:
|
||||
password = None
|
||||
|
||||
if self.connector.username and password:
|
||||
self.connection = Github(self.connector.username, self.get_password())
|
||||
else:
|
||||
self.connection = Github()
|
||||
|
||||
self.name_field = 'id'
|
||||
|
||||
def insert(self, doctype, doc):
|
||||
pass
|
||||
|
||||
def update(self, doctype, doc, migration_id):
|
||||
pass
|
||||
|
||||
def delete(self, doctype, migration_id):
|
||||
pass
|
||||
|
||||
def get(self, remote_objectname, fields=None, filters=None, start=0, page_length=10):
|
||||
repo = filters.get('repo')
|
||||
|
||||
if remote_objectname == 'Milestone':
|
||||
return self.get_milestones(repo, start, page_length)
|
||||
if remote_objectname == 'Issue':
|
||||
return self.get_issues(repo, start, page_length)
|
||||
|
||||
def get_milestones(self, repo, start=0, page_length=10):
|
||||
_repo = self.connection.get_repo(repo)
|
||||
return list(_repo.get_milestones()[start:start+page_length])
|
||||
|
||||
def get_issues(self, repo, start=0, page_length=10):
|
||||
_repo = self.connection.get_repo(repo)
|
||||
return list(_repo.get_issues()[start:start+page_length])
|
@ -1,12 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def pre_process(issue):
|
||||
|
||||
project = frappe.db.get_value("Project", filters={"project_name": issue.milestone})
|
||||
return {
|
||||
"title": issue.title,
|
||||
"body": frappe.utils.md_to_html(issue.body or ""),
|
||||
"state": issue.state.title(),
|
||||
"project": project or "",
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
{
|
||||
"condition": "{\"repo\":\"frappe/erpnext\"}",
|
||||
"creation": "2017-10-16 16:03:32.772191",
|
||||
"docstatus": 0,
|
||||
"doctype": "Data Migration Mapping",
|
||||
"fields": [
|
||||
{
|
||||
"is_child_table": 0,
|
||||
"local_fieldname": "subject",
|
||||
"remote_fieldname": "title"
|
||||
},
|
||||
{
|
||||
"is_child_table": 0,
|
||||
"local_fieldname": "description",
|
||||
"remote_fieldname": "body"
|
||||
},
|
||||
{
|
||||
"is_child_table": 0,
|
||||
"local_fieldname": "status",
|
||||
"remote_fieldname": "state"
|
||||
}
|
||||
],
|
||||
"idx": 0,
|
||||
"local_doctype": "Task",
|
||||
"local_primary_key": "name",
|
||||
"mapping_name": "Issue to Task",
|
||||
"mapping_type": "Pull",
|
||||
"migration_id_field": "github_sync_id",
|
||||
"modified": "2017-10-20 11:48:54.575993",
|
||||
"modified_by": "Administrator",
|
||||
"name": "Issue to Task",
|
||||
"owner": "Administrator",
|
||||
"page_length": 10,
|
||||
"remote_objectname": "Issue",
|
||||
"remote_primary_key": "id"
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
def pre_process(milestone):
|
||||
return {
|
||||
"title": milestone.title,
|
||||
"description": milestone.description,
|
||||
"state": milestone.state.title(),
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
{
|
||||
"condition": "{\"repo\": \"frappe/erpnext\"}",
|
||||
"creation": "2017-10-13 11:16:49.664925",
|
||||
"docstatus": 0,
|
||||
"doctype": "Data Migration Mapping",
|
||||
"fields": [
|
||||
{
|
||||
"is_child_table": 0,
|
||||
"local_fieldname": "project_name",
|
||||
"remote_fieldname": "title"
|
||||
},
|
||||
{
|
||||
"is_child_table": 0,
|
||||
"local_fieldname": "notes",
|
||||
"remote_fieldname": "description"
|
||||
},
|
||||
{
|
||||
"is_child_table": 0,
|
||||
"local_fieldname": "status",
|
||||
"remote_fieldname": "state"
|
||||
}
|
||||
],
|
||||
"idx": 0,
|
||||
"local_doctype": "Project",
|
||||
"local_primary_key": "project_name",
|
||||
"mapping_name": "Milestone to Project",
|
||||
"mapping_type": "Pull",
|
||||
"migration_id_field": "github_sync_id",
|
||||
"modified": "2017-10-20 11:48:54.552305",
|
||||
"modified_by": "Administrator",
|
||||
"name": "Milestone to Project",
|
||||
"owner": "Administrator",
|
||||
"page_length": 10,
|
||||
"remote_objectname": "Milestone",
|
||||
"remote_primary_key": "id"
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"creation": "2017-10-13 11:16:53.600026",
|
||||
"docstatus": 0,
|
||||
"doctype": "Data Migration Plan",
|
||||
"idx": 0,
|
||||
"mappings": [
|
||||
{
|
||||
"enabled": 1,
|
||||
"mapping": "Milestone to Project"
|
||||
},
|
||||
{
|
||||
"enabled": 1,
|
||||
"mapping": "Issue to Task"
|
||||
}
|
||||
],
|
||||
"modified": "2017-10-20 11:48:54.496123",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Integrations",
|
||||
"name": "GitHub Sync",
|
||||
"owner": "Administrator",
|
||||
"plan_name": "GitHub Sync"
|
||||
}
|
@ -3,7 +3,6 @@ gocardless-pro~=1.22.0
|
||||
googlemaps
|
||||
plaid-python~=7.2.1
|
||||
pycountry~=20.7.3
|
||||
PyGithub~=1.55
|
||||
python-stdnum~=1.16
|
||||
python-youtube~=0.8.0
|
||||
taxjar~=1.9.2
|
||||
|
Loading…
Reference in New Issue
Block a user