componentsDjangoType 2.0.30__tar.gz → 2.0.32__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. {componentsdjangotype-2.0.30/componentsDjangoType.egg-info → componentsdjangotype-2.0.32}/PKG-INFO +1 -1
  2. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  3. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/services/authenticator_configurator.py +46 -36
  4. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/setup.py +1 -1
  5. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/LICENSE +0 -0
  6. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/MANIFEST.in +0 -0
  7. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/README.md +0 -0
  8. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/__init__.py +0 -0
  9. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/__pycache__/__init__.cpython-312.pyc +0 -0
  10. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/__init__.py +0 -0
  11. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/__pycache__/__init__.cpython-312.pyc +0 -0
  12. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/commands/__init__.py +0 -0
  13. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  14. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/commands/__pycache__/createApp.cpython-312.pyc +0 -0
  15. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/commands/createApp.py +0 -0
  16. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  17. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
  18. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  19. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType.egg-info/requires.txt +0 -0
  20. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/componentsDjangoType.egg-info/top_level.txt +0 -0
  21. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/services/__init__.py +0 -0
  22. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/services/authentication/__init__.py +0 -0
  23. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/services/authentication/auth.py +0 -0
  24. {componentsdjangotype-2.0.30 → componentsdjangotype-2.0.32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.30
3
+ Version: 2.0.32
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.0.30
3
+ Version: 2.0.32
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
@@ -89,31 +89,44 @@ path('', include('home.urls'))
89
89
 
90
90
  updated = False
91
91
 
92
- # Verificar si la ruta de 'Home.urls' está en 'urlpatterns'
93
- if "include('Home.urls')" not in urls_content:
94
- stdout.write("Agregando ruta para 'home.urls'.\n")
95
-
96
- # Agregar importación de 'include'
97
- urls_content = urls_content.replace(
98
- "from django.urls import path",
99
- "from django.urls import path, include"
100
- )
101
-
102
- # Agregar 'Home.urls' a 'urlpatterns'
103
- if "urlpatterns = [" in urls_content:
104
- urls_content = urls_content.replace(
105
- "urlpatterns = [",
106
- "urlpatterns = [\n path('admin/', admin.site.urls),\n path('', include('Home.urls')),\n"
107
- )
92
+ # Verificar si el archivo ya incluye 'include' y 'Home.urls'
93
+ if "include('Home.urls')" not in urls_content or "from django.urls import include" not in urls_content:
94
+ stdout.write("Actualizando el archivo 'urls.py' para incluir 'Home.urls'.\n")
95
+
96
+ # Sobrescribir el contenido del archivo con la estructura deseada
97
+ urls_content = '''"""
98
+ URL configuration for myproject project.
99
+
100
+ The `urlpatterns` list routes URLs to views. For more information please see:
101
+ https://docs.djangoproject.com/en/5.1/topics/http/urls/
102
+ Examples:
103
+ Function views
104
+ 1. Add an import: from my_app import views
105
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
106
+ Class-based views
107
+ 1. Add an import: from other_app.views import Home
108
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
109
+ Including another URLconf
110
+ 1. Import the include() function: from django.urls import include, path
111
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
112
+ """
113
+ from django.contrib import admin
114
+ from django.urls import path, include # Asegúrate de incluir include
115
+
116
+ urlpatterns = [
117
+ path('admin/', admin.site.urls),
118
+ path('', include('Home.urls')),
119
+ ]
120
+ '''
108
121
  updated = True
109
122
 
110
- # Escribir los cambios si se modificó algo
123
+ # Sobrescribir el archivo solo si se actualizó algo
111
124
  if updated:
112
125
  with open(project_urls_path, 'w') as f:
113
126
  f.write(urls_content)
114
- stdout.write(f"El archivo '{project_urls_path}' fue actualizado.\n")
127
+ stdout.write(f"El archivo '{project_urls_path}' ha sido actualizado.\n")
115
128
  else:
116
- stdout.write(f"No fue necesario realizar cambios en '{project_urls_path}'.\n")
129
+ stdout.write(f"No se realizaron cambios en '{project_urls_path}'.\n")
117
130
 
118
131
  def creation_auth(self, stdout):
119
132
  services_dir = os.path.join(self.app_name, 'services')
@@ -121,7 +134,7 @@ path('', include('home.urls'))
121
134
  os.makedirs(authentication_dir, exist_ok=True)
122
135
 
123
136
  # Ruta para el nuevo archivo a crear
124
- authentication_path = os.path.join(authentication_dir, 'authentication.py')
137
+ authentication_path = os.path.join(authentication_dir, 'auth.py')
125
138
 
126
139
  # Usar el atributo __file__ del módulo 'auth' para obtener la ruta del archivo fuente
127
140
  auth_source_path = os.path.abspath(auth.__file__)
@@ -160,10 +173,9 @@ path('', include('home.urls'))
160
173
  else:
161
174
  stdout.write(f"El directorio '{home_dir}' ya existe.\n")
162
175
 
163
- # Verificar si views.py existe y crearlo si no existe
164
- if not os.path.exists(views_path):
165
- views_code = '''from django.shortcuts import render
166
- from Home.services.authentication import Authentication
176
+ # Sobrescribir o crear el archivo views.py
177
+ views_code = '''from django.shortcuts import render
178
+ from services.authentication.auth import Authentication
167
179
 
168
180
  def home(request):
169
181
  return render(request, 'home.html')
@@ -179,12 +191,10 @@ def signing(request):
179
191
 
180
192
  def logged(request):
181
193
  return Authentication.get_logged(request)
182
- '''
183
- with open(views_path, 'w') as views_file:
184
- views_file.write(views_code)
185
- stdout.write(f"El archivo '{views_path}' ha sido creado.\n")
186
- else:
187
- stdout.write(f"El archivo '{views_path}' ya existe.\n")
194
+ '''
195
+ with open(views_path, 'w') as views_file: # Abrir en modo escritura siempre
196
+ views_file.write(views_code)
197
+ stdout.write(f"El archivo '{views_path}' ha sido creado o sobrescrito.\n")
188
198
 
189
199
  # Verificar si urls.py existe y crearlo si no existe
190
200
  if not os.path.exists(urls_path):
@@ -192,13 +202,13 @@ def logged(request):
192
202
  from . import views
193
203
 
194
204
  urlpatterns = [
195
- path("", views.home, name='home'),
196
- path("signup", views.signup, name='signup'),
197
- path("login", views.signing, name='login'),
198
- path("logout", views.signout, name='logout'),
199
- path("logged", views.logged, name='logged'),
205
+ path("", views.home, name='home'),
206
+ path("signup", views.signup, name='signup'),
207
+ path("login", views.signing, name='login'),
208
+ path("logout", views.signout, name='logout'),
209
+ path("logged", views.logged, name='logged'),
200
210
  ]
201
- '''
211
+ '''
202
212
  with open(urls_path, 'w') as urls_file:
203
213
  urls_file.write(urls_code)
204
214
  stdout.write(f"El archivo '{urls_path}' ha sido creado.\n")
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='componentsDjangoType',
5
- version='2.0.30',
5
+ version='2.0.32',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  license='MIT',