Skip to content

Commit

Permalink
Merge branch 'ghini-3.1-dev' into ghini-3.1, as 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrasca committed Sep 15, 2018
2 parents 1f15f72 + 361d938 commit 17c6eeb
Show file tree
Hide file tree
Showing 168 changed files with 5,708 additions and 3,623 deletions.
16 changes: 8 additions & 8 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ cache:
- msys2-i686-20180531.exe

deploy:
release: 'v3.1.5' # :bump
release: 'v3.1.6' # :bump
description: ''
provider: GitHub
auth_token:
secure: # see: https://www.appveyor.com/docs/how-to/git-push/#creating-github-personal-access-token
draft: false
prerelease: false
# on:
# appveyor_repo_tag: true # deploy on tag push only
- provider: GitHub
auth_token:
secure: # see: https://www.appveyor.com/docs/how-to/git-push/#creating-github-personal-access-token
draft: false
prerelease: false
# on:
# appveyor_repo_tag: true # deploy on tag push only

#on_success:
# You can use this step to upload your artifacts to a public website.
Expand Down
10 changes: 6 additions & 4 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
As a <user type>, I want to <task>, so that <goal>.

### Expected behaviour

### Actual behaviour

### Steps to reproduce the behaviour

##### How to set up the same initial situation
#### How to set up the same initial situation

##### Which actions to take in sequence, which contribute to create the critical situation
#### Which actions to take in sequence, which contribute to create the critical situation

##### Last step, with the unexpected result
#### Last step, with the unexpected result

