Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions django/db/backends/postgresql/psycopg_any.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from functools import lru_cache

try:
from psycopg import ClientCursor, IsolationLevel, adapt, adapters, errors, sql
from psycopg import ClientCursor, IsolationLevel, adapt, adapters, errors, pq, sql
from psycopg.postgres import types
from psycopg.types.datetime import TimestamptzLoader
from psycopg.types.json import Jsonb
from psycopg.types.range import Range, RangeDumper
from psycopg.types.string import TextLoader
Expand All @@ -16,23 +15,30 @@

TSRANGE_OID = types["tsrange"].oid
TSTZRANGE_OID = types["tstzrange"].oid
orig_tz_loader_cls = adapters.get_loader(
types["timestamptz"].oid,
pq.Format.TEXT,
)

def mogrify(sql, params, connection):
with connection.cursor() as cursor:
return ClientCursor(cursor.connection).mogrify(sql, params)

# Adapters.
class BaseTzLoader(TimestamptzLoader):
class BaseTzLoader(adapt.Loader):
"""
Load a PostgreSQL timestamptz using the a specific timezone.
The timezone can be None too, in which case it will be chopped.
"""

timezone = None

def __init__(self, oid, context):
super().__init__(oid, context)
self.orig_loader = orig_tz_loader_cls(oid, context)

def load(self, data):
res = super().load(data)
return res.replace(tzinfo=self.timezone)
return self.orig_loader.load(data).replace(tzinfo=self.timezone)

def register_tzloader(tz, context):
class SpecificTzLoader(BaseTzLoader):
Expand Down
4 changes: 4 additions & 0 deletions docs/internals/contributing/triaging-tickets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ The ticket has not been reviewed by anyone who felt qualified to make a
judgment about whether the ticket contained a valid issue or ought to be closed
for any reasons. Unreviewed tickets appear in the "triage" queue.

Unreviewed tickets may receive additional refinement before being accepted.
Unless you are both the author of the ticket and intending to submit a patch,
unreviewed tickets should not be :ref:`claimed <claiming-tickets>`.

Accepted
--------

Expand Down
11 changes: 7 additions & 4 deletions docs/internals/contributing/writing-code/submitting-patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ requests without a Trac ticket.
See the :doc:`/internals/contributing/writing-code/working-with-git` for more
details on how to use pull requests.

.. _claiming-tickets:

"Claiming" tickets
==================

Expand All @@ -40,13 +42,14 @@ and time availability), claim it by following these steps:
`ticket tracker`_. Remember that proposals for new features should follow
the :ref:`process for suggesting new features <requesting-features>`.

* If a ticket for this issue already exists, make sure nobody else has
claimed it. To do this, look at the "Owned by" section of the ticket.
If it's assigned to "nobody," then it's available to be claimed.
* If a ticket for this issue already exists and has been accepted, make sure
nobody else has claimed it. To do this, look at the "Owned by" section of
the ticket. If it's assigned to "nobody," then it's available to be claimed.
Otherwise, somebody else may be working on this ticket. Either find another
bug/feature to work on, or contact the developer working on the ticket to
offer your help. If a ticket has been assigned for weeks or months without
any activity, it's probably safe to reassign it to yourself.
any activity, it's probably safe to reassign it to yourself. If a ticket
hasn't been approved yet, join the conversation.

* Log into your account, if you haven't already, by clicking "GitHub Login"
or "DjangoProject Login" in the upper left of the ticket page. Once logged
Expand Down
2 changes: 1 addition & 1 deletion docs/spelling_wordlist
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ unpythonic
Unregisters
unrendered
unreproducible
Unreviewed
unreviewed
unsanitized
unselected
unsets
Expand Down
Loading