web2py / web2py

Free and open source full-stack enterprise framework for agile development of secure database-driven web-based applications, written and programmable in Python.
http://www.web2py.com
Other
2.12k stars 904 forks source link

The admin app does not show applications if they have dashes or dots in the name #2077

Open nicozanf opened 5 years ago

nicozanf commented 5 years ago

When you open the "site" link (https://mysite.example.com/admin/default/site) the current admin app does not show applications if they have dashes or dots in the name of the related folder, like web2py-book or web2py.book. As soon as you rename it with alphanumerical characthers only, and refresh the web page, the application is listed as usual among the installed ones. The application works fine otherwise, but the admin app does not shot it.

queengooborg commented 5 years ago

Attempting to create applications with dashes and dots in their name via the admin panel reveals an error stating that it's an invalid application name. Digging around within the code revealed a validator called IS_VALID_APPNAME() that checks to see if the application already exists, or if it matches the regex ^\w+$ (only alphanumerical characters with underscores). I'm not sure about the reason behind this check, possibly backwards compatibility or filesystem compatibility.

valq7711 commented 5 years ago

The reason is to make this possible: from applications.app_must_be_valid_python_name.modules import shared_module

bryanpedini commented 5 years ago

Turned out that app names are not the only nonsense thing...

The reason is to make this possible: from applications.app_must_be_valid_python_name.modules import shared_module

Now tell me why in the hell I cannot rename my models with dashes or dots... those do not get imported anywhere (models, not modules tho).

Ref: #2251