##### Opinions and suggestions
#### Opinions and suggestions
24 changes: 6 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,9 @@ doc/*.txt
po/*.mo
pot

## temporary files from the Cuchubo activity. ask [email protected]
scripts/drop2bauble.py
scripts/fixme.py
scripts/gh-issues-import.py
scripts/map2db.py
scripts/tomongo.py
scripts/what_are_the_problems.py
scripts/what_is_available.py
scripts/ghini.lnk
bauble/test/test_search2.py
bauble/multiple-orig.py
bauble/multiple.py
piccolo_test.py
po/.doctrees/
issues/
doc/_build/
doc/locale/
bauble/plugins/plants/ipni.org/
.build/
cover/
.project
Expand All @@ -102,12 +87,15 @@ issue-0177.py
issue-0177.py.txt
try-me

## temporary files from the Cuchubo activity. ask [email protected]
aaa-start-here.py
glade-tester.py
glade-tester.glade

todo*.txt
from_*.tar.gz
settings.json
odk-seen.json
lab-csv2json.py
test.py
imex-it.rst
ghini.py
ghini.py
what-icon-at-menuitem.org
2 changes: 1 addition & 1 deletion bauble/bauble.glade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="gtk+" version="3.18"/>
<object class="GtkListStore" id="history_ls">
<columns>
<!-- column-name timestamp -->
Expand Down
6 changes: 3 additions & 3 deletions bauble/btypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ def __init__(self, values, empty_to_none=False, strict=True,
if len(values) != len(set(values)):
raise EnumError(_('Enum requires the values to be different'))
self.translations = dict((v, v) for v in values)
for key, value in translations.items():
self.translations[key] = value
if empty_to_none and (None not in values):
raise EnumError(_('You have configured empty_to_none=True but '
'None is not in the values lists'))
self.values = values[:]
self.values = values[:] # copy, not reference
self.strict = strict
self.empty_to_none = empty_to_none
# the length of the string/unicode column should be the
Expand All @@ -81,6 +79,8 @@ def process_bind_param(self, value, dialect):
logger.debug('Enum::process_bind_param %s %s(%s)' % (type(self).__name__, type(value).__name__, value))
if (self.empty_to_none) and (not value):
value = None
if value is None and None not in self.values and '' in self.values:
value = ''
if value not in self.values:
raise EnumError(_('%(type_name)s(%(value)s) not in Enum.values: %(all_values)s'
) % {'value': value,
Expand Down
2 changes: 1 addition & 1 deletion bauble/connmgr.glade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="gtk+" version="3.18"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name gchararray1 -->
Expand Down
68 changes: 43 additions & 25 deletions bauble/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,9 @@ def as_dict_default(self):
'__mapper_args__': {'order_by': table_name + '.date'},

'date': sa.Column(types.Date, default=sa.func.now()),
'user': sa.Column(sa.Unicode(64)),
'category': sa.Column(sa.Unicode(32)),
'type': sa.Column(sa.Unicode(32)),
'user': sa.Column(sa.Unicode(64), default=''),
'category': sa.Column(sa.Unicode(32), default=''),
'type': sa.Column(sa.Unicode(32), default=''),
'note': sa.Column(sa.UnicodeText, nullable=False),
name.lower() + '_id': sa.Column(sa.Integer, sa.ForeignKey(name.lower() + '.id'), nullable=False),
name.lower(): sa.orm.relation(name, uselist=False, backref=sa.orm.backref(
Expand Down Expand Up @@ -572,7 +572,9 @@ def __getattr__(self, name):
result = []
is_dict = False
for n in self.notes:
if n.category == ('[%s]' % name):
if n.category is None:
pass
elif n.category == ('[%s]' % name):
result.append(n.note)
elif n.category.startswith('{%s:' % name) and n.category.endswith('}'):
is_dict = True
Expand Down Expand Up @@ -788,24 +790,40 @@ def class_of_object(o):
return cls


def current_user():
'''return current user name: from database, or system
'''
try:
if engine.name.startswith('postgresql'):
r = engine.execute('select current_user;')
user = r.fetchone()[0]
r.close()
elif engine.name.startswith('mysql'):
r = engine.execute('select current_user();')
user = r.fetchone()[0]
r.close()
else:
raise TypeError()
except:
logger.debug("retrieving user name from system")
user = (os.getenv('USER') or os.getenv('USERNAME') or
os.getenv('LOGNAME') or os.getenv('LNAME'))

return user

class current_user_functor:
"""implement the current_user function, and allow overriding.
invoke the current_user object as a function.
invoke current_user.override(user_name) to set user name.
invoke current_user.override() to reset.
"""
def __init__(self):
self.override_value = None

def override(self, value=None):
self.override_value = value

def __call__(self):
'''return current user name: from database, or system
'''
if self.override_value:
return self.override_value
try:
if engine.name.startswith('postgresql'):
r = engine.execute('select current_user;')
user = r.fetchone()[0]
r.close()
elif engine.name.startswith('mysql'):
r = engine.execute('select current_user();')
user = r.fetchone()[0]
r.close()
else:
raise TypeError()
except:
logger.debug("retrieving user name from system")
user = (os.getenv('USER') or os.getenv('USERNAME') or
os.getenv('LOGNAME') or os.getenv('LNAME'))

return user

current_user = current_user_functor()
9 changes: 6 additions & 3 deletions bauble/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,13 @@ def on_text_entry_changed(self, widget, value=None):
return value

def on_numeric_text_entry_changed(self, widget, value=None):
"handle 'changed' signal on numeric text entry widgets."
"""handle 'changed' signal on numeric text entry widgets.
if the widget is associated to a model attribute, new value is
type-checked. as long as the user types digits, they are accepted.
whatever else gets ignored.
"""
attr = self.__get_widget_attr(widget)
if attr is None:
return
Expand All @@ -1285,8 +1290,6 @@ def on_numeric_text_entry_changed(self, widget, value=None):
value = 0
try:
value = int(value)
logger.debug("on_text_entry_changed(%s, %s) - %s → %s"
% (widget, attr, getattr(self.model, attr), value))
self.__set_model_attr(attr, value)
except:
value = getattr(self.model, attr)
Expand Down
Binary file modified bauble/images/bauble_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 17c6eeb

Please sign in to comment.