~kai-mast/friends/keep-mentions

« back to all changes in this revision

Viewing changes to friends/utils/model.py

  • Committer: Kai Mast
  • Date: 2014-01-29 12:12:03 UTC
  • Revision ID: mail@kai-mast.de-20140129121203-ow3ah0tz74zonu77
Seems to do what I want it to do

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
MODEL_DBUS_NAME = 'com.canonical.Friends.Streams'
82
82
Model = Dee.SharedModel.new(MODEL_DBUS_NAME)
83
83
 
84
 
 
85
84
def persist_model():
86
85
    """Write our Dee.SharedModel instance to disk."""
87
86
    log.debug('Trying to save Dee.SharedModel with {} rows.'.format(len(Model)))
97
96
 
98
97
    counts = {}
99
98
 
 
99
    schema = Schema()
 
100
    Model.set_column_names_full(schema.NAMES)
 
101
 
100
102
    while pos >= 0:
101
103
        iter = Model.get_iter_at_row(pos)
102
 
        stream = Model.get_row(iter).message_id
 
104
        index = Model.get_column_index('stream')
 
105
 
 
106
        stream = Model.get_string(iter, index)
103
107
 
104
108
        # count all replies as one stream
105
109
        if ('reply' in stream):