# Path: feedplatform/addins.py
# class base(object):
#     class __metaclass__(type):
#         def __new__(cls, name, bases, attrs):
#     def __new__(cls, *args, **kwargs):
#     def setup(self):
#     def log(self):
# def get_addins():
# def _make_addin(addin):
# def reinstall(addins=None):
#         def resolve_dependencies(addin, index):
# def install(*args, **kwargs):
# _ADDINS = None
#     _ADDINS = to_be_setup
# 
# Path: feedplatform/db.py
# class MultipleObjectsReturned(Exception):
# class DatabaseProxy(object):
# class ModelsProxy(types.ModuleType):
# def get_one(result):
# def cap_model_name(name):
#     def repl(m):
# def uncap_model_name(name):
#     def __init__(self, create_func):
#     def _connect(self):
#     def __getattr__(self, name):
#     def __setattr__(self, name, value):
#     def __init__(self):
#     def __getattr__(self, name):
#     def __iter__(self):
#     def iternames(self):
#     def iteritems(self):
#     def _construct_models(self):
# def reconfigure():
# BASE_MODELS = {
#     'feed': {
#         'id': (Int, (), {'primary': True}),
#         'url': (Unicode, (), {}),
#         'items': (ReferenceSet, ('Feed.id', 'Item.feed_id',), {}),
#     },
#     'item': {
#         'id': (Int, (), {'primary': True}),
#         'feed_id': (Int, (), {}),
#         'feed': (Reference, ('feed_id', 'Feed.id',), {}),
#         'guid': (Unicode, (), {}),
#     },
# }
# 
# Path: feedplatform/util.py
# def struct_to_datetime(structt):
#     """Convert timestructs/9-tuples, as returned by feedparser, to
#     naive, UTC-based datetime objects.
# 
#     See also:
#         http://www.deadlybloodyserious.com/2007/09/feedparser-v-django/
#         http://www.intertwingly.net/blog/2007/09/02/Dealing-With-Dates
#     """
#     if not structt:
#         return structt
#     return datetime.datetime.utcfromtimestamp(calendar.timegm(structt))


from datetime import datetime
from storm.locals import Unicode, DateTime
from feedplatform import addins
from feedplatform import db
from feedplatform.util import struct_to_datetime

"""Addins that store feed metadata in the database for offline access.

# TODO: support custom rules for updating, e.g. update data never when
already existing, update always, only when a certain parser flag is
set (e.g. "fullparse"). This is useful for:
    * making sure data, once set or found, can't be changed by the
      feed author.
    * possibly reduce database writes, if feed authors who change
      their data a lot don't cause an update every time.

# TODO: option to disallow value deletion: values are only overwritten
if the new value is not empty.
"""




__all__ = (
    'base_data_collector',
    'collect_feed_data',
)



# Path: feedplatform/addins.py
# class base(object):
#     class __metaclass__(type):
#         def __new__(cls, name, bases, attrs):
#     def __new__(cls, *args, **kwargs):
#     def setup(self):
#     def log(self):
# def get_addins():
# def _make_addin(addin):
# def reinstall(addins=None):
#         def resolve_dependencies(addin, index):
# def install(*args, **kwargs):
# _ADDINS = None
#     _ADDINS = to_be_setup
# 
# Path: feedplatform/db.py
# class MultipleObjectsReturned(Exception):
# class DatabaseProxy(object):
# class ModelsProxy(types.ModuleType):
# def get_one(result):
# def cap_model_name(name):
#     def repl(m):
# def uncap_model_name(name):
#     def __init__(self, create_func):
#     def _connect(self):
#     def __getattr__(self, name):
#     def __setattr__(self, name, value):
#     def __init__(self):
#     def __getattr__(self, name):
#     def __iter__(self):
#     def iternames(self):
#     def iteritems(self):
#     def _construct_models(self):
# def reconfigure():
# BASE_MODELS = {
#     'feed': {
#         'id': (Int, (), {'primary': True}),
#         'url': (Unicode, (), {}),
#         'items': (ReferenceSet, ('Feed.id', 'Item.feed_id',), {}),
#     },
#     'item': {
#         'id': (Int, (), {'primary': True}),
#         'feed_id': (Int, (), {}),
#         'feed': (Reference, ('feed_id', 'Feed.id',), {}),
#         'guid': (Unicode, (), {}),
#     },
# }
# 
# Path: feedplatform/util.py
# def struct_to_datetime(structt):
#     """Convert timestructs/9-tuples, as returned by feedparser, to
#     naive, UTC-based datetime objects.
# 
#     See also:
#         http://www.deadlybloodyserious.com/2007/09/feedparser-v-django/
#         http://www.intertwingly.net/blog/2007/09/02/Dealing-With-Dates
#     """
#     if not structt:
#         return structt
#     return datetime.datetime.utcfromtimestamp(calendar.timegm(structt))


# Path: feedplatform/lib/addins/feeds/collect_feed_data.py
from datetime import datetime
from storm.locals import Unicode, DateTime
from feedplatform import addins
from feedplatform import db
from feedplatform.util import struct_to_datetime

"""Addins that store feed metadata in the database for offline access.

# TODO: support custom rules for updating, e.g. update data never when
already existing, update always, only when a certain parser flag is
set (e.g. "fullparse"). This is useful for:
    * making sure data, once set or found, can't be changed by the
      feed author.
    * possibly reduce database writes, if feed authors who change
      their data a lot don't cause an update every time.

# TODO: option to disallow value deletion: values are only overwritten
if the new value is not empty.
"""




__all__ = (
    'base_data_collector',
    'collect_feed_data',
)



class base_data_collector(addins.base):
