Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-14 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  closed
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  storage  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

 In [changeset:"a57596e443ecb67140e1a9fc0f0e87446b2d0174" a57596e]:
 {{{#!CommitTicketReference repository=""
 revision="a57596e443ecb67140e1a9fc0f0e87446b2d0174"
 Refs #35658 -- Fixed
 test_create_file_field_from_another_file_field_in_memory_storage when run
 in reverse.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019154cf189c-34fb95ab-64f2-4111-b08d-dffba8295c3f-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-09 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  closed
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  storage  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

 * resolution:   => fixed
 * status:  new => closed

Comment:

 In [changeset:"f16a9a556fb4225f9094048614f4fcec3db7e067" f16a9a55]:
 {{{#!CommitTicketReference repository=""
 revision="f16a9a556fb4225f9094048614f4fcec3db7e067"
 Fixed #35658 -- Initialized InMemoryFileNode instances with a name.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019136adbaa6-bc1ecee8-35c0-4c3b-8aff-2c1b35797208-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-09 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  new
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * stage:  Accepted => Ready for checkin

Comment:

 Thank you for the follow up David - that helped a lot!
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191367bd676-be87a408-afd6-4ca6-944d-73bbe1d73c97-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-08 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  new
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by David):

 Replying to [comment:11 Sarah Boyce]:
 > Still don't get the error as reported in the ticket so further details
 would be welcome

 Sorry I have miss-interpreted a stack trace of an other error coming from
 pytest and pasted the wrong part

 The stacktrace frame showed up
 {{{
 instance   = <[AttributeError("'InMemoryFileNode' object has no attribute
 'name'") raised in repr()] MyModel
 }}}

 Because the model uses `attachment.name` in its `__str__` method.

 Whatching back the behaviour now I have isolated a test which fails:

 {{{#!python

 obj = MyModel.objects.create(attachment=ContentFile(b'content',
 'myfile.txt'))
 obj2 = MyModel.objects.create(attachment=obj.attachment.file)
 }}}

 Which raises the following stacktrace:

 {{{
 Traceback (most recent call last):
   File "/db_35658/db_35658/tests.py", line 24, in
 test_copy_file
 obj2 = MyModel.objects.create(attachment=obj.attachment.file)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/manager.py", line 87, in manager_method
 return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/query.py", line 658, in create
 obj.save(force_insert=True, using=self.db)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/base.py", line 814, in save
 self.save_base(
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/base.py", line 877, in save_base
 updated = self._save_table(
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/base.py", line 1020, in _save_table
 results = self._do_insert(
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/base.py", line 1061, in _do_insert
 return manager._insert(
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/manager.py", line 87, in manager_method
 return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/query.py", line 1805, in _insert
 return query.get_compiler(using=using).execute_sql(returning_fields)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/sql/compiler.py", line 1821, in execute_sql
 for sql, params in self.as_sql():
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/sql/compiler.py", line 1745, in as_sql
 value_rows = [
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/sql/compiler.py", line 1746, in 
 [
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/sql/compiler.py", line 1747, in 
 self.prepare_value(field, self.pre_save_val(field, obj))
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/sql/compiler.py", line 1695, in pre_save_val
 return field.pre_save(obj, add=True)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/fields/files.py", line 314, in pre_save
 file = super().pre_save(model_instance, add)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/fields/__init__.py", line 932, in pre_save
 return getattr(model_instance, self.attname)
   File "/db_35658/.venv/lib/python3.10/site-
 packages/django/db/models/fields/files.py", line 200, in __get__
 file_copy = self.field.attr_class(instance, self.field, file.name)
 AttributeError: 'InMemoryFileNode' object has no attribute 'name'
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701913161da05-69df6658-9d3a-4fbe-9fdb-2e3ab023cfd1-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-07 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  new
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Lucas Esposito):

 * needs_better_patch:  1 => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701912d750536-c9ab1880-9a50-44dc-9d94-6c88d32d93b3-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-07 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  new
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * needs_better_patch:  0 => 1

Comment:

 Still don't get the error as reported in the ticket so further details
 would be welcome
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701912d058e98-fc2a0529-d8be-40fb-b4eb-58bebe031883-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-07 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  new
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * resolution:  worksforme =>
 * status:  closed => new

Comment:

 Ah I found an error
 {{{#!python
 @override_settings(
 STORAGES={"default": {"BACKEND":
 "django.core.files.storage.InMemoryStorage"}}
 )
 class FileFieldModelTest(TestCase):
 def test_repr(self):
 test = FileFieldModel()
 test.file.save(None, ContentFile(b'content', 'myfile.txt'))
 self.assertEqual(repr(test.file), "")
 }}}

 Breaks with
 {{{
 Traceback (most recent call last):
   File "test-django-package/mysite/app3/tests.py", line 13, in test_repr
 test.file.save(None, ContentFile(b'content', 'myfile.txt'))
   File "test-django-package/venv/lib/python3.10/site-
 packages/django/db/models/fields/files.py", line 92, in save
 name = self.field.generate_filename(self.instance, name)
   File "test-django-package/venv/lib/python3.10/site-
 packages/django/db/models/fields/files.py", line 335, in generate_filename
 filename = posixpath.join(dirname, filename)
   File "/usr/lib/python3.10/posixpath.py", line 90, in join
 genericpath._check_arg_types('join', a, *p)
   File "/usr/lib/python3.10/genericpath.py", line 152, in _check_arg_types
 raise TypeError(f'{funcname}() argument must be str, bytes, or '
 TypeError: join() argument must be str, bytes, or os.PathLike object, not
 'NoneType'
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701912cf7b47a-896190ca-f5d6-440f-91db-35d0b58aff6d-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-07 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  closed
Component:  File |  Version:  4.2
  uploads/storage|   Resolution:
 Severity:  Normal   |  worksforme
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * resolution:   => worksforme
 * status:  assigned => closed

Comment:

 Hi David, I have not been able to replicate the error on main or Django
 4.2
 {{{#!python
 @override_settings(
 STORAGES={"default": {"BACKEND":
 "django.core.files.storage.InMemoryStorage"}}
 )
 class FileFieldModelTest(TestCase):
 def test_repr(self):
 test = FileFieldModel.objects.create(
 file=ContentFile(b'content', 'myfile.txt')
 )
 self.assertEqual(repr(test.file), "")
 }}}
 Can you share the full traceback or give more instructions on how to
 replicate the error?
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701912cee4d11-d8bff8d6-ea95-4dae-aaa0-a2b47342f401-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name"

2024-08-07 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  assigned
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Lucas Esposito):

 * needs_better_patch:  1 => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701912caba937-390a5800-883f-4f76-9963-6da072e07ba8-00%40eu-central-1.amazonses.com.


Re: [Django] #35658: InMemoryFileNode object has no attribute "name" (was: [Bug] InMemoryFileNode has no attribute "name")

2024-08-07 Thread Django
#35658: InMemoryFileNode object has no attribute "name"
-+-
 Reporter:  David|Owner:  Lucas
 |  Esposito
 Type:  Bug  |   Status:  assigned
Component:  File |  Version:  4.2
  uploads/storage|
 Severity:  Normal   |   Resolution:
 Keywords:  storage  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * component:  Core (Other) => File uploads/storage
 * summary:  [Bug] InMemoryFileNode has no attribute "name" =>
 InMemoryFileNode object has no attribute "name"

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701912bec0420-591df2a7-c504-4013-9290-6c0b41e01cc6-00%40eu-central-1.amazonses.com.