How to use the sma.files 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 save(self, filename, obj):
		files.save_obj(obj, self.id, filename)
github sdockray / sma / sma / archiver.py View on Github external
def absurl(path):
			return files.tnurl(path)
		title_to_use = self.title if hasattr(self,'title') and self.title else self.url
github sdockray / sma / sma / archiver.py View on Github external
if preferred_image:
					output = "%s&gt; [ ![%s](%s \"%s\") ](%s \"%s\") <br>\n" % (output, title_to_use_bracket_safe, absurl(preferred_image), title_to_use_quote_safe, files.lurl(self.url), title_to_use_quote_safe)
			output = "%s&gt; [%s](%s \"%s\") <br>\n" % (output, title_to_use_bracket_safe, files.lurl(self.url), title_to_use_quote_safe)
			if self.summary:
				about = "%s... %s" % (self.summary, self.description)
				about = re.sub('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&amp;+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', '', about)
				about = re.sub(r'[\r\n]*', '', about)
				output = "%s&gt; %s<br>\n" % (output, about[:500])
			return output
		else:
			if not text_only:
				#[ ![Image](/images/image.jpg "Image title") ](http://google.com "Google")
				if preferred_image:
					return "[ ![%s](%s \"%s\") ](%s \"%s\")" % (title_to_use_bracket_safe, absurl(preferred_image), title_to_use_quote_safe, files.lurl(self.url), title_to_use_quote_safe)
			# fallback to text only
			return "[%s](%s \"%s\")" % (title_to_use_bracket_safe, files.lurl(self.url), title_to_use_quote_safe)
		# fallback
		return ""
github sdockray / sma / sma / archiver.py View on Github external
def file_load(self, filename):
		return files.load_obj(self.id, filename)