Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11058 closed defect (fixed)

Can not create any projects

Reported by: Dave Owned by: falkb
Priority: high Component: SimpleMultiProjectPlugin
Severity: major Keywords:
Cc: Trac Release: 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.

Attachments (6)

Screen Shot 2013-05-07 at 12.00.34 PM.png (15.5 KB) - added by Dave 11 years ago.
project.png (11.1 KB) - added by Dave 11 years ago.
turned_on.png (98.4 KB) - added by Dave 11 years ago.
admin_project_screen.png (46.7 KB) - added by Dave 11 years ago.
ticket.png (12.2 KB) - added by Dave 11 years ago.
mysql.patch (4.8 KB) - added by falkb 11 years ago.
for better considering the rules for DB API usage

Download all attachments as: .zip

Change History (38)

comment:1 Changed 11 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 Changed 11 years ago by Dave

  • 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.

Changed 11 years ago by Dave

Attachment: project.png added

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

Replying to WildShroom:

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 11 years ago by falkb

Replying to WildShroom:

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

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

comment:5 Changed 11 years ago by Dave

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!

Changed 11 years ago by Dave

Attachment: turned_on.png added

comment:6 in reply to:  5 Changed 11 years ago by falkb

Replying to WildShroom:

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

Do you mean http://yourmachine/yourtracproject/admin/projects/simplemultiproject ?

comment:7 Changed 11 years ago by falkb

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

comment:8 Changed 11 years ago by Dave

Yes, there. See screen shot.

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

Changed 11 years ago by Dave

Attachment: admin_project_screen.png added

Changed 11 years ago by Dave

Attachment: ticket.png added

comment:9 Changed 11 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 11 years ago by Dave

The smp_project table is empty

comment:11 Changed 11 years ago by Ryan J Ollos

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 11 years ago by falkb

Attachment: mysql.patch added

for better considering the rules for DB API usage

comment:12 Changed 11 years ago by falkb

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

comment:13 Changed 11 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 Changed 11 years ago by Ryan J Ollos

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 11 years ago by falkb

Replying to rjollos:

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

     
    5050    cursor = db.cursor()
    5151    fields = TicketSystem(env).get_ticket_fields()
    5252    if field in [f['name'] for f in fields if not f.get('custom')]:
    53         cursor.execute("SELECT id,status,%s FROM ticket WHERE %s='%s' ORDER BY %s" % (field, any_name, any_value, field))
     53        cursor.execute("""SELECT id,status,%s FROM ticket WHERE %s=%%s ORDER BY %s""" % (field, any_name, field), [any_value])
    5454    else:
    55         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))
     55        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])
    5656    tickets = []
    5757    for tkt_id, status, fieldval in cursor:
    5858        tickets.append({'id': tkt_id, 'status': status, field: fieldval})
     
    400400                        cursor.execute("""
    401401                            SELECT DISTINCT COALESCE(%s,'') FROM ticket
    402402                            ORDER BY COALESCE(%s,'')
    403                             """ % (by, by))
     403                            """, [by, by])
    404404                        groups = [row[0] for row in cursor]
    405405
    406406            max_count = 0

comment:16 Changed 11 years ago by Ryan J Ollos

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

comment:17 Changed 11 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 11 years ago by falkb

Replying to 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
+ adding of projects

comment:19 in reply to:  description ; Changed 11 years ago by klanjabrik

Replying to WildShroom:

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.

Same here, can't add project from admin,

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 ; Changed 11 years ago by falkb

Replying to klanjabrik:

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 ; Changed 11 years ago by anonymous

Replying to falkb:

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 ; Changed 11 years ago by falkb

Replying to anonymous:

SVN version: 1.6.11

sorry, I mean the plugin SVN version

comment:23 in reply to:  22 Changed 11 years ago by klanjabrik

Replying to falkb:

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 Changed 11 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 ; Changed 11 years ago by anonymous

Replying to 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.

comment:26 in reply to:  25 ; Changed 11 years ago by falkb

Replying to anonymous:

Replying to 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 11 years ago by anonymous

Replying to falkb:

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 Changed 11 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 ; Changed 11 years ago by falkb

Replying to 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.

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 11 years ago by anonymous

Replying to falkb:

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 Changed 11 years ago by falkb

Resolution: fixed
Status: newclosed

happyusercount = happyusercount + 1

comment:32 in reply to:  31 Changed 11 years ago by Ryan J Ollos

Replying to falkb:

happyusercount = happyusercount + 1

happyusercount += 1 might be considered more Pythonic ;)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain falkb.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.