Skip to content

Commit

Permalink
Merge pull request #87 from cityofaustin/dev
Browse files Browse the repository at this point in the history
Production to 1.0.18
  • Loading branch information
chiaberry committed May 3, 2021
2 parents 129a243 + c431a1d commit 3ab9c29
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ $ pip install -e knackpy

We test with [`pytest`](docs.pytest.org/en/stable), [`coverage`](coverage.readthedocs.io), and [`pytest-env`](https://github.com/MobileDynasty/pytest-env).

### Knacky Development Knack Application
### Knackpy Development Knack Application

Tests for `app.py` and `api.py` are dependendent on a City of Austin-owned Knack application which we rely on for over-the-wire API tests. If you work for the City of Austin Transportation Department, the credentials for this app are in our password store, and the app is called "Knackpy Development".
Tests for `app.py` and `api.py` are dependent on a City of Austin-owned Knack application which we rely on for over-the-wire API tests. If you work for the City of Austin Transportation Department, the credentials for this app are in our password store, and the app is called "Knackpy Development".

Any modifications you make to the Knackpy Development app may impact tests. You should carefully review our `tests/` before you modify _anything_ in the development app.

Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ Knackpy is designed around the `App` class. It provides helpers for querying
and manipulating Knack application data. You should use the `App` class
because:

- It allows you to query obejcts and views by key or name
- It allows you to query objects and views by key or name
- It takes care of [localization issues](#timestamps-and-localization)
- It let's you download and upload files from your app.
- It lets you download and upload files from your app.
- It does other things, too.

To create an `App` instance, the bare minimum you need to provide is your [application ID](https://www.knack.com/developer-documentation/#find-your-api-key-amp-application-id).
Expand Down Expand Up @@ -102,7 +102,7 @@ For faster performance, set `generate=true` when getting records from your app.
Namespace conflicts are highly likely when fetching by name, because Knack uses object names as the default name for views. If you attempt to query your application by a name that exists as both an object and a view, Knackpy will raise a `ValueError`.
{{< /hint >}}

You can resuse the same `App` instance to fetch records from other objects and views.
You can reuse the same `App` instance to fetch records from other objects and views.

```python
>>> app.get("my_exciting_object")
Expand Down
9 changes: 6 additions & 3 deletions knackpy/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ def default(value: object):
(aka, humanized) value.
The `default()` formatter handles any field type for which another formatter
function has not been defined. It simply returns the input value without additional
formatting.
function has not been defined. If the input value is a list, it returns a comma
separated string of list values. Otherwise, it simply returns the input value
without additional formatting.
You'll notice that each formatter function's name matches its field type. If you
want to write a custom formatter, do that.
See also: knackpy.Fields
"""
if isinstance(value, list):
return ", ".join(str(v) for v in value)
return value


Expand All @@ -32,7 +35,7 @@ def multiple_choice(value: Union[list, str]):
# account for this odd [None] value for empty multi-select fields
if value == [None]:
return None
# we use string formatting to handle the possiblity that the list contains ints
# we use string formatting to handle the possibility that the list contains ints
return ", ".join([f"{val}" for val in value])
return value

Expand Down
2 changes: 1 addition & 1 deletion knackpy/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _handle_fields(self):
# store the raw data if available
value = self.raw[key_raw] if key_raw in self.raw else self.raw[key]

# there are a fiew fields where it's easier to just use knack's formatted
# there are a few fields where it's easier to just use knack's formatted
# value. E.g. timer and name. in those cases, we want to store knack's
# formatted value so that we can reference it when we assign a value to
# Field.formatted.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def build_config(env, readme="README.md"):
"packages": ["knackpy"],
"tests_require": ["pytest", "coverage"],
"url": "http://github.com/cityofaustin/knackpy",
"version": "1.0.17",
"version": "1.0.18",
}


Expand Down

0 comments on commit 3ab9c29

Please sign in to comment.