Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@LazyProperty
def server_name(self):
p1 = Popen(['hostname', '-s'], stdout=PIPE)
server_name = p1.communicate()[0].strip()
p1.wait()
return server_name
@LazyProperty
def size(self):
return self.repo.blob_size(self)
@LazyProperty
def artifact(self):
'''Look up the artifact referenced'''
aref = self.artifact_reference
try:
cls = loads(str(aref.cls))
with h.push_context(aref.project_id):
return cls.query.get(_id=aref.artifact_id)
except:
log.exception('Error loading artifact for %s: %r',
self._id, aref)
@LazyProperty
def authored_user(self):
return User.by_email_address(self.authored.email)
@LazyProperty
def roles_that_reach(self):
def _iter():
visited = set()
to_visit = list(self)
while to_visit:
r = to_visit.pop(0)
if r['_id'] in visited:
continue
visited.add(r['_id'])
yield r
pr_rindex = self.cred.project_roles(
r['project_id']).reverse_index
to_visit += pr_rindex[r['_id']]
return RoleCache(self.cred, _iter())
@LazyProperty
def _sitedb_row(self):
q = T.mail_group_list.select(T.mail_group_list.c.list_name==self.name)
q = q.where(
T.mail_group_list.c.group_id==context.project.get_tool_data('sfx', 'group_id'))
return q.execute().first()
@LazyProperty
def allowed_tool_status(self):
return ['production'] + self._extra_tool_status
@LazyProperty
def changed_paths(self):
'''
Returns a list of paths changed in this commit.
Leading and trailing slashes are removed, and
the list is complete, meaning that if a sub-path
is changed, all of the parent paths are included
(including '' to represent the root path).
Example:
If the file /foo/bar is changed in the commit,
this would return ['', 'foo', 'foo/bar']
'''
changes = self.repo.get_changes(self._id)
changed_paths = set()
for change in changes:
@LazyProperty
def _content_type_encoding(self):
return self.repo.guess_type(self.name)
@LazyProperty
def remove_socialnetwork_form(self):
'''
:return: None, or an easywidgets Form to render on the user preferences page to
allow removing a social network account.
'''
from allura.lib.widgets.forms import RemoveSocialNetworkForm
return RemoveSocialNetworkForm(action='/auth/preferences/remove_social_network')