profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/evildmp/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Daniele Procida evildmp Cardiff, Wales Creator of Diátaxis and BrachioGraph. Django core developer. Fellow of the Python Software Foundation.

evildmp/BrachioGraph 506

BrachioGraph is an ultra-cheap (total cost of materials: €14) plotter that can be built with minimal skills.

evildmp/C-is-for-Camera 146

A 35mm camera, based on the Canonet G-III QL17 rangefinder, modelled in Python.

evildmp/Arkestra 140

Arkestra extends Django CMS to provide an intelligent semantic web publishing system for organisations and institutions.

evildmp/diataxis-documentation-framework 116

"The Grand Unified Theory of Documentation" (David Laing) - a popular and transformative documentation authoring framework

evildmp/afraid-to-commit 99

Don't be afraid to commit - a workshop/tutorial for inexperienced Python/Django developers who would like to contribute more to the projects they use.

evildmp/DjangoConEuropeTranscripts 12

Proceedings from DjangoCon Europe 2015

evildmp/django-inspector 10

Inspects and reports on Django sites

evildmp/conference-handbook 9

Handbook for open-source software community conference organisers

evildmp/linedraw 9

Convert images to vectorized line drawings for plotters.

pull request commentdjango/django

Fixed #26721 -- Doc'd setting UTF-8 on Windows

Recommend the Python option first, then if that doesn't work change the system wide setting?

smithdc1

comment created time in an hour

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 def _create_index_sql(self, model, *, fields=None, **kwargs):         elif field.dim > 2 and not field.geography:             # Use "nd" ops which are fast on multidimensional cases             field_column = "%s %s" % (field_column, self.geom_index_ops_nd)-        if kwargs.get('name') is None:-            index_name = '%s_%s_id' % (model._meta.db_table, field.column)-        else:-            index_name = kwargs['name']++        name = kwargs.get("name")+        if not name:+            name = self._create_index_name(+                table, [field.column], kwargs.get("suffix", "")+            )          return Statement(             self.sql_create_index,-            name=self.quote_name(index_name),-            table=self.quote_name(model._meta.db_table),+            name=self.quote_name(name),+            table=self.quote_name(table),

Sounds like a good change. I am wondering if this should be in a separate ticket for clarity in the changeset?

snowman2

comment created time in an hour

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 def _create_index_sql(self, model, *, fields=None, **kwargs):         elif field.dim > 2 and not field.geography:             # Use "nd" ops which are fast on multidimensional cases             field_column = "%s %s" % (field_column, self.geom_index_ops_nd)-        if kwargs.get('name') is None:-            index_name = '%s_%s_id' % (model._meta.db_table, field.column)-        else:-            index_name = kwargs['name']++        name = kwargs.get("name")+        if not name:+            name = self._create_index_name(+                table, [field.column], kwargs.get("suffix", "")+            )
  1. Current main: source"."mymodel_geometry_id
  2. Current PR (Allows user to specify suffix - consistent with posgresql backend): mymodel_geometry_26ff3048
  3. Desired change (User cannot specify suffix): mymodel_geometry_26ff3048_id

You want option 3, correct?

snowman2

comment created time in an hour

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 from django.db.models import Index from django.test import TransactionTestCase -from .models import City+from .models import City, SchemaCity   class SchemaIndexesTests(TransactionTestCase):     available_apps = []-    models = [City]+    models = [City, SchemaCity]

Perfect - thanks :+1:

snowman2

comment created time in 2 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    num = abs(int(s))+    if num == 0:+        return '0'++    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    res = ''+    while num > 0:+        res = BASE62_ALPHABET[num % 62] + res+        num //= 62++    return sign + res+++def b62_decode(s):+    s = str(s)

The deprecated version accepts int and str. If we remove this line, this won't support int

hramezani

comment created time in 2 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    num = abs(int(s))+    if num == 0:+        return '0'++    sign = ''+    if str(s)[0] == '-':+        sign = '-'+

Yes, you are right. but the deprecated version in baseconv accepts str and int as input. That's why I convert it to str and then compare the first char.

