Problem/Motivation will let you create projects namespaces that are not valid machine names.

Proposed resolution

Since the consequences of a bad namespace choice may not be obvious to new contributors and it's so painful to fix once a project has gained any momentum, we should enforce important constraints through validation when creating or promoting a project rather than leaving it up to chance.

Remaining tasks

  • Identify the constraints. So far:
    • Must not contain hyphens.
    • Must be a valid PHP label (e.g., no special characters, no starting with a number or double underscores (__), etc., etc.)
    • Others?
  • Enforce them in form validations.

User interface changes


API changes


Original report by @Marcin Pajdzik

I set the url for my module to eu-cookie-compliance. However I should have used underscores rather than hyphens so that it reads eu_cookie_compliance.

The problem is that now if I do drush dl eu-cookie-compliance the module is downloaded but then when I wand to enable it with drush en eu-cookie-compliance, drush cannot find it.

Is that possible to change it?



rsvelko’s picture

come on guys - that one should be simple

What would the d.o. webmasters suggest ?

greggles’s picture

It's actually not easy which is why the page before you create/promote is so explicit about how hard it is (see attachments).

This is basically at the whim of someone with 1) advanced access to the site server 2) knowledge about all the places this touches and how to make the changes properly. I don't have #2 and may not even have all of #1.

Sorry :(

Gerhard Killesreiter’s picture

Suggestion: delete project and create a new one.

rsvelko’s picture

for the momment this might be our best choice - to delete and recreate the project.

For the future - lets make it so that on d.o. the shortname/shortcode/machine-readable-project-name gets scanned on creation for illegal characters like '-'-s (dashes) and so make it impossible for this problem to occur...

Any suggestions of what to do to change this ? Update a module on d.o. ? Which module ? Where to patch it ? Or if no patch is needed and its just a site setting - whom to contact to change that setting ?

Or is this whole thing "by design" ? A design in which dashes are allowed is bad !

I am an optimist.

greggles’s picture

Title: Changing url of a project » Validate that project node short urls match expectations
Project: webmasters » Project
Version: » 7.x-2.x-dev
Component: Project problem » Projects
Category: support » feature

Sure, let's make this a feature request.

In an ideal world, project would look at any associated repository and guess the proper name. Barring that, maybe it can just make sure there are no hyphens in the short name. If this is something that is d.o specific I guess we should either move it to drupalorg module or make it validation in a variable of some sort so it can be disabled elsewhere.

rsvelko’s picture

is the project.module used on d.o. to handle those things? If so lets patch the project module with some more options ...

greggles’s picture

@rsvelko yes, that's why I moved this to the project module queue, because it needs to be updated (if the maintainers there agree it's an appropriate feature). If it's too drupalorg specific it should be moved to drupalorg module.

dww’s picture

Title: Validate that project node short urls match expectations » Validate that project node machine names can be valid Drupal module/theme machine names
Project: Project » customizations
Version: 7.x-2.x-dev » 6.x-3.x-dev
Component: Projects » User interface

The furthest I'd go in Project for this would be #1189292: Let enforce lower case names for new projects . But Project itself doesn't care if your project machine name works as a valid Drupal module machine name. That's a job for a drupalorg-specific customization.

That said, I agree it'd be nice if we were enforcing this.

Note: there are two forms you're going to want to inject a custom validation callback on:
- The project node add/edit form
- The form when a project is promoted from a sandbox to full


itapplication’s picture

I test site ( for project short name validation functionality. It's allow to use project short name being start with digit.

Drupal projects for module and themes do not allow to use name which start with digit. So project validation functionality also trap and disallow short project name start with digit.

This shouldn't allow -

This is OK -

itapplication’s picture

Appropriate tag help to flash issue in a right queue/search result.

itapplication’s picture


itapplication’s picture

Sorry for typo mistake.

itapplication’s picture

Testing for this issue. Unfortunately there is no work around for this issue at new D7.

drumm’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Issue tags: redesign, redesign qa, D7

The " D7" tag is for launch blockers. Since this isn't a regression, it is not a blocker.

" redesign" and " redesign qa" tags are for a previous initiative, I don't think anyone is watching them.

Moving to version 7.x-3.x since this should be fixed in D7 first, and probably not backported since we are nearing launch.

If any developers want to take this on, #8 has the specific forms to target, see

hass’s picture

I do not see any usefull information here. Why are we not just enable field_validation module and validate the project name with a regex. #2132845: Disallow hyphen in project short names lists at least 3 projects and there are a lot more with hyphens.

Things are getting more worse with every day and this is just drush en field_validation and one easy config.

itapplication’s picture

@hass , I agree with you "...Things are getting more worse with every day."
List of bad project name is continuously increasing.

TravisCarden’s picture

Title: Validate that project node machine names can be valid Drupal module/theme machine names » Require project node machine names to be valid Drupal module/theme machine names
Component: User interface » Code
Issue summary: View changes
dww’s picture