Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
trove_parent_id=534,
shortname="testers",
fullname="Testers",
fullpath="Intended Audience :: by End-User Class :: Testers")
M.TroveCategory(trove_cat_id=866,
trove_parent_id=534,
shortname="secpros",
fullname="Security Professionals",
fullpath="Intended Audience :: by End-User Class :: Security Professionals")
M.TroveCategory(trove_cat_id=867,
trove_parent_id=535,
shortname="secindustry",
fullname="Security",
fullpath="Intended Audience :: by Industry or Sector :: Security")
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
pylons.c.app = pylons.c.project.app_instance(
cfg.options.mount_point)
method(pylons.c.app, msg.delivery_info['routing_key'], data)
else:
# Classmethod or function -- just call once
method(msg.delivery_info['routing_key'], data)
except: # pragma no cover
base.log.exception('Exception react handling %s: %s', tool_name, method)
for k,v in self.Supplement(pylons.c, data, msg, 'audit').extraData().items():
base.log.error(' %s: %s', k, v)
if self.options.dry_run: raise
self.send_error_report(sys.exc_info())
else:
ming.orm.ormsession.ThreadLocalORMSession.flush_all()
finally:
ming.orm.ormsession.ThreadLocalORMSession.close_all()
self.teardown_globals()
return callback
def main():
M.TroveCategory(trove_cat_id=670,
trove_parent_id=14,
shortname="agpl",
fullname="Affero GNU Public License",
fullpath="License :: OSI-Approved Open Source :: Affero GNU Public License")
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
moderate=[root._id], admin=[root._id]))
assert tg.config['auth.method'] == 'local'
project_reg = plugin.ProjectRegistrationProvider.get()
p_projects = project_reg.register_neighborhood_project(n_projects, [root])
p_users = project_reg.register_neighborhood_project(n_users, [root])
p_adobe = project_reg.register_neighborhood_project(n_adobe, [root])
M.Theme(name='forge_default',
label='Default Forge Theme',
color1='#295d78',
color2='#272727',
color3='#454545',
color4='#c3c3c3',
color5='#d7d7d7',
color6='#ebebeb')
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
# add the adobe icon
file_name = 'adobe_icon.png'
file_path = os.path.join(pyforge.__path__[0],'public','nf','images',file_name)
f = file(file_path, 'r')
content_type = guess_type(file_name)
if content_type: content_type = content_type[0]
else: content_type = 'application/octet-stream'
with M.NeighborhoodFile.create(
content_type=content_type,
filename=file_name,
neighborhood_id=n_adobe._id) as fp:
while True:
s = f.read()
if not s: break
fp.write(s)
log.info('Registering "regular users" (non-root)')
def main():
broken_posts = BM.BlogPost.query.find(dict(neighborhood_id=None)).all()
for post in broken_posts:
c.project = post.app.project
c.app = post.app
post.neighborhood_id = post.app.project.neighborhood_id
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
discussions = DM.Forum.query.find(app_config_id=discussion_app.config._id).all()
for discuss in discussions:
for post in discuss.posts:
post_id = "%s" % post._id
if post_id not in json_talk:
continue
post.text = json_talk[post_id]['text']
for hist in post.history().all():
hist_id = "%s" % hist._id
if hist_id in json_talk[post_id]['history']:
hist.data['text'] = json_talk[post_id]['history'][hist_id]['text']
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
log.info('Would renumber mounts for project "%s".' % project.shortname)
else:
log.info('Renumbering mounts for project "%s".' % project.shortname)
for i, mount in enumerate(mounts):
if 'ac' in mount:
mount['ac'].options['ordinal'] = i
elif 'sub' in mount:
mount['sub'].ordinal = i
ThreadLocalORMSession.flush_all()
num_projects_examined += 1
session(project).clear()
log.info('%s projects examined.' % num_projects_examined)
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
create_trove_categories = CreateTroveCategoriesCommand('create_trove_categories')
create_trove_categories.run([''])
if create_test_data:
p0.add_user(u_admin, ['Admin'])
log.info('Registering initial apps')
with h.push_config(c, user=u_admin):
p0.install_apps([{'ep_name': ep_name}
for ep_name, app in g.entry_points['tool'].iteritems()
if app._installable(tool_name=ep_name,
nbhd=n_projects,
project_tools=[])
])
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
if create_test_data:
# reload our p0 project so that p0.app_configs is accurate with all the
# newly installed apps
p0 = M.Project.query.get(_id=p0._id)
sub = p0.new_subproject('sub1', project_name='A Subproject')
with h.push_config(c, user=u_admin):
sub.install_app('wiki')
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()