Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#7747 closed defect (fixed)

architecture,platform,type show nothing

Reported by: anonymous Owned by: Blackhex
Priority: normal Component: DownloadsPlugin
Severity: normal Keywords:
Cc: chuang@… Trac Release: 0.12

Description

we check trac.db and find data is there, but from web download list we see "architecture/platform" field of all files are both blank.

Attachments (0)

Change History (20)

comment:1 Changed 4 years ago by anonymous

  • Summary changed from architecture,platform show nothing to architecture,platform,type show nothing

comment:2 Changed 4 years ago by Blackhex

  • Status changed from new to assigned

Works for me. Could you be more specific about your system configuration and could you post debug level log from architectre/platform list event? See BugReporting and TracLogging for details.

comment:3 Changed 4 years ago by anonymous

System Information
Trac 0.12 
FullBlog 0.1.1-r8253 
Genshi 0.6 
mod_wsgi 3.2 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL}) 
pysqlite 2.6.0 
Python 2.4.3 (#1, Jun 11 2009, 14:09:58) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] 
setuptools 0.7a1 
SQLite 3.6.23.1 
Subversion 1.6.11 (r934486) 
jQuery: 1.4.2 

Installed Plugins
AdminEnumListPlugin  1.0 /svnroot/tracbase/ckb/plugins/AdminEnumListPlugin-1.0-py2.4.egg 
AnnouncerPlugin  0.2 /usr/lib/python2.4/site-packages/AnnouncerPlugin-0.2-py2.4.egg 
BatchModify  0.8.0a1-trac0.12 /svnroot/tracbase/ckb/plugins/BatchModify-0.8.0a1_trac0.12-py2.4.egg 
ChangeLogMacro  0.2 /svnroot/tracbase/ckb/plugins/ChangeLogMacro-0.2-py2.4.egg 
EstimationTools  0.4 /svnroot/tracbase/ckb/plugins/EstimationTools-0.4-py2.4.egg 
ForceComment  0.1 /svnroot/tracbase/ckb/plugins/ForceComment-0.1-py2.4.egg 
hideable-query  0.1 /svnroot/tracbase/ckb/plugins/hideable_query-0.1-py2.4.egg 
IcuCodeTools  0.0.1dev-r28251 /svnroot/trac/plugins/IcuCodeTools 
LoomingClouds  0.12r1 /usr/lib/python2.4/site-packages/LoomingClouds-0.12r1-py2.4.egg 
multiplerepos-revision  N/A /svnroot/tracbase/ckb/plugins/multiplerepos_revision.pyc 
privatereports  0.1 /svnroot/tracbase/ckb/plugins/privatereports-0.1-py2.4.egg 
RoadmapFilter  N/A /svnroot/tracbase/ckb/plugins/RoadmapFilter.pyc 
ticketvalidator.admin  N/A /svnroot/tracbase/ckb/plugins/TicketValidator-0.1-py2.4.egg/ticketvalidator/admin.pyc 
ticketvalidator.core  N/A /svnroot/tracbase/ckb/plugins/TicketValidator-0.1-py2.4.egg/ticketvalidator/core.pyc 
timingandestimationplugin  1.0.5b /svnroot/tracbase/ckb/plugins/timingandestimationplugin-1.0.5b-py2.4.egg 
TracAccountManager  0.2.1dev-r7737 /usr/lib/python2.4/site-packages/TracAccountManager-0.2.1dev_r7737-py2.4.egg 
TracAutoComplete  0.1 /svnroot/tracbase/ckb/plugins/TracAutoComplete-0.1-py2.4.egg 
TracDocuments  0.3 /svnroot/tracbase/ckb/plugins/TracDocuments-0.3-py2.4.egg 
TracFullBlogPlugin  0.1.1-r8253 /usr/lib/python2.4/site-packages/TracFullBlogPlugin-0.1.1_r8253-py2.4.egg 
TracGanttCalendarPlugin  0.1 /svnroot/tracbase/ckb/plugins/TracGanttCalendarPlugin-0.1-py2.4.egg 
TracMenusPlugin  0.1 /svnroot/tracbase/ckb/plugins/TracMenusPlugin-0.1-py2.4.egg 
TracStats  0.3 /svnroot/tracbase/ckb/plugins/TracStats-0.3-py2.4.egg 
TracSubTicketsPlugin  0.1.0 /svnroot/tracbase/ckb/plugins/TracSubTicketsPlugin-0.1.0-py2.4.egg 
TracTags  0.6 /usr/lib/python2.4/site-packages/TracTags-0.6-py2.4.egg 
TracTicketChangelogPlugin  0.1 /svnroot/tracbase/ckb/plugins/TracTicketChangelogPlugin-0.1-py2.4.egg 
TracTicketTemplate  0.7 /svnroot/tracbase/ckb/plugins/TracTicketTemplate-0.7-py2.4.egg 
TracVote  0.1.3 /usr/lib/python2.4/site-packages/TracVote-0.1.3-py2.4.egg 
TracWatchlistPlugin  0.4.8139 /usr/lib/python2.4/site-packages/TracWatchlistPlugin-0.4.8139-py2.4.egg 
TracWysiwyg  0.12.0.2-r8148 /usr/lib/python2.4/site-packages/TracWysiwyg-0.12.0.2_r8148-py2.4.egg 
whiteboard  0.1.0-trac0.12 /svnroot/tracbase/ckb/plugins/whiteboard-0.1.0_trac0.12-py2.4.egg 

comment:4 Changed 4 years ago by anonymous

I added some debug in api.py code like
    def get_documents(self, context, order_by = 'id', desc = False):
        # Get documents from table. 
        documents = self._get_items(context, 'document', ('id', 'file',
          'description', 'size', 'time', 'count', 'author', 'tags', 'component',
          'version', 'model', 'platform', 'type'), order_by = order_by,
          desc = desc)
#debug2 
        self.log.debug(documents)
    
        # Replace field IDs with apropriate objects.
        for document in documents:
            document['model'] = self.get_model(context.cursor,
              document['model'])
            document['platform'] = self.get_platform(context.cursor, 
              document['platform'])
            document['type'] = self.get_type(context.cursor, document['type'])
#debug2     
        self.log.debug(documents)

===================

I found the result in trac.log:
#debug1:
2010-09-29 18:14:24,874 Trac[api] DEBUG: [{'count': 0, 'description': u'test', 'author': u'link', 'tags': None, 'component': u
'Other', 'platform': 1, 'version': u'BCM4.02L.03', 'file': u'WebUIStyles.rar', 'time': 1285749890, 'architecture': 1, 'type': 1, 'id'
: 1, 'size': 1219426}]
#debug2:
2010-09-29 18:14:24,875 Trac[api] DEBUG: [{'count': 0, 'description': u'test', 'author': u'link', 'tags': None, 'component': u
'Other', 'platform': {'description': '', 'id': 0, 'name': ''}, 'version': u'BCM4.02L.03', 'file': u'WebUIStyles.rar', 'time':
1285749890, 'architecture': {'description': '', 'id': 0, 'name': ''}, 'type': {'description': '', 'id': 0, 'name': ''}, 'id': 1, 'siz
e': 1219426}]


The problem may locate the code between debug1 and debug2.

comment:5 Changed 4 years ago by anonymous

***Here "model" == "architecture", only word replacements.
in code
    def get_model(self, context, id):
        model = self._get_item(context, 'model', ('id', 'name',
          'description'), 'id = %s', (id,))
#link
        self.log.debug(model)
        if not model:
            model = {'id' : 0, 'name' : '', 'description' : ''}
        return model

===== 
in Trac.log we see
2010-09-30 11:50:03,215 Trac[api] DEBUG: SELECT id, name, description FROM model WHERE id = 1
2010-09-30 11:50:03,216 Trac[api] DEBUG: None <===sql result is null.


=====
In trac.db, we run the sql, the result is ok.
[root@titan db]# sqlite3 trac.db 
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> SELECT id, name, description FROM model WHERE id = 1;
1|alpha|
sqlite>



comment:6 Changed 4 years ago by Blackhex

  • Resolution set to invalid
  • Status changed from assigned to closed

This doesn't make sence. Either you have some typo with non-visible chars in your string literals (It happens to me sometimes when I hit a wrong key using ALT+something keyworks) or your Trac instance is using different database file than you have used with sqlite3 console.

Try to replace self._get_item() with to see the result:

  context.cursor.execute("SELECT id, name, desription FROM model WHERE id = 1")
  for row in context.cursor:
      self.log.debug(row)

Anyway this problem is related to some customized version of DownloadsPlugin and not the upstream version so I'm closing this ticket as invalid but you may continue with discussion here.

comment:7 Changed 4 years ago by anonymous

The original version has the same issue too. I tested it before. this version is replace word architecture with model by sed command. so code should be the same. Did you think it's possible to Python-2.4?

comment:8 Changed 4 years ago by Blackhex

Could be, I didn't tested it with Python 2.4 but I don't know the reason what's difference here.

What's the result of:

context.cursor.execute("SELECT id, name, desription FROM model WHERE id = 1")
for row in context.cursor:
    self.log.debug(row)

?

comment:9 Changed 4 years ago by anonymous

The result is the same.

def _get_item_model(self, context, table, columns, where = , values = ()):

sql = 'SELECT id, name, description FROM model WHERE id = 1' self.log.debug(sql) context.cursor.execute(sql)

for row in context.cursor:

self.log.debug(row) <===No run to here, so result is None. row = dict(zip(columns, row)) return row

return None

=== 2010-09-30 17:23:08,564 Trac[api] DEBUG: SELECT id, name, description FROM model WHERE id = 1 2010-09-30 17:23:08,565 Trac[api] DEBUG: None

comment:10 Changed 4 years ago by Blackhex

And

context.cursor.execute("SELECT id, name, desription FROM model WHERE id = '1'")
for row in context.cursor:
    self.log.debug(row)

?

comment:11 Changed 4 years ago by anonymous

The result is also the same:

2010-10-02 19:09:27,084 Trac[api] DEBUG: SELECT id, name, description FROM model WHERE id = '1' 2010-10-02 19:09:27,085 Trac[api] DEBUG: SELECT id, name, description FROM model WHERE id = '1' 2010-10-02 19:09:27,085 Trac[api] DEBUG: (1,) 2010-10-02 19:09:27,085 Trac[api] DEBUG: None

comment:12 Changed 4 years ago by anonymous

The result is also the same:

How is so? It returned one row...

comment:13 Changed 4 years ago by Blackhex

I think the problem is in mod_wsgi implementation of cursor, I'll try it with mod_wsgi lately but I doubt I can do anything about it.

comment:14 Changed 4 years ago by anonymous

The result is cursor still get None record. Do you think Python2.6+mod_wsgi can slove this issue? I'll try Python 2.6 soon, thanks.

comment:15 Changed 4 years ago by anonymous

This is not None:

2010-10-02 19:09:27,085 Trac[api] DEBUG: (1,)

I'm loosing the context here.

Do you think Python2.6+mod_wsgi can slove this issue?

I don't know, I have to try it but not today.

comment:16 Changed 4 years ago by anonymous

Sorry.

it's printed by below debug code.

def _get_item_model(self, context, table, columns, where = '', values = ()):
        sql = "SELECT id, name, description FROM model WHERE id = '1'"
        self.log.debug(sql)
        context.cursor.execute(sql)

        self.log.debug(sql)
        self.log.debug(values) <====output: DEBUG: (1,)
        for row in context.cursor:
            self.log.debug(row) <===not Run to here, so cursor is None.
            row = dict(zip(columns, row))
            return row
        return None

comment:17 Changed 4 years ago by anonymous

Hi,

I update Trac to Python2.6 and with original download plugin, it still doesn't work. what else information do you want me to dig out? thanks.

comment:18 Changed 4 years ago by Blackhex

  • Resolution invalid deleted
  • Status changed from closed to reopened

All right, I must apologize for misunderstanding. The problem was the whole time there but I was looking elsewhere because I didn't read the bug description carefully. Changeset r9269 should fix that. Please close the ticket if it does.

comment:19 Changed 4 years ago by anonymous

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

it works!! set it close as fixed, thanks.

comment:20 Changed 4 years ago by Blackhex

Thank you. Once aggain, sorry for my inattention during reading the issue description. It could save a lot of time to both of us.

Add Comment

Modify Ticket

Action
as closed The owner will remain Blackhex.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.