GHC 2020-03-04

4 comments.

, https://git.io/JvVJP in jarun/googler
Fix regression caused by #322
=============================

Need to check not None and convert from None to empty string when dealing with
from and to.

, https://git.io/JvVJX in jarun/googler
Oops, just saw this. Will fix.

, https://git.io/JvVJ1 in jarun/googler
It highly depends on IP reputation. Some IPs (e.g. my Newark, NJ Linode IPs) get blocked every single time. Some other non-residential IPs I've used won't. Commercial VPN services are pretty much guaranteed to be blocked both from my personal experience and what I heard.

I doubt this has anything to do with HTTP/2, but in any case we can't really use HTTP/2 unless PSL adds support for it. It's a complicated protocol btw, even urllib3 and by extension requests don't support it. There's been talk for more than half a decade too. bpo-23794: https://bugs.python.org/issue23794

, https://git.io/Jvab4 in coleifer/peewee
prefetch fails when foreign key field or target primary key field not selected
==============================================================================

This is not a bug, but rather a minor UX issue. Consider this simple example:

```python
import peewee


db = peewee.SqliteDatabase(":memory:")


class _BaseModel(peewee.Model):
    class Meta:
        database = db


class User(_BaseModel):
    name = peewee.TextField()


class Entry(_BaseModel):
    user = peewee.ForeignKeyField(User, backref="entries")
    content = peewee.TextField()


def main():
    db.create_tables([User, Entry])
    User.insert(name="foo").execute()
    Entry.insert(user_id=1, content="bar").execute()
    user_query = User.select(User.name)  # User.id not selected
    entry_query = Entry.select(Entry.content)  # Entry.user_id not selected
    peewee.prefetch(user_query, entry_query)


if __name__ == "__main__":
    main()
```

The prefetch fails when either `User.id` or `Entry.user_id` is not selected, as prefetch can't link the models together without either. The errors are slightly cryptic too if one doesn't realize what's going on

```python-traceback
...
  File "/Users/zmwang/.pyenv/versions/3.8.0/lib/python3.8/site-packages/peewee.py", line 7421, in store_instance
    identity = field.rel_field.python_value(instance.__data__[attname])
KeyError: 'user'
```

```python-traceback
...
  File "/Users/zmwang/.pyenv/versions/3.8.0/lib/python3.8/site-packages/peewee.py", line 7412, in populate_instance
    identifier = instance.__data__[field.rel_field.name]
KeyError: 'id'
```

(It may seem silly to specify the fields to be selected in this simple example, but in general I refrain from `SELECT *` and only select what I need.)

Maybe `prefetch` could add the relation fields it require automatically? Not sure about feasibility implementation-wise. Failing that, maybe add a little note to the API docs?