Skip to content

Commit 70d12c2

Browse files
author
Chris Turner
authored
Merge pull request #634 from dimitri-yatsenko/dev
fix #633
2 parents 991dec4 + 4bd53cf commit 70d12c2

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Release notes
22

3-
### 0.12.0 -- April 15, 2019
3+
### 0.12.0 -- August 15, 2019 (planned)
44

55
* Configurable blob storage (#497, #532, #475)
66
* Support file attachments: (#480, #532, #475)
@@ -12,6 +12,7 @@
1212
* `query_expr.fetch("KEY", as_dict=False)` returns results as `np.recarray`(#414, #574)
1313
* `dj.ERD` is now called `dj.Diagram` (#255, #565)
1414
* `dj.Diagram` underlines "distinguished" classes (#378, #557)
15+
* Bugfixes: #629, #633
1516

1617
### 0.11.1 -- Nov 15, 2018
1718
* Fix ordering of attributes in proj (#483 and #516)

datajoint/declare.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def compile_attribute(line, in_key, foreign_key_sql):
393393
match = attribute_parser.parseString(line + '#', parseAll=True)
394394
except pp.ParseException as err:
395395
raise DataJointError('Declaration error in position {pos} in line:\n {line}\n{msg}'.format(
396-
line=err.args[0], pos=err.args[1], msg=err.args[2]))
396+
line=err.args[0], pos=err.args[1], msg=err.args[2])) from None
397397
match['comment'] = match['comment'].rstrip('#')
398398
if 'default' not in match:
399399
match['default'] = ''
@@ -414,6 +414,9 @@ def compile_attribute(line, in_key, foreign_key_sql):
414414
match['comment'] = match['comment'].replace('"', '\\"') # escape double quotes in comment
415415
category, type_match = match_type(match['type'])
416416

417+
if match['comment'].startswith(':'):
418+
raise DataJointError('An attribute comment must not start with a colon in comment "{comment}"'.format(**match))
419+
417420
if category in CUSTOM_TYPES:
418421
match['comment'] = ':{type}:{comment}'.format(**match) # insert custom type into comment
419422
if category == 'UUID':

datajoint/heading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def init_from_database(self, conn, database, table_name):
219219
attr.pop('Extra')
220220

221221
# process custom DataJoint types
222-
custom_type = re.match(r':(?P<type>.+):(?P<comment>.*)', attr['comment'])
222+
custom_type = re.match(r':(?P<type>[^:]+):(?P<comment>.*)', attr['comment'])
223223
if custom_type:
224224
attr.update(custom_type.groupdict(), unsupported=False)
225225
try:

datajoint/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.12.dev4"
1+
__version__ = "0.12.dev5"

tests/schema_external.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Attach(dj.Manual):
9595
# table for storing attachments
9696
attach : int
9797
----
98-
img : attach@share # attachments are stored as specified by dj.config['stores']['raw']
98+
img : attach@share # attachments are stored as specified by: dj.config['stores']['raw']
9999
txt : attach # attachments are stored directly in the database
100100
"""
101101

@@ -104,7 +104,7 @@ class Attach(dj.Manual):
104104
class Filepath(dj.Manual):
105105
definition = """
106106
# table for file management
107-
fnum : int
107+
fnum : int # test comment containing :
108108
---
109109
img : filepath@repo # managed files
110110
"""

0 commit comments

Comments
 (0)