componentsDjangoType 2.1.4__tar.gz → 2.1.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. {componentsdjangotype-2.1.4/componentsDjangoType.egg-info → componentsdjangotype-2.1.5}/PKG-INFO +1 -1
  2. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  3. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType.egg-info/SOURCES.txt +1 -0
  4. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/authenticator_configurator.py +17 -4
  5. componentsdjangotype-2.1.5/services/copy_source.py +28 -0
  6. componentsdjangotype-2.1.5/services/utils/__init__.py +0 -0
  7. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/setup.py +1 -1
  8. componentsdjangotype-2.1.4/services/copy_source.py +0 -36
  9. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/LICENSE +0 -0
  10. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/MANIFEST.in +0 -0
  11. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/README.md +0 -0
  12. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/__init__.py +0 -0
  13. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/__pycache__/__init__.cpython-312.pyc +0 -0
  14. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/__init__.py +0 -0
  15. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/__pycache__/__init__.cpython-312.pyc +0 -0
  16. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/commands/__init__.py +0 -0
  17. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  18. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/commands/__pycache__/createApp.cpython-312.pyc +0 -0
  19. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/commands/createApp.py +0 -0
  20. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  21. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  22. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType.egg-info/requires.txt +0 -0
  23. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/componentsDjangoType.egg-info/top_level.txt +0 -0
  24. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/__init__.py +0 -0
  25. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/authentication/__init__.py +0 -0
  26. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/authentication/auth.py +0 -0
  27. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/authentication/forms.py +0 -0
  28. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/css/authentication.css +0 -0
  29. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/js/alertErrors.js +0 -0
  30. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/views/home.html +0 -0
  31. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/views/layouts/index.html +0 -0
  32. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/views/logged.html +0 -0
  33. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/views/login.html +0 -0
  34. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/services/utils/views/signup.html +0 -0
  35. {componentsdjangotype-2.1.4 → componentsdjangotype-2.1.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: Comandos para crear archivos html, css y js
5
5
  Home-page: https://github.com/jose-CR/componentsDjangoType
6
6
  Author: Alejandro
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: Comandos para crear archivos html, css y js
5
5
  Home-page: https://github.com/jose-CR/componentsDjangoType
6
6
  Author: Alejandro
@@ -22,6 +22,7 @@ services/copy_source.py
22
22
  services/authentication/__init__.py
23
23
  services/authentication/auth.py
24
24
  services/authentication/forms.py
25
+ services/utils/__init__.py
25
26
  services/utils/css/authentication.css
26
27
  services/utils/js/alertErrors.js
27
28
  services/utils/views/home.html
@@ -2,6 +2,7 @@ import os
2
2
  from django.core.management import call_command
3
3
  from services.authentication import auth, forms
4
4
  from services.copy_source import copy_static_file
5
+ import importlib.resources as pkg_resources
5
6
 
6
7
  class DjangoProjectManager:
7
8
  def __init__(self, app_name, project_name):
@@ -259,15 +260,27 @@ urlpatterns = [
259
260
  files_to_copy = [
260
261
  ("services.utils.js", "alertErrors.js", os.path.join(js_dir, "alertErrors.js")),
261
262
  ("services.utils.css", "authentication.css", os.path.join(css_dir, "authentication.css")),
262
- ("services.utils.css.user", "", user_dir_css), # Copiar todo el contenido del directorio 'css/user'
263
+ ("services.utils.css.user", "aside.css", os.path.join(user_dir_css, "aside.css")),
263
264
  ("services.utils.views.layouts", "index.html", os.path.join(layouts_dir, "index.html")),
264
265
  ("services.utils.views", "home.html", os.path.join(templates_dir, "home.html")),
265
- ("services.utils.views", "", templates_dir), # Copiar todos los templates
266
- ("services.utils.views.user", "", user_dir_html), # Copiar todo el contenido de 'views/user'
267
- ("services.utils.views.components", "", user_dir_components), # Copiar todos los componentes
266
+ ("services.utils.views", "signup.html", os.path.join(templates_dir, "signup.html")),
267
+ ("services.utils.views", "login.html", os.path.join(templates_dir, "login.html")),
268
+ ("services.utils.views", "logged.html", os.path.join(templates_dir, "logged.html")),
269
+ ("services.utils.views.user", "user.html", os.path.join(user_dir_html, "user.html")),
270
+ ("services.utils.views.components", "aside.html", os.path.join(user_dir_components, "aside.html")),
268
271
  ]
269
272
 
270
273
  for package, resource_name, destination_path in files_to_copy:
271
274
  copy_static_file(package, resource_name, destination_path, stdout)
275
+
276
+ for package, resource_name, destination in files_to_copy:
277
+ try:
278
+ available_resources = list(pkg_resources.contents(package))
279
+ if resource_name in available_resources:
280
+ print(f"El recurso '{resource_name}' existe en el paquete '{package}'.")
281
+ else:
282
+ print(f"El recurso '{resource_name}' no está disponible en el paquete '{package}'.")
283
+ except Exception as e:
284
+ print(f"Error al acceder al paquete '{package}': {e}")
272
285
 
273
286
  stdout.write("Archivos estáticos copiados.\n")
@@ -0,0 +1,28 @@
1
+ import importlib.resources as pkg_resources
2
+ import shutil
3
+ import os
4
+ import sys
5
+
6
+ def copy_static_file(package, resource_name, destination_path, stdout=sys.stdout):
7
+ """
8
+ Copia un archivo estático empaquetado a una ruta de destino.
9
+
10
+ :param package: El nombre del paquete donde está el recurso.
11
+ :param resource_name: Nombre del archivo dentro del paquete.
12
+ :param destination_path: Ruta completa donde se copiará el archivo.
13
+ :param stdout: Salida estándar para mensajes (por defecto usa sys.stdout).
14
+ """
15
+ try:
16
+ # Crear el directorio de destino si no existe
17
+ os.makedirs(os.path.dirname(destination_path), exist_ok=True)
18
+
19
+ # Leer el archivo desde el paquete y escribirlo en la ruta destino
20
+ with pkg_resources.open_binary(package, resource_name) as resource_file:
21
+ with open(destination_path, 'wb') as dest_file:
22
+ shutil.copyfileobj(resource_file, dest_file)
23
+
24
+ stdout.write(f"El recurso '{resource_name}' fue copiado a '{destination_path}'.\n")
25
+ except FileNotFoundError:
26
+ stdout.write(f"El recurso '{resource_name}' no existe en el paquete '{package}'.\n")
27
+ except Exception as e:
28
+ stdout.write(f"Error al copiar el archivo '{resource_name}': {e}\n")
File without changes
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='componentsDjangoType',
5
- version='2.1.4',
5
+ version='2.1.5',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  package_data={
@@ -1,36 +0,0 @@
1
- import importlib.resources as pkg_resources
2
- import shutil
3
- import os
4
- import sys
5
-
6
- def copy_static_file(package, resource_name, destination_path, stdout=sys.stdout):
7
- """
8
- Copia un archivo estático empaquetado a una ruta de destino.
9
-
10
- :param package: El nombre del paquete donde está el recurso.
11
- :param resource_name: Ruta relativa del recurso dentro del paquete (puede ser un archivo o un directorio).
12
- :param destination_path: Ruta completa donde se copiará el archivo o estructura.
13
- :param stdout: Salida estándar para mensajes (por defecto usa sys.stdout).
14
- """
15
- try:
16
- # Si el recurso es un directorio, recorre sus contenidos
17
- if pkg_resources.is_resource(package, resource_name) or not resource_name:
18
- os.makedirs(destination_path, exist_ok=True) # Asegura que el directorio exista
19
- for resource in pkg_resources.contents(package):
20
- resource_path = os.path.join(resource_name, resource) if resource_name else resource
21
- dest_path = os.path.join(destination_path, resource)
22
- copy_static_file(package, resource_path, dest_path, stdout)
23
- else:
24
- # Es un archivo; cópialo directamente
25
- if not pkg_resources.is_resource(package, resource_name):
26
- stdout.write(f"El recurso '{resource_name}' no existe en el paquete '{package}'.\n")
27
- return
28
-
29
- os.makedirs(os.path.dirname(destination_path), exist_ok=True) # Asegura el directorio
30
- with pkg_resources.open_binary(package, resource_name) as resource_file:
31
- with open(destination_path, 'wb') as dest_file:
32
- shutil.copyfileobj(resource_file, dest_file)
33
-
34
- stdout.write(f"El recurso '{resource_name}' fue copiado a '{destination_path}'.\n")
35
- except Exception as e:
36
- stdout.write(f"Error al copiar el recurso '{resource_name}' desde '{package}': {e}\n")