Skip to content
Snippets Groups Projects
Commit b73a6a0d authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'release-v0.7.0' into 'main'

Release v0.7.0

See merge request !69
parents 2ebfbc0a a5dd5cb3
No related branches found
Tags v0.7.0
1 merge request!69Release v0.7.0
Pipeline #34435 passed
......@@ -17,3 +17,4 @@ build/
# documentation
_apidoc
/dist/
## Summary
*Please give a short summary of what the issue is.*
## Expected Behavior
*What did you expect how the software should behave?*
## Actual Behavior
*What did the software actually do?*
## Steps to Reproduce the Problem
*Please describe, step by step, how others can reproduce the problem. Please try these steps for yourself on a clean system.*
1.
2.
3.
## Specifications
- Version: *Which version of this software?*
- Platform: *Which operating system, which other relevant software versions?*
## Possible fixes
*Do you have ideas how the issue can be resolved?*
# Summary
*Insert a meaningful description for this merge request here: What is the new/changed behavior?
Which bug has been fixed? Are there related issues?*
# Focus
*Point the reviewer to the core of the code change. Where should they start reading? What should
they focus on (e.g. security, performance, maintainability, user-friendliness, compliance with the
specs, finding more corner cases, concrete questions)?*
# Test Environment
*How to set up a test environment for manual testing?*
# Check List for the Author
Please, prepare your MR for a review. Be sure to write a summary and a focus and create gitlab
comments for the reviewer. They should guide the reviewer through the changes, explain your changes
and also point out open questions. For further good practices have a look at [our review
guidelines](https://gitlab.com/caosdb/caosdb/-/blob/dev/REVIEW_GUIDELINES.md)
- [ ] All automated tests pass
- [ ] Reference related issues
- [ ] Up-to-date CHANGELOG.md (or not necessary)
- [ ] Up-to-date JSON schema (or not necessary)
- [ ] Appropriate user and developer documentation (or not necessary)
- How do I use the software? Assume "stupid" users.
- How do I develop or debug the software? Assume novice developers.
- [ ] Annotations in code (Gitlab comments)
- Intent of new code
- Problems with old code
- Why this implementation?
# Check List for the Reviewer
- [ ] I understand the intent of this MR
- [ ] All automated tests pass
- [ ] Up-to-date CHANGELOG.md (or not necessary)
- [ ] Appropriate user and developer documentation (or not necessary)
- [ ] The test environment setup works and the intended behavior is reproducible in the test
environment
- [ ] In-code documentation and comments are up-to-date.
- [ ] Check: Are there specifications? Are they satisfied?
For further good practices have a look at [our review guidelines](https://gitlab.com/caosdb/caosdb/-/blob/dev/REVIEW_GUIDELINES.md).
/assign me
/target_branch dev
......@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.7.0] - 2023-03-09 ##
(Florian Spreckelsen)
### Added ###
- `create_entity_link` function to create html links to entities; useful for
logging
## [0.6.1] - 2023-01-20##
### Added ###
......
......@@ -20,6 +20,6 @@ authors:
given-names: Stefan
orcid: https://orcid.org/0000-0001-7214-8125
title: CaosDB - Advanced User Tools
version: 0.6.1
version: 0.7.0
doi: 10.3390/data4020083
date-released: 2023-01-20
\ No newline at end of file
......@@ -46,8 +46,8 @@ from setuptools import find_packages, setup
########################################################################
MAJOR = 0
MINOR = 6
MICRO = 1
MINOR = 7
MICRO = 0
PRE = "" # e.g. rc0, alpha.1, 0.beta-23
ISRELEASED = True
......
......@@ -58,6 +58,7 @@ from .guard import RETRIEVE, ProhibitedException
from .guard import global_guard as guard
from .serverside.helper import send_mail as main_send_mail
from .suppressKnown import SuppressKnown
from .utils import create_entity_link
logger = logging.getLogger(__name__)
......@@ -103,15 +104,8 @@ def apply_list_of_updates(to_be_updated, update_flags={},
info = "UPDATE: updating the following entities\n"
baseurl = db.configuration.get_config()["Connection"]["url"]
def make_clickable(txt, id):
return "<a href='{}/Entity/{}'>{}</a>".format(baseurl, id, txt)
for el in to_be_updated:
info += str("\t" + make_clickable(el.name, el.id)
if el.name is not None
else "\t" + make_clickable(str(el.id), el.id))
info += str("\t" + create_entity_link(el))
info += "\n"
logger.info(info)
......
......@@ -175,8 +175,6 @@ def loadpath(path, include, exclude, prefix, dryrun, forceAllowSymlinks, caosdbi
for f in files:
totalsize += f.size
print("Made in total {} new files with a combined size of {} "
"accessible.".format(len(files), convert_size(totalsize)))
logger.info("Made in total {} new files with a combined size of {} "
"accessible.".format(len(files), convert_size(totalsize)))
......@@ -249,6 +247,10 @@ exclude is given preference over include.
raise ValueError(
"Do not use a localpath and in- or exclude simultaneously!")
# configure logging
logger.addHandler(logging.StreamHandler(stream=sys.stdout))
logger.setLevel(logging.INFO)
con = db.get_connection()
con.timeout = float(args.timeout)
con._login()
......
......@@ -55,6 +55,26 @@ def replace_path_prefix(path, old_prefix, new_prefix):
return os.path.join(new_prefix, path)
def create_entity_link(entity: db.Entity, base_url: str = ""):
"""
creates a string that contains the code for an html link to the provided entity.
The text of the link is the entity name if one exists and the id otherwise.
Args:
entity (db.Entity): the entity object to which the link will point
base_url (str): optional, by default, the url starts with '/Entity' and thus is relative.
You can provide a base url that will be prefixed.
Returns:
str: the string containing the html code
"""
return "<a href='{}/Entity/{}'>{}</a>".format(
base_url,
entity.id,
entity.name if entity.name is not None else entity.id)
def string_to_person(person):
"""
Creates a Person Record from a string.
......
......@@ -27,9 +27,9 @@ copyright = '2021, IndiScale GmbH'
author = 'Daniel Hornung'
# The short X.Y version
version = '0.6.1'
version = '0.7.0'
# The full version, including alpha/beta/rc tags
release = '0.6.1'
release = '0.7.0'
# -- General configuration ---------------------------------------------------
......
......@@ -164,7 +164,7 @@ def test_enum():
assert isinstance(model[name], db.Record)
assert model[name].name == name
assert len(model[name].parents) == 1
assert model[name].has_parent(model["license"])
assert model[name].has_parent(model["license"], retrieve=False)
# Also allow enums with non-string types
number_enums = ["1.1", "2.2", "3.3"]
......@@ -181,7 +181,7 @@ def test_enum():
assert isinstance(model[name], db.Record)
assert model[name].name == name
assert len(model[name].parents) == 1
assert model[name].has_parent(model["number_enum"])
assert model[name].has_parent(model["number_enum"], retrieve=False)
@pytest.mark.xfail(reason="Don't allow integer enums until https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/224 has been fixed")
......@@ -207,7 +207,7 @@ def test_int_enum():
assert isinstance(model[name], db.Record)
assert model[name].name == name
assert len(model[name].parents) == 1
assert model[name].has_parent(model["int_enum"])
assert model[name].has_parent(model["int_enum"], retrieve=False)
def test_references():
......@@ -339,7 +339,7 @@ def test_list():
assert isinstance(model[name], db.Record)
assert model[name].name == name
assert len(model[name].parents) == 1
assert model[name].has_parent(model["license"])
assert model[name].has_parent(model["license"], retrieve=False)
def test_name_property():
......
......@@ -26,7 +26,7 @@ from tempfile import NamedTemporaryFile
import caosdb as db
from caosadvancedtools.utils import (check_win_path, get_referenced_files,
string_to_person)
string_to_person, create_entity_link)
from caosdb import RecordType, configure_connection, get_config
from caosdb.connection.mockup import MockUpResponse, MockUpServerConnection
from caosdb.exceptions import TransactionError
......@@ -140,3 +140,8 @@ class PathTest(unittest.TestCase):
assert check_win_path(r"C:\hallo")
assert check_win_path(r"\hallo")
assert not check_win_path("/hallo")
class EntityLinkTest(unittest.TestCase):
def test_link(self):
assert "<a href='/Entity/1'>a</a>" == create_entity_link(db.Entity(id=1, name='a'))
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