Roundup Tracker

Contributed by Bryce (bnordgren). See https://issues.roundup-tracker.org/issue2550677 for initial submission. The issue also has the results from experimenting with it in a live tracker.

Bryce's note is:

from interceptor import interceptor_factory, GzipFileClass, UniqueFileClass

# Make a message file class which compresses the content before storage.
MessageFileClass = interceptor_factory('MessageFileClass',GzipFileClass,FileClass)

# Make a file class which only stores unique files.
DataFileClass = interceptor_factory('DataFileClass',UniqueFileClass,FileClass)

The file is attached to this page and can be downloaded using interceptor.py.

Additional notes from the issue from experiments.

To use this put in the tracker's lib subdirectory (create if missing).

Then add at the top of schema.py:

  from interceptor import interceptor_factory, GzipFileClass,
UniqueFileClass

  # Make a message file class which compresses the content before storage.
  MessageFileClass =
interceptor_factory('MessageFileClass',GzipFileClass,FileClass)

  # Make a file class which only stores unique files.
  DataFileClass
=interceptor_factory('DataFileClass',UniqueFileClass,FileClass)

then later in schema.py replace FileClass:

  # FileClass automatically gets this property in addition to the Class
ones:
  #   content = String()    [saved to disk in <tracker home>/db/files/]
  #   type = String()       [MIME type of the content, default 'text/plain']
  msg = MessageFileClass(db, "msg",
                author=Link("user", do_journal='no'),
                recipients=Multilink("user", do_journal='no'),
                date=Date(),
                summary=String(),
                files=Multilink("file"),
                messageid=String(),
                inreplyto=String())

  file = DataFileClass(db, "file",
                name=String())

as shown above.

I have not found any issues with the gzip of messages. The gui displays msg files on disk in both uncompressed (before schema change) and compressed (after schema change).

Using "zcat db/fles/msgs/0/msgs3" will show the contents of the compressed message.

DataFileClass is interesting but has the following UI issues:

... see issue for comments.

I wonder is something similar could be done for those people who want to: