How to use the sma.archiver.PostArchive function in sma

To help you get started, we’ve selected a few sma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sdockray / sma / sma / archiver.py View on Github external
def file_load(self, filename='archive.pkl'):
		d = super(GroupArchive, self).file_load(filename)
		if not d:
			return False
		if 'obj' in d:
			self.obj = d['obj']
			self.ingest_obj()
		if 'links' in d:
			for l in d['links']:
				self.links[l.url] = l
		if 'posts' in d:
			for p in d['posts']:
				post = PostArchive(self.graph, None, obj=p)
				for k in post.links:
					if k in self.links:
						post.links[k] = self.links[k]
				self.add_post(post)
		self.isLoaded = True
github sdockray / sma / sma / archiver.py View on Github external
def __init__(self, graph, id, *args, **kwargs):
		super(PostArchive, self).__init__(args, kwargs)
		self.graph = graph
		self.id = id
		self.obj = None
		self.users = {}
		self.links = {}
		self.comments = []
		if 'obj' in kwargs:
			self.obj = kwargs['obj']
			self.ingest_obj()
		if not self.obj:
			print "Initiating post archive: ",id
			filename = kwargs['filename'] if 'filename' in kwargs else 'archive.pkl'
			self.file_load(filename)
			if self.graph and not self.obj:
				self.graph_load()
github sdockray / sma / sma / archiver.py View on Github external
def load_data(data):
			for d in data:
				p = PostArchive(self.graph, d['id'])
				self.add_post(p)
		# Go!
github sdockray / sma / sma / archiver.py View on Github external
def archive_post(self, id):
		a = PostArchive(self.g, id)
		a.save()
		a.snaps()
		a.markdownify()
		a.save()