hramezani

comment created time in 2 hours

pull request commentdjango/django

Fix default time zone support inconsistency in docs

@swright573 IMO we shouldn't change the current wording, it's correct. There is also a note about the USE_TZ value in the default settings.py, so I don't see a need for further clarifications.

aalvrz

comment created time in 2 hours

push eventdjango/django

Nick Pope

commit sha bdd565422df704d677a12f93bf01c0e4ae7035ed

[3.2.x] Fixed typo in docs/internals/contributing/writing-documentation.txt. Backport of c240ceea7d88c6a8058dcacb37356c93e0a3618f from main

view details

push time in 2 hours

push eventdjango/django

Nick Pope

commit sha c240ceea7d88c6a8058dcacb37356c93e0a3618f

Fixed typo in docs/internals/contributing/writing-documentation.txt.

view details

push time in 2 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    num = abs(int(s))+    if num == 0:+        return '0'++    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    res = ''+    while num > 0:+        res = BASE62_ALPHABET[num % 62] + res+        num //= 62++    return sign + res+++def b62_decode(s):+    s = str(s)

Are we expecting s to be anything other than str? If it were bytes this would fail as it would convert to "b'...'".

hramezani

comment created time in 2 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    num = abs(int(s))+    if num == 0:+        return '0'++    sign = ''+    if str(s)[0] == '-':+        sign = '-'+

If we're only passing in an int to b62_encode() as is the case in the only use of the function, then:

    sign = '-' if s < 0 else ''
hramezani

comment created time in 2 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    num = abs(int(s))+    if num == 0:+        return '0'++    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    res = ''+    while num > 0:+        res = BASE62_ALPHABET[num % 62] + res+        num //= 62

Not sure this is any better, probably slower due to the function call, but putting it out there for consideration.

        num, remainder = divmod(num, 62)
        res = BASE62_ALPHABET[remainder] + res
hramezani

comment created time in 2 hours

startedevildmp/BrachioGraph

started time in 2 hours

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 from django.db.models import Index from django.test import TransactionTestCase -from .models import City+from .models import City, SchemaCity   class SchemaIndexesTests(TransactionTestCase):     available_apps = []-    models = [City]+    models = [City, SchemaCity]

I would create an inline model, see e.g. test_namespaced_db_table_foreign_key_reference.

snowman2

comment created time in 2 hours

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 def _create_index_sql(self, model, *, fields=None, **kwargs):         elif field.dim > 2 and not field.geography:             # Use "nd" ops which are fast on multidimensional cases             field_column = "%s %s" % (field_column, self.geom_index_ops_nd)-        if kwargs.get('name') is None:-            index_name = '%s_%s_id' % (model._meta.db_table, field.column)-        else:-            index_name = kwargs['name']++        name = kwargs.get("name")+        if not name:+            name = self._create_index_name(+                table, [field.column], kwargs.get("suffix", "")+            )

We shouldn't change the current logic and use _id instead of suffix from kwargs.

snowman2

comment created time in 2 hours

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 def _create_index_sql(self, model, *, fields=None, **kwargs):         elif field.dim > 2 and not field.geography:             # Use "nd" ops which are fast on multidimensional cases             field_column = "%s %s" % (field_column, self.geom_index_ops_nd)-        if kwargs.get('name') is None:-            index_name = '%s_%s_id' % (model._meta.db_table, field.column)-        else:-            index_name = kwargs['name']++        name = kwargs.get("name")+        if not name:+            name = self._create_index_name(+                table, [field.column], kwargs.get("suffix", "")+            )          return Statement(             self.sql_create_index,-            name=self.quote_name(index_name),-            table=self.quote_name(model._meta.db_table),+            name=self.quote_name(name),+            table=self.quote_name(table),

Actually I think it might be possible to reuse most of super()._create_index_sql by using expressions=[RawSQL(...)] instead of columns to avoid heavy duplication between both methods.

snowman2

comment created time in 2 hours

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 def _create_index_sql(self, model, *, fields=None, **kwargs):         elif field.dim > 2 and not field.geography:             # Use "nd" ops which are fast on multidimensional cases             field_column = "%s %s" % (field_column, self.geom_index_ops_nd)-        if kwargs.get('name') is None:-            index_name = '%s_%s_id' % (model._meta.db_table, field.column)-        else:-            index_name = kwargs['name']++        name = kwargs.get("name")+        if not name:+            name = self._create_index_name(+                table, [field.column], kwargs.get("suffix", "")+            )          return Statement(             self.sql_create_index,-            name=self.quote_name(index_name),-            table=self.quote_name(model._meta.db_table),+            name=self.quote_name(name),+            table=self.quote_name(table),

I think we'll want to use Table and IndexName

https://github.com/django/django/blob/65a9d0013d202447dd76a9cb3c939aa5c9d23da3/django/db/backends/base/schema.py#L1033-L1042

Otherwise column renames and deletion in the same migration will break.

snowman2

comment created time in 2 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    s = abs(int(s))+    if s == 0:+        return '0'++    res = ''+    while s > 0:+        res = BASE62_ALPHABET[s % 62] + res+        s //= 62++    return sign + res+++def b62_decode(s):+    s = str(s)+    if str(s)[0] == '-':+        s = s[1:]+        sign = -1+    else:+        sign = 1++    if s == '0':+        return 0++    res = 0+    for digit in str(s):+        res = res * 62 + BASE62_ALPHABET.index(digit)

I don't know. AFAIK, it just used in TimestampSigner. IMHO, we can keep it like this.

hramezani

comment created time in 3 hours

pull request commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

Hello @snowman2! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

snowman2

comment created time in 3 hours

startedevildmp/BrachioGraph

started time in 3 hours

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 from django.db.models import Index from django.test import TransactionTestCase -from .models import City+from .models import City, SchemaCity   class SchemaIndexesTests(TransactionTestCase):     available_apps = []-    models = [City]+    models = [City, SchemaCity]

Only works for postgis, will need another solution for this.

snowman2

comment created time in 3 hours

Pull request review commentdjango/django

BUG: Allow creating geometry index in PostGIS with Postgres schema (fixes #32721)

 def sync_apps(self, connection, app_labels):         with connection.cursor() as cursor:             tables = connection.introspection.table_names(cursor) +        if connection.ops.postgis:

Will need to find a better solution for this.

snowman2

comment created time in 3 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    s = abs(int(s))

Could put this further up to return early for this case?

hramezani

comment created time in 3 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    s = abs(int(s))+    if s == 0:+        return '0'++    res = ''+    while s > 0:+        res = BASE62_ALPHABET[s % 62] + res+        s //= 62++    return sign + res+++def b62_decode(s):+    s = str(s)+    if str(s)[0] == '-':+        s = s[1:]+        sign = -1+    else:+        sign = 1++    if s == '0':+        return 0++    res = 0+    for digit in str(s):+        res = res * 62 + BASE62_ALPHABET.index(digit)

It could be better to create a dict to benefit from looking up in a dict rather than a string index?

However, I'm not sure this is a performance critical function to start doing that kind of thing?

hramezani

comment created time in 7 hours

Pull request review commentdjango/django

Fixed #32712 -- Deprecated the django.contrib.baseconv module.

 class SignatureExpired(BadSignature):     pass  +def b62_encode(s):+    sign = ''+    if str(s)[0] == '-':+        sign = '-'++    s = abs(int(s))+    if s == 0:+        return '0'++    res = ''+    while s > 0:+        res = BASE62_ALPHABET[s % 62] + res+        s //= 62++    return sign + res+++def b62_decode(s):+    s = str(s)+    if str(s)[0] == '-':

No need to convert s to a string again (and the same further down).

hramezani

comment created time in 3 hours

startedevildmp/BrachioGraph

started time in 4 hours

startedevildmp/BrachioGraph

started time in 4 hours

PR opened django/django

Fixed typo in docs for OptiPNG's `-strip` flag.
+1 -1

0 comment

1 changed file

pr created time in 5 hours