SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 0d3db738 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add git url and clone url to proof repo model

remove https from gitlab url
parent be5122f3
No related branches found
No related tags found
1 merge request!42Add git integration to server
...@@ -573,5 +573,5 @@ CORS_ALLOWED_ORIGINS = [ ...@@ -573,5 +573,5 @@ CORS_ALLOWED_ORIGINS = [
# GitLab API # GitLab API
GITLAB_ROOT = "SciPost" GITLAB_ROOT = "SciPost"
GITLAB_URL = "https://git.scipost.org/" GITLAB_URL = "git.scipost.org"
GITLAB_KEY = get_secret("GITLAB_KEY") GITLAB_KEY = get_secret("GITLAB_KEY")
...@@ -69,7 +69,10 @@ class Command(BaseCommand): ...@@ -69,7 +69,10 @@ class Command(BaseCommand):
"Constant `GITLAB_URL` is either not present in secret file or empty, please add it." "Constant `GITLAB_URL` is either not present in secret file or empty, please add it."
) )
GL = Gitlab(url=settings.GITLAB_URL, private_token=settings.GITLAB_KEY) GL = Gitlab(
url="https://" + settings.GITLAB_URL,
private_token=settings.GITLAB_KEY,
)
try: try:
GL.auth() GL.auth()
...@@ -101,9 +104,9 @@ class Command(BaseCommand): ...@@ -101,9 +104,9 @@ class Command(BaseCommand):
# Guard against the root group not existing # Guard against the root group not existing
if parent_group is None: if parent_group is None:
raise AssertionError( raise AssertionError(
f"The parent group of {path_up_to_segment_i} does not exist. \ f"The parent group of {path_up_to_segment_i} does not exist. "
This should not happen normally (and would not be fixable \ "This should not happen normally (and would not be fixable "
because GitLab does not allow root groups to be created)." "because GitLab does not allow root groups to be created)."
) )
# Create the group # Create the group
...@@ -300,7 +303,7 @@ class Command(BaseCommand): ...@@ -300,7 +303,7 @@ class Command(BaseCommand):
def format_affiliations(authors: List[str]) -> str: def format_affiliations(authors: List[str]) -> str:
""" """
Format the affiliations of the authors in the submission,\ Format the affiliations of the authors in the submission,
by including the author's name and the affiliation number. by including the author's name and the affiliation number.
There is one affiliation per author by default. There is one affiliation per author by default.
""" """
......
...@@ -325,6 +325,20 @@ class ProofsRepository(models.Model): ...@@ -325,6 +325,20 @@ class ProofsRepository(models.Model):
repo_name=self.name, repo_name=self.name,
) )
@property
def git_url(self) -> str:
return "https://{GITLAB_URL}/{git_path}".format(
GITLAB_URL=settings.GITLAB_URL,
git_path=self.git_path,
)
@property
def git_ssh_clone_url(self) -> str:
return "git:{GITLAB_URL}/{git_path}.git".format(
GITLAB_URL=settings.GITLAB_URL,
git_path=self.git_path,
)
@property @property
def template_path(self) -> str: def template_path(self) -> str:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment