Opened 3 years ago

Closed 3 years ago

# Can not create any projects

Reported by: Owned by: WildShroom falkb high SimpleMultiProjectPlugin major 1.0

### Description

Updated .ini file and installed (thru GUI) the dist .egg

Everything appears to be working correctly. However, when I enter the Admin section for Manage Projects > Projects. There are none listed and when I create one, it does not populate.

Screen shot attached, but shows only newer UI.

### comment:1 Changed 3 years ago by falkb

Please, attach interesting parts of the log file (set DEBUG level in the Admin section), tell me the project name you tried, the versions of the underlying system you use for your Trac-1.0 (e.g. database and Python version, internet browser you use). You can also try to check your trac.db if the created project is written to the smp_project table.

### comment:2 follow-ups: ↓ 3 ↓ 4 Changed 3 years ago by WildShroom

• Name of project: WebSite
• DB: MySQL
• PyVers: 2.7
• Browser: Chrome

I get an confirmation that the project was created. But nothing is listed and it cannot be selected from a ticket. There is nothing I can see in the trac.log file that would point to an cause.

### comment:3 in reply to: ↑ 2 Changed 3 years ago by falkb

But nothing is listed

Where? URL path?

and it cannot be selected from a ticket.

Did you switch all modules of this plugin on? Please, check the plugin page on Admin.

There is nothing I can see in the trac.log file that would point to an cause.

Did you try to open trac.db with a common data base browser? Do you see what the smp_project table contains?

P.S.: your first attachment is not viewable.

### comment:4 in reply to: ↑ 2 Changed 3 years ago by falkb

Name of project: WebSite DB: MySQL PyVers: 2.7 Browser: Chrome

I develop with SQLite, Python 2.5-2.7, Firefox & IE

### comment:5 follow-up: ↓ 6 Changed 3 years ago by WildShroom

Where: In the Trac UI. The project it confirmed is not listed.

Modules on: Yes. See screen shot.

Trac.db: Checking when admin get's back.

First screen shot is not required, and I deleted it. Ha!

### comment:6 in reply to: ↑ 5 Changed 3 years ago by falkb

Where: In the Trac UI. The project it confirmed is not listed.

### comment:7 Changed 3 years ago by falkb

...and did you consider 5. of SimpleMultiProjectPlugin#Installation ?

### comment:8 Changed 3 years ago by WildShroom

Yes, there. See screen shot.

And, there is nothing to chose in a ticket. Screen shot.

### comment:9 Changed 3 years ago by falkb

Well, I don't really think it's a permission issue (see 7) but something with the access to your MySQL database. I'd like to know what the content of your smp_... tables in your trac.db is.

### comment:10 Changed 3 years ago by WildShroom

The smp_project table is empty

### comment:11 Changed 3 years ago by rjollos

There is quite a bit of SQL string formatting going on in simplemultiprojectplugin/trunk/simplemultiproject/environmentSetup.py, which is likely to cause cross-DB compatibility issues.

I would recommend some changes such as (untested):

sqlInsertVersion = "INSERT INTO system (name, value) VALUES ('%s','%s')" % (db_version_key, db_version)
cursor.execute(sqlInsertVersion)


->

cursor.execute("""
INSERT INTO system (name, value) VALUES (%s, %s))
""", (db_version_key, db_version))


See t:TracDev/DatabaseApi#RulesforDBAPIUsage for more details.

### Changed 3 years ago by falkb

for better considering the rules for DB API usage

### comment:12 Changed 3 years ago by falkb

please, could you try this attachment:mysql.patch ?

### comment:13 Changed 3 years ago by falkb

Question: The click on the "Add" button calls this function in model.py:

    def insert_project(self, name, summary, description):
cursor = self.__get_cursor()
query    = """INSERT INTO
smp_project (name, summary, description)
VALUES (%s, %s, %s);"""

cursor.execute(query, [name, summary, description])


Do you see a problem with the used syntax and your MySQL version?

### comment:14 follow-up: ↓ 15 Changed 3 years ago by rjollos

For the part of your patch that applies to version.py, I would recommend (untested):

"""SELECT id,status,%s FROM ticket WHERE %s=%s ORDER BY %s""",
[field, any_name, any_value, field]


->

"""SELECT id,status,%%s FROM ticket WHERE %%s=%s ORDER BY %s""",
% (field, field), (any_name, any_value)


and similarly for the other execute statement. Everything else looks good.

I can't imagine any cross-DB compatibility problems with the SQL in comment:13. The trailing semicolon is unnecessary as far as I know, but shouldn't hurt anything.

### comment:15 in reply to: ↑ 14 Changed 3 years ago by falkb

For the part of your patch that applies to version.py, I would recommend (untested)... snip

After I looked at the DB API docs again I hope I've understood the %%s and %s thingy now. Does this look right now?

• ## simplemultiproject/version.py

 cursor = db.cursor() fields = TicketSystem(env).get_ticket_fields() if field in [f['name'] for f in fields if not f.get('custom')]: cursor.execute("SELECT id,status,%s FROM ticket WHERE %s='%s' ORDER BY %s" % (field, any_name, any_value, field)) cursor.execute("""SELECT id,status,%s FROM ticket WHERE %s=%%s ORDER BY %s""" % (field, any_name, field), [any_value]) else: cursor.execute("SELECT id,status,value FROM ticket LEFT OUTER JOIN ticket_custom ON (id=ticket AND name=%s) WHERE %s='%s' ORDER BY value", (field, any_name, any_value)) cursor.execute("""SELECT id,status,value FROM ticket LEFT OUTER JOIN ticket_custom ON (id=ticket AND name=%%s) WHERE %s=%%s ORDER BY value""" % any_name, [field, any_value]) tickets = [] for tkt_id, status, fieldval in cursor: tickets.append({'id': tkt_id, 'status': status, field: fieldval}) cursor.execute(""" SELECT DISTINCT COALESCE(%s,'') FROM ticket ORDER BY COALESCE(%s,'') """ % (by, by)) """, [by, by]) groups = [row[0] for row in cursor] max_count = 0

### comment:16 Changed 3 years ago by rjollos

Yeah, that looks right, and my patch was off, especially with regard to the %%s and %s.

### comment:17 follow-up: ↓ 18 Changed 3 years ago by falkb

(In [13125]) Refs #11058: fixed some SQL statement string formatting, trial and error approach to get adding of tickets work again for the reporter of this ticket (big thanks to rjollos for his review!)

### comment:18 in reply to: ↑ 17 Changed 3 years ago by falkb

(In [13125]) Refs #11058: fixed some SQL statement string formatting, trial and error approach to get adding of tickets work again for the reporter of this ticket (big thanks to rjollos for his review!)

- adding of tickets


### comment:19 in reply to: ↑ description ; follow-up: ↓ 20 Changed 3 years ago by klanjabrik

Updated .ini file and installed (thru GUI) the dist .egg

Everything appears to be working correctly. However, when I enter the Admin section for Manage Projects > Projects. There are none listed and when I create one, it does not populate.

Yes, i've got a notification "The project has been added." but unfortunately the table "smp_project" remains empty.

### comment:20 in reply to: ↑ 19 ; follow-up: ↓ 21 Changed 3 years ago by falkb

Yes, i've got a notification "The project has been added." but unfortunately the table "smp_project" remains empty.

Need more details: Which SVN version, database type, Trac version, Python version, JavaScript on or off?

### comment:21 in reply to: ↑ 20 ; follow-up: ↓ 22 Changed 3 years ago by anonymous

Need more details: Which SVN version, database type, Trac version, Python version, JavaScript on or off?

SVN version: 1.6.11 database type: MySQL Trac version: Trac 1.0.1 Python version: Python 2.7.3 JavaScript: on

### comment:22 in reply to: ↑ 21 ; follow-up: ↓ 23 Changed 3 years ago by falkb

SVN version: 1.6.11

sorry, I mean the plugin SVN version

### comment:23 in reply to: ↑ 22 Changed 3 years ago by klanjabrik

sorry, I mean the plugin SVN version

I'm using Trac 1.0.1, so the SVN plugin already included in that version, cmiiw.

### comment:24 follow-up: ↓ 25 Changed 3 years ago by falkb

No, the plugin is not actually part of 1.0.1 or what distribution do you use?

### comment:25 in reply to: ↑ 24 ; follow-up: ↓ 26 Changed 3 years ago by anonymous

No, the plugin is not actually part of 1.0.1 or what distribution do you use?

if that's the case, then the SVN Plugin hasn't installed yet.

### comment:26 in reply to: ↑ 25 ; follow-up: ↓ 27 Changed 3 years ago by falkb

No, the plugin is not actually part of 1.0.1 or what distribution do you use?

if that's the case, then the SVN Plugin hasn't installed yet.

Trac and its plugins are different shoes. Both ones are quite independent projects. Can you imagine someone has put both things together as distribution and you installed such package? So what is the name and version of your package? I decided for Bitnami Trac Stack and that comes without any plugin, and that is why I added this plugin manually, build from sources with a certain SVN revision. Since I fixed some things in [13125] I need to know if your plugin is < or >= that [13125], and what you exactly use. This way I maybe can better conclude what is going on and what runs different on your machine, you know it's working here without problems. Better is you can try to update from the latest SVN sources and tell me if it's working for you then.

### comment:27 in reply to: ↑ 26 Changed 3 years ago by anonymous

Trac and its plugins are different shoes. Both ones are quite independent projects. Can you imagine someone has put both things together as distribution and you installed such package? So what is the name and version of your package? I decided for Bitnami Trac Stack and that comes without any plugin, and that is why I added this plugin manually, build from sources with a certain SVN revision. Since I fixed some things in [13125] I need to know if your plugin is < or >= that [13125], and what you exactly use. This way I maybe can better conclude what is going on and what runs different on your machine, you know it's working here without problems. Better is you can try to update from the latest SVN sources and tell me if it's working for you then.

The plugin is >= 13125

i tried to input the project data manually from PhpMyAdmin, go back to Trac WebAdmin, modify the project from Trac WebAdmin, and nothing's changed. Maybe there are issues Insert and Update to database.

### comment:28 follow-up: ↓ 29 Changed 3 years ago by klanjabrik

Solved,

I open the trac.log, and there is a failure to sync the repository, so i removed all repositories from WebAdmin, and now i can add and modify project.

Thanks.

### comment:29 in reply to: ↑ 28 ; follow-up: ↓ 30 Changed 3 years ago by falkb

Solved,

I open the trac.log, and there is a failure to sync the repository, so i removed all repositories from WebAdmin, and now i can add and modify project.

Thanks.

Glad, it works for you now. :-)

Do I understand it right, your Trac db access did not work correctly at all, independently from this plugin? Please, after playing around with projects and milestones do acknowledge SimpleMultiProjectPlugin works with MySQL databases now!

### comment:30 in reply to: ↑ 29 Changed 3 years ago by anonymous

Glad, it works for you now. :-)

Do I understand it right, your Trac db access did not work correctly at all, independently from this plugin? Please, after playing around with projects and milestones do acknowledge SimpleMultiProjectPlugin works with MySQL databases now!

Hahaha, yes sir!

This is my trac.log:

2013-05-28 15:00:22,298 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/admin/projects/simplemultiproject/16'">
2013-05-28 15:00:22,300 Trac[api] WARNING: Unable to find repository '(default)' for synchronization


### comment:31 follow-up: ↓ 32 Changed 3 years ago by falkb

• Resolution set to fixed
• Status changed from new to closed

happyusercount = happyusercount + 1

### comment:32 in reply to: ↑ 31 Changed 3 years ago by rjollos

happyusercount = happyusercount + 1

happyusercount += 1 might be considered more Pythonic ;)