rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
options.ordinal = p['ordinal']
options.ordinal = int(p['ordinal'])
def update_mounts(self, subproject=None, tool=None, new=None, **kw): if subproject is None: subproject = [] if tool is None: tool = [] for sp in subproject: if sp.get('delete'): require(has_project_access('delete'), 'Delete access required') h.log_action(log, 'delete subproject').info( 'delete subproject %s', sp['short...
log.info('JTB13 Auditing data from %s (%s)',
log.info('Auditing data from %s (%s)',
def auditor(self, routing_key, data): log.info('JTB13 Auditing data from %s (%s)', routing_key, self.config.options.mount_point) try: elements = routing_key.split('.') count = len(elements) except: log.info('Audit applies to page Root.') p = model.Page.upsert('Root') else: log.info('JTB13 Audit applies to page ' + elem...
log.info('JTB13 Audit applies to page ' + elements[1])
log.info('Audit applies to page ' + elements[1])
def auditor(self, routing_key, data): log.info('JTB13 Auditing data from %s (%s)', routing_key, self.config.options.mount_point) try: elements = routing_key.split('.') count = len(elements) except: log.info('Audit applies to page Root.') p = model.Page.upsert('Root') else: log.info('JTB13 Audit applies to page ' + elem...
except: log.info('JTB13 failed to configure wiki') else: log.info('JTB13 configured wiki')
def auditor(self, routing_key, data): log.info('JTB13 Auditing data from %s (%s)', routing_key, self.config.options.mount_point) try: elements = routing_key.split('.') count = len(elements) except: log.info('Audit applies to page Root.') p = model.Page.upsert('Root') else: log.info('JTB13 Audit applies to page ' + elem...
ur = M.ProjectRole.query.get(user_id=user._id)
ur = user.project_role()
def update_user_roles(self, role=None, new=None, **kw): require(has_project_access('security')) if role is None: role = [] for r in role: if r.get('new', {}).get('add'): user = M.User.query.find({'username':str(r['new']['id'])}).first() if user: ur = M.ProjectRole.query.get(user_id=user._id) if ObjectId(str(r['id'])) n...
message['In-Reply-To'] = '<' + in_reply_to + '>'
message['In-Reply-To'] = ','.join(('<' + irt + '>') for irt in in_reply_to)
def sendmail(self, addrs, addrfrom, subject, message_id, in_reply_to, message): if not addrs: return message['To'] = 'undisclosed-recipients' message['From'] = addrfrom message['Subject'] = subject message['Message-ID'] = '<' + message_id + '>' if in_reply_to: message['In-Reply-To'] = '<' + in_reply_to + '>' content = ...
expected_migrations = [ (ab, ver, 'up') for ver in range(10) for ab in 'ab'] assert expected_migrations == test_globals.migrations_run
self._expect_migrations([ (ab, ver, 'up') for ver in range(10) for ab in 'ab'])
def test_simple(self): self.cmd.run(self.args) expected_migrations = [ (ab, ver, 'up') for ver in range(10) for ab in 'ab'] assert expected_migrations == test_globals.migrations_run
expected_migrations = [ ('a', ver, 'up') for ver in range(10) ] assert expected_migrations == test_globals.migrations_run
self._expect_migrations([ ('a', ver, 'up') for ver in range(10) ])
def test_only_a(self): self.cmd.run(self.args + ['a']) expected_migrations = [ ('a', ver, 'up') for ver in range(10) ] assert expected_migrations == test_globals.migrations_run
expected_migrations = [ (ab, ver, 'up') for ver in range(10) for ab in 'ab'] assert expected_migrations == test_globals.migrations_run
self._expect_migrations([ (ab, ver, 'up') for ver in range(10) for ab in 'ab'])
def test_b_requires_a(self): self.cmd.run(self.args + ['b']) expected_migrations = [ (ab, ver, 'up') for ver in range(10) for ab in 'ab'] assert expected_migrations == test_globals.migrations_run
assert expected_migrations == test_globals.migrations_run
self._expect_migrations(expected_migrations)
def test_downgrade(self): self.cmd.run(self.args) self.cmd.run(self.args + ['a=5']) # Migrate up expected_migrations = [ (ab, ver, 'up') for ver in range(10) for ab in 'ab'] # Migrate a down expected_migrations += [ ('a', 9, 'down'), ('a', 8, 'down'), ('a', 7, 'down'), ('a', 6, 'down') ] assert expected_migrations == t...
raise exc.HTTPNotFound
redirect('..')
def post(self): result = self.M.Post.query.find(dict(slug=self._post_slug)).all() for p in result: if p.thread_id == self.thread._id: return p if result: redirect(result[0].url()) else: raise exc.HTTPNotFound
if self.post is None: redirect('..')
def index(self, version=None, **kw): if self.post is None: redirect('..') c.post = self.W.post if request.method == 'POST': require(has_artifact_access('moderate', self.post)) post_fields = self.W.edit_post.validate(kw, None) for k,v in post_fields.iteritems(): try: setattr(self.post, k, v) except AttributeError: conti...
assert sidebar_contains(ticket_view, '[
assert '[
def test_subtickets(self): # create two tickets self.new_ticket(summary='test superticket') self.new_ticket(summary='test subticket') h.set_context('test', 'bugs') super = tm.Ticket.query.get(ticket_num=1) sub = tm.Ticket.query.get(ticket_num=2) # make one ticket a subticket of the other sub.set_as_subticket_of(super....
strings = [ opt.string for opt in new_ep_opts ]
strings = [ opt.string.strip() for opt in new_ep_opts ]
def test_tool_list(self): r = self.app.get('/admin/tools') new_ep_opts = r.html.find('select',{'class':"new_ep_name"}).findAll('option') strings = [ opt.string for opt in new_ep_opts ] assert strings == [ 'New Tool', 'External Link', 'Git', 'Mercurial', 'SVN', 'Wiki', 'Tickets', 'Discussion', 'Downloads', 'Mailing List...
'Subproject' ]
'Subproject' ], strings
def test_tool_list(self): r = self.app.get('/admin/tools') new_ep_opts = r.html.find('select',{'class':"new_ep_name"}).findAll('option') strings = [ opt.string for opt in new_ep_opts ] assert strings == [ 'New Tool', 'External Link', 'Git', 'Mercurial', 'SVN', 'Wiki', 'Tickets', 'Discussion', 'Downloads', 'Mailing List...
latest = self._impl.log(self.local_url, limit=1)
try: latest = self._impl.log(self.local_url, limit=1) except pysvn.ClientError: return 0
def count(self, branch=None): latest = self._impl.log(self.local_url, limit=1) if not latest: return 0 return latest[0].revision.number
log.info('... would fix ticket threads in %s', p.shortname)
log.info('... would fix ticket threads in %s', project.shortname)
def main(): test = sys.argv[-1] == 'test' all_projects = M.Project.query.find().all() log.info('Fixing tracker thread subjects') for project in all_projects: if project.parent_id: continue c.project = project all_tickets = TM.Ticket.query.find() # will find all tickets for all trackers in this project if not all_ticket...
log.info('... fixing ticket threads in %s', p.shortname)
log.info('... fixing ticket threads in %s', project.shortname)
def main(): test = sys.argv[-1] == 'test' all_projects = M.Project.query.find().all() log.info('Fixing tracker thread subjects') for project in all_projects: if project.parent_id: continue c.project = project all_tickets = TM.Ticket.query.find() # will find all tickets for all trackers in this project if not all_ticket...
base.log.info('Building indexes on %s', cls)
def command(self): from allura import model as M self.basic_setup() projects = M.Project.query.find().all() for name, cls in MappedClass._registry.iteritems(): base.log.info('Building indexes on %s', cls) if cls.__mongometa__.session == M.main_orm_session: M.main_orm_session.update_indexes(cls, background=True) else: f...
for p in projects: base.log.info('...for project %s', p.shortname) c.project = p if session(cls) is None: continue session(cls).update_indexes(cls, background=True)
continue for p in projects: base.log.info('Building project indexes for %s', p.shortname) for name, cls in MappedClass._registry.iteritems(): if cls.__mongometa__.session == M.main_orm_session: continue base.log.info('... for class %s', cls) c.project = p if session(cls) is None: continue session(cls).update_indexes(cl...
def command(self): from allura import model as M self.basic_setup() projects = M.Project.query.find().all() for name, cls in MappedClass._registry.iteritems(): base.log.info('Building indexes on %s', cls) if cls.__mongometa__.session == M.main_orm_session: M.main_orm_session.update_indexes(cls, background=True) else: f...
summary = 'test render index' self.new_ticket(summary=summary)
def test_render_index(self): summary = 'test render index' self.new_ticket(summary=summary) index_view = self.app.get('/bugs/') assert_true(summary in index_view)
assert_true(summary in index_view)
assert 'Showing 250 results per page.' in index_view
def test_render_index(self): summary = 'test render index' self.new_ticket(summary=summary) index_view = self.app.get('/bugs/') assert_true(summary in index_view)
globals = model.Globals.query.get(app_config_id=c.app.config._id)
def save_ticket(self, ticket_num, tags, tags_old=None, **post_data): require(has_artifact_access('write')) if request.method != 'POST': raise Exception('save_new must be a POST request') if ticket_num: ticket = model.Ticket.query.get(app_config_id=c.app.config._id, ticket_num=int(ticket_num)) if not ticket: raise Excep...
setattr(ticket, k, v)
if k in custom_fields: ticket.custom_fields[k] = v else: setattr(ticket, k, v)
def save_ticket(self, ticket_num, tags, tags_old=None, **post_data): require(has_artifact_access('write')) if request.method != 'POST': raise Exception('save_new must be a POST request') if ticket_num: ticket = model.Ticket.query.get(app_config_id=c.app.config._id, ticket_num=int(ticket_num)) if not ticket: raise Excep...
path = p.neighborhood.url_prefix + p.shortname
if p.neighborhood.url_prefix != 'p/': path = p.neighborhood.url_prefix + p.shortname else: path = p.shortname
def _unix_group_name(self, p): path = p.neighborhood.url_prefix + p.shortname parts = path.split('/')[1:] return '.'.join(reversed(parts))
(quote(project_unixname or ''),quote(project_description or ''),quote(project_name or '')))
(quote_plus(project_unixname), quote_plus(project_description), quote_plus(project_name)))
def register(self, project_unixname=None, project_description=None, project_name=None, **kw): require(has_neighborhood_access('create', self.neighborhood), 'Create access required') try: p = self.neighborhood.register_project(project_unixname.lower()) except forge_exc.ProjectConflict: flash( 'A project already exists w...
flash('%s: %s' % (ex.__class__, str(ex)), 'error')
def register(self, project_unixname=None, project_description=None, project_name=None, **kw): require(has_neighborhood_access('create', self.neighborhood), 'Create access required') try: p = self.neighborhood.register_project(project_unixname.lower()) except forge_exc.ProjectConflict: flash( 'A project already exists w...
user = M.User.query.get(_id=u['id'])
user = M.User.query.get(_id=ObjectId(u['id']))
def update_user_roles(self, role=None, new=None, **kw): require(has_project_access('security')) if role is None: role = [] for r in role: if r.get('new', {}).get('add'): username = unicode(r['new']['id']) try: user = M.User.by_username(username) except AssertionError: user = None if user: ur = user.project_role() if Ob...
postlaunch = [ 'From sfu-scmprocess-1 so the following:\n' ] + postlaunch
postlaunch = [ 'From sfu-scmprocess-1 do the following:\n' ] + postlaunch
def make_ticket_text(engineer): tag_prefix = date.today().strftime('release_%Y%m%d') # get release tag existing_tags_today = command('git tag -l %s*' % tag_prefix) if existing_tags_today: tag = '%s.%.2d' % (tag_prefix, len(existing_tags_today)) else: tag = tag_prefix last_release = command('git tag -l release_*') if la...
prelaunch = [ 'From sfu-scmprocess-1 so the following:\n' ] + prelaunch
prelaunch = [ 'From sfn-mongo-1 do the following:\n' ] + prelaunch
def make_ticket_text(engineer): tag_prefix = date.today().strftime('release_%Y%m%d') # get release tag existing_tags_today = command('git tag -l %s*' % tag_prefix) if existing_tags_today: tag = '%s.%.2d' % (tag_prefix, len(existing_tags_today)) else: tag = tag_prefix last_release = command('git tag -l release_*') if la...
log.info('==========Calling constr============')
def make_artifact(self, ticket_dict): remapped = {} for f, v in ticket_dict.iteritems(): if f in self.FIELD_MAP: transform = self.FIELD_MAP[f] if transform is None: continue elif transform is True: remapped[f] = v elif callable(transform): transform(remapped, f, v) else: new_f, conv = transform remapped[new_f] = conv(v...
log.info('Ticket schema: %s', ticket.__mongometa__.schema.fields) log.info('Ticket state doc: %s', state(ticket).document) log.info('==========Calling update============')
def make_artifact(self, ticket_dict): remapped = {} for f, v in ticket_dict.iteritems(): if f in self.FIELD_MAP: transform = self.FIELD_MAP[f] if transform is None: continue elif transform is True: remapped[f] = v elif callable(transform): transform(remapped, f, v) else: new_f, conv = transform remapped[new_f] = conv(v...
log.info('==========Setting in_migr============') log.info('==========Calling save============')
def make_artifact(self, ticket_dict): remapped = {} for f, v in ticket_dict.iteritems(): if f in self.FIELD_MAP: transform = self.FIELD_MAP[f] if transform is None: continue elif transform is True: remapped[f] = v elif callable(transform): transform(remapped, f, v) else: new_f, conv = transform remapped[new_f] = conv(v...
log.info('users in doc: %s', self.collect_users(artifacts))
def perform_import(self, doc, create_users=True):
log.info(a)
def perform_import(self, doc, create_users=True):
log.info('Created ticket: %d', t.ticket_num)
def perform_import(self, doc, create_users=True):
log.info('Creating project %s', ug_name)
log.info('%s creating project %s', user.username, ug_name)
def create(self, user, neighborhood, shortname, short_description='No description'): with self._connect() as conn: ug_name = self._unix_group_name(neighborhood, shortname) log.info('Creating project %s', ug_name) args = dict( user_id=user.get_tool_data('sfx', 'userid'), unix_group_name=ug_name, group_name=shortname, sh...
if pr.user is not None and pr.user.get_tool_data.get('sfx', 'userid') is not None ])
if pr.user is not None and pr.user.get_tool_data('sfx', 'userid') is not None ])
def update(self, user, p): with self._connect() as conn: ug_name = p.get_tool_data('sfx', 'unix_group_name') if ug_name is None: ug_name = self._unix_group_name(p.neighborhood, p.shortname) p.set_tool_data('sfx', unix_group_name=ug_name) args = dict( user_id=user.tool_data.sfx.userid, group_name=p.shortname, short_desc...
assert len(resp.html.findAll('tr')) ==4, resp.showbrowser()
assert len(resp.html.findAll('tr')) ==6, resp.showbrowser()
def test_tree(self): ci = self._get_ci() resp = self.app.get(ci + 'tree/') assert len(resp.html.findAll('tr')) ==4, resp.showbrowser() resp = self.app.get(ci + 'tree/ew/') assert 'resource.py' in resp, resp.showbrowser()
assert 'Edit this page' in response
assert 'Edit TEST' in response
def test_sidebar_dynamic_page(self): response = self.app.get('/wiki/TEST/').follow() assert 'Edit this page' in response assert 'Related Pages' not in response self.app.get('/wiki/aaa/') self.app.get('/wiki/bbb/') # Fake out updating the pages since reactor doesn't work with tests app = search_main.SearchApp cmd = rea...
assert wiki_page.html.find('ul',{'id':'sidebarmenu'})
assert wiki_page.html.find('ul',{'class':'sidebarmenu'})
def test_show_left_bar(self): self.app.get('/wiki/TEST/') wiki_page = self.app.get('/wiki/TEST/') assert wiki_page.html.find('ul',{'id':'sidebarmenu'}) options_admin = self.app.get('/admin/wiki/options') assert options_admin.form['show_left_bar'].checked options_admin.form['show_left_bar'].checked = False options_admin...
assert not wiki_page2.html.find('ul',{'id':'sidebarmenu'})
assert not wiki_page2.html.find('ul',{'class':'sidebarmenu'})
def test_show_left_bar(self): self.app.get('/wiki/TEST/') wiki_page = self.app.get('/wiki/TEST/') assert wiki_page.html.find('ul',{'id':'sidebarmenu'}) options_admin = self.app.get('/admin/wiki/options') assert options_admin.form['show_left_bar'].checked options_admin.form['show_left_bar'].checked = False options_admin...
assert wiki_page3.html.find('ul',{'id':'sidebarmenu'})
assert wiki_page3.html.find('ul',{'class':'sidebarmenu'})
def test_show_left_bar(self): self.app.get('/wiki/TEST/') wiki_page = self.app.get('/wiki/TEST/') assert wiki_page.html.find('ul',{'id':'sidebarmenu'}) options_admin = self.app.get('/admin/wiki/options') assert options_admin.form['show_left_bar'].checked options_admin.form['show_left_bar'].checked = False options_admin...
return '%s://%s:%s%s' % (request.scheme, domain, port, path)
return '%s://%s:%s/%s' % (request.scheme, domain, port, path)
def url(self): if ':/' in self._id: domain, path = self._id.split(':/', 1) if ':' in request.host: port = request.host.split(':')[-1] return '%s://%s:%s%s' % (request.scheme, domain, port, path) else: return '%s://%s%s' % (request.scheme, domain, path) return '/' + path return '/' + self._id
return '%s://%s%s' % (request.scheme, domain, path)
return '%s://%s/%s' % (request.scheme, domain, path)
def url(self): if ':/' in self._id: domain, path = self._id.split(':/', 1) if ':' in request.host: port = request.host.split(':')[-1] return '%s://%s:%s%s' % (request.scheme, domain, port, path) else: return '%s://%s%s' % (request.scheme, domain, path) return '/' + path return '/' + self._id
closed_status_names = ew.TextField(label='Open Statuses')
closed_status_names = ew.TextField(label='Closed Statuses')
def resources(self): for r in super(CustomFieldAdmin, self).resources(): yield r yield ew.JSLink('tool/Tickets/js/custom-fields.js')
params=['value', 'offset', 'pagesize', 'total', 'style', 'show_subject']
params=['value', 'offset', 'pagesize', 'total', 'show_subject']
def resources(self): for r in super(Post, self).resources(): yield r for w in self.widgets.itervalues(): for r in w.resources(): yield r yield ew.JSScript(''' (function(){ $('.discussion-post').each(function(){ var post = this; $('.submit', post).button(); $('.flag_post, .delete_post', post).click(function(ele){ this.p...
style='threaded'
def resources(self): for r in super(Post, self).resources(): yield r for w in self.widgets.itervalues(): for r in w.resources(): yield r yield ew.JSScript(''' (function(){ $('.discussion-post').each(function(){ var post = this; $('.submit', post).button(); $('.flag_post, .delete_post', post).click(function(ele){ this.p...
ep_name = new['ep_name']
ep_name = new.get('ep_name', None)
def update_mounts(self, subproject=None, tool=None, new=None, **kw): if subproject is None: subproject = [] if tool is None: tool = [] for sp in subproject: if sp.get('delete'): require(has_project_access('delete'), 'Delete access required') h.log_action(log, 'delete subproject').info( 'delete subproject %s', sp['short...
log.info('Not updating mod_date')
log.debug('Not updating mod_date')
def before_save(data): if not getattr(artifact_orm_session._get(), 'skip_mod_date', False): data['mod_date'] = datetime.utcnow() else: log.info('Not updating mod_date') if c.project: c.project.last_updated = datetime.utcnow()
def update(self, text, tags, tags_old, viewable_by):
def update(self, text=None, tags=None, tags_old=None, viewable_by=None):
def update(self, text, tags, tags_old, viewable_by): require(has_artifact_access('edit', self.page)) if tags: tags = tags.split(',') else: tags = [] self.page.text = text self.page.commit() tag_artifact(self.page, c.user, tags) self.page.viewable_by = isinstance(viewable_by, list) and viewable_by or viewable_by.split('...
return c.app.url + '/' + str(self.ticket_num) + '/'
return c.app.url + str(self.ticket_num) + '/'
def url(self): return c.app.url + '/' + str(self.ticket_num) + '/'
if c.project.shortname.startswith('u/'):
if c.project.app_instance('home'): redirect('home/') elif c.project.app_instance('profile'):
def index(self): if c.project.shortname.startswith('u/'): redirect('profile/') else: redirect('home/')
redirect('home/')
redirect(c.project.app_configs[0].options.mount_point + '/')
def index(self): if c.project.shortname.startswith('u/'): redirect('profile/') else: redirect('home/')
tag[attr] = '/nf/redirect/?path=%s' % quote(val) tag['rel']='nofollow' return
if 'sf.net' in val or 'sourceforge.net' in val: return else: tag[attr] = '/nf/redirect/?path=%s' % quote(val) tag['rel']='nofollow' return
def _rewrite(self, tag, attr): val = tag.get(attr) if val is None: return if '://' in val: tag[attr] = '/nf/redirect/?path=%s' % quote(val) tag['rel']='nofollow' return if val.startswith('/'): return if val.startswith('.'): return tag[attr] = '../' + val
cookie_name = self.sfx_session_mgr.cookie_name mgr = self.sfx_session_mgr
cookie_name = self.sfx_session_manager.cookie_name mgr = self.sfx_session_manager
def authenticate_request(self): cookie_name = self.sfx_session_mgr.cookie_name mgr = self.sfx_session_mgr if 'userid' in self.session: if cookie_name not in self.request.cookies: self.logout() return M.User.anonymous() elif self.request.cookies[cookie_name] == self.session.get('sfx-sessid'): # already logged in return ...
if has_artifact_access('read', ticket_for_num[tn])()]
if tn in ticket_for_num and has_artifact_access('read', ticket_for_num[tn])()]
def paged_query(self, q, limit=None, page=0, sort=None, **kw): """Query tickets, sorting and paginating the result.
for field in globals.custom_fields.split(','): self.issue.custom_fields[field] = post_data[field]
if globals.custom_fields: for field in globals.custom_fields.split(','): self.issue.custom_fields[field] = post_data[field]
def update_issue(self, **post_data): require(has_artifact_access('write', self.issue)) if request.method != 'POST': raise Exception('update_issue must be a POST request') self.issue.summary = post_data['summary'] self.issue.description = post_data['description'] self.issue.assigned_to = post_data['assigned_to'] self.is...
optparser.add_option('--no-attachments', dest='do_attachments', action='store_false', defaulr=True, help='Export attachment info')
optparser.add_option('--no-attachments', dest='do_attachments', action='store_false', default=True, help='Export attachment info')
def parse_options(): optparser = OptionParser(usage=''' %prog <Trac URL>
while type(attach.nextSibling) is NavigableString:
while attach.nextSibling and type(attach.nextSibling) is NavigableString:
def parse_ticket_attachments(self, id): SIZE_PATTERN = r'(\d+) bytes' TIMESTAMP_PATTERN = r'(.+) in Timeline' # Scrape HTML to get ticket attachments url = self.full_url(self.ATTACHMENT_LIST_URL % id) self.log_url(url) f = urllib2.urlopen(url) soup = BeautifulSoup(f) attach = soup.find('div', id='attachments') list = [...
if attach.nextSibling.name == 'dd':
if attach.nextSibling and attach.nextSibling.name == 'dd':
def parse_ticket_attachments(self, id): SIZE_PATTERN = r'(\d+) bytes' TIMESTAMP_PATTERN = r'(.+) in Timeline' # Scrape HTML to get ticket attachments url = self.full_url(self.ATTACHMENT_LIST_URL % id) self.log_url(url) f = urllib2.urlopen(url) soup = BeautifulSoup(f) attach = soup.find('div', id='attachments') list = [...
yield ('pyforge', 1)
yield ('pyforge', 2)
def up_requires(self): yield ('pyforge', 1)
project_path = '/' + '/'.join(parts[1:])
project_path = '/' + '/'.join(parts)
def permissions(self, repo_path=None, **kw): """Expects repo_path to be a filesystem path like '/git/p/mygreatproject/reponame.git', or '/svn/adobe/someproject/subproject/reponame/'.
if ew.widget_context.widget:
if ew_core.widget_context.widget:
def fields(self): fields = [] fields.append(ffw.AutoResizeTextarea( name='text', attrs={'style':'height:7em; width:90%'})) fields.append(ew.HiddenField(name='forum', if_missing=None)) if ew.widget_context.widget: # we are being displayed if ew.widget_context.render_context.get('show_subject', self.show_subject): fields...
if ew.widget_context.render_context.get('show_subject', self.show_subject):
if ew_core.widget_context.render_context.get('show_subject', self.show_subject):
def fields(self): fields = [] fields.append(ffw.AutoResizeTextarea( name='text', attrs={'style':'height:7em; width:90%'})) fields.append(ew.HiddenField(name='forum', if_missing=None)) if ew.widget_context.widget: # we are being displayed if ew.widget_context.render_context.get('show_subject', self.show_subject): fields...
c.app = repo.app
try: c.app = repo.app except: log.exception('Error looking up app for %r', repo)
def main(): projects = M.Project.query.find().all() log.info('Refreshing repositories') for p in projects: if p.parent_id: continue c.project = p for cls in (GM.Repository, HM.Repository, SM.Repository): for repo in cls.query.find(): c.app = repo.app try: repo.refresh() except: log.exception('Error refreshing %r', repo...
if 'all' not in page.viewable_by and c.user.username not in page.viewable_by: raise exc.HTTPForbidden(detail="You may not view this page.")
def index(self, version=None, deleted=False): if deleted: self.page = model.Page.query.get(app_config_id=c.app.config._id, title=self.title, deleted=True) if not self.page: raise exc.HTTPNotFound require(has_artifact_access('delete', self.page)) # deleted pages can only be viewed by those with 'delete' permission elif ...
end_time = datetime.now()
end_time = datetime.utcnow()
def ago(start_time): """ Return time since starting time as a rounded, human readable string. E.g., "3 hours ago" """ granularities = ['century', 'decade', 'year', 'month', 'day', 'hour', 'minute'] end_time = datetime.now() while True: granularity = granularities.pop() ago = date.distance_of_time_in_words( start_time...
sidebarmenu = str(r.html.find('ul',{'id':'sidebarmenu'})) assert '<a href="/p/test/discussion/" class=" "><span class="ui-icon ui-icon-home"></span>Home</a>' in sidebarmenu assert '<a href="/p/test/admin/discussion" class=" "><span class="ui-icon ui-icon-wrench"></span>Admin</a>' in sidebarmenu assert '<a href="/p/test...
sidebarmenu = str(r.html.find('div',{'id':'sidebar'})) assert '<a href="/p/test/discussion/" class=" ico-l"><b class="ui-icon ui-icon-home"></b> <span>Home</span></a>' in sidebarmenu assert '<a href="/p/test/admin/discussion" class=" ico-l"><b class="ui-icon ui-icon-wrench"></b> <span>Admin</span></a>' in sidebarmenu a...
def test_sidebar_menu(self): r = self.app.get('/discussion/') sidebarmenu = str(r.html.find('ul',{'id':'sidebarmenu'})) assert '<a href="/p/test/discussion/" class=" "><span class="ui-icon ui-icon-home"></span>Home</a>' in sidebarmenu assert '<a href="/p/test/admin/discussion" class=" "><span class="ui-icon ui-icon-wre...
assert '<a href="/p/test/discussion/help" class="nav_child ">Forum Permissions</a>' in sidebarmenu assert '<a href="/p/test/discussion/markdown_syntax" class="nav_child ">Markdown Syntax</a>' in sidebarmenu assert '<a href=" assert '<a href=" assert '<a href="feed.rss" class=" "><span class="ui-icon ui-icon-signal-diag...
assert '<a href="/p/test/discussion/help" class="nav_child"> <span>Forum Permissions</span></a>' in sidebarmenu assert '<a href="/p/test/discussion/markdown_syntax" class="nav_child"> <span>Markdown Syntax</span></a>' in sidebarmenu assert '<a href=" assert '<a href=" assert '<a href="feed.rss" class=" ico-l"><b class=...
def test_sidebar_menu(self): r = self.app.get('/discussion/') sidebarmenu = str(r.html.find('ul',{'id':'sidebarmenu'})) assert '<a href="/p/test/discussion/" class=" "><span class="ui-icon ui-icon-home"></span>Home</a>' in sidebarmenu assert '<a href="/p/test/admin/discussion" class=" "><span class="ui-icon ui-icon-wre...
thread_sidebarmenu = str(thread.html.find('ul',{'id':'sidebarmenu'})) assert '<a href=" assert '<a href=" assert '<a href="feed.rss" class=" "><span class="ui-icon ui-icon-signal-diag"></span>Follow This</a>' in thread_sidebarmenu assert '<a href="flag_as_spam" class="sidebar_thread_spam "><span class="ui-icon ui-icon-...
thread_sidebarmenu = str(thread.html.find('div',{'id':'sidebar'})) assert '<a href=" assert '<a href=" assert '<a href="feed.rss" class=" ico-l"><b class="ui-icon ui-icon-signal-diag"></b> <span>Follow This</span></a>' in thread_sidebarmenu assert '<a href="flag_as_spam" class="sidebar_thread_spam ico-l"><b class="ui-i...
def test_sidebar_menu(self): r = self.app.get('/discussion/') sidebarmenu = str(r.html.find('ul',{'id':'sidebarmenu'})) assert '<a href="/p/test/discussion/" class=" "><span class="ui-icon ui-icon-home"></span>Home</a>' in sidebarmenu assert '<a href="/p/test/admin/discussion" class=" "><span class="ui-icon ui-icon-wre...
assert index_view.html.find('p',{'class':'light'}).string == '''Showing 0 results of 0 '''
assert 'No tickets found.' in index_view
def test_render_index(self): index_view = self.app.get('/bugs/') assert index_view.html.find('p',{'class':'light'}).string == '''Showing
return self._impl.iter_commits(rev=branch).next().count()
try: return self._impl.iter_commits(rev=branch).next().count() except StopIteration: return 0
def count(self, branch='master'): return self._impl.iter_commits(rev=branch).next().count()
for commit in repo.repository.iter_commits(rev=hash): cobj = GM.GitCommit(commit.sha)
for cobj in repo.iter_commits(rev=hash):
def refresh_commit(routing_key, data): h.set_context(data['project_id'], data['mount_point']) repo = pylons.c.app.repo hash = data['hash'] log.info('Refresh commit %s', hash) c_from, c_to = hash.split('..') for commit in repo.repository.iter_commits(rev=hash): cobj = GM.GitCommit(commit.sha) aref = cobj.dump_ref() for ...
for ref in search.find_shortlinks(commit.message):
for ref in search.find_shortlinks(cobj.message):
def refresh_commit(routing_key, data): h.set_context(data['project_id'], data['mount_point']) repo = pylons.c.app.repo hash = data['hash'] log.info('Refresh commit %s', hash) c_from, c_to = hash.split('..') for commit in repo.repository.iter_commits(rev=hash): cobj = GM.GitCommit(commit.sha) aref = cobj.dump_ref() for ...
assert_true(summary in response) response = self.app.get('/bugs/')
def test_new_ticket(self): response = self.app.get('/bugs/new/') form = response.form summary = 'test new ticket' form['summary'] = summary response = form.submit().follow() assert_true(summary in response) response = self.app.get('/bugs/') assert_true(summary in response)
md.treeprocessors['br'] = LineOrientedTreeProcessor()
md.treeprocessors['br'] = LineOrientedTreeProcessor(md)
def extendMarkdown(self, md, md_globals): md.treeprocessors['br'] = LineOrientedTreeProcessor() md.inlinePatterns['oembed'] = OEmbedPattern(r'\[embed#(.*?)\]') md.inlinePatterns['autolink_1'] = AutolinkPattern(r'(http(?:s?)://\S*)') md.inlinePatterns['artifact'] = ArtifactLinkPattern(self.core_artifact_link) if self._u...
text = markdown.etree.tostring(node).strip()
if not node.text: continue if '\n' not in node.text: continue text = self._markdown.serializer(node) text = self._markdown.postprocessors['raw_html'].run(text) text = text.strip()
def run(self, root): for node in root.getiterator('p'): text = markdown.etree.tostring(node).strip() if '\n' not in text: continue new_text = text.replace('\n', '<br/>') new_node = markdown.etree.fromstring(new_text) node.clear() node.text = new_node.text node[:] = list(new_node) return root
new_node = markdown.etree.fromstring(new_text) node.clear() node.text = new_node.text node[:] = list(new_node)
try: new_node = markdown.etree.fromstring(new_text) node.clear() node.text = new_node.text node[:] = list(new_node) except SyntaxError: log.exception('Error adding <br> tags') pass
def run(self, root): for node in root.getiterator('p'): text = markdown.etree.tostring(node).strip() if '\n' not in text: continue new_text = text.replace('\n', '<br/>') new_node = markdown.etree.fromstring(new_text) node.clear() node.text = new_node.text node[:] = list(new_node) return root
exit(1)
def resetStuff(): os.chdir(ROOT_DIR) os.environ['CFLAGS'] = BASE_CFLAGS os.environ['CPPFLAGS'] = BASE_CPPFLAGS os.environ['LDFLAGS'] = BASE_LDFLAGS os.environ['ARCHFLAGS'] = BASE_ARCHFLAGS
conf_string += '"-O -g -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc" '
conf_string += '"-O -g -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386" '
def build(): conf_string = 'env CFLAGS=' conf_string += '"-O -g -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc" ' conf_string += 'LDFLAGS=' conf_string += '"-arch i386 -arch ppc" ' conf_string += './configure --prefix=' conf_string += BUILT_DIR os.system(conf_string) os.system('make install 2> /dev...
conf_string += '"-arch i386 -arch ppc" '
conf_string += '"-arch i386" '
def build(): conf_string = 'env CFLAGS=' conf_string += '"-O -g -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc" ' conf_string += 'LDFLAGS=' conf_string += '"-arch i386 -arch ppc" ' conf_string += './configure --prefix=' conf_string += BUILT_DIR os.system(conf_string) os.system('make install 2> /dev...
self.out.append('\\footnote{') def leave_footnote(self, node): self.out.append('}')
LaTeXTranslator.visit_footnote(self, node) self.out[-1] = self.out[-1].strip('%')
def visit_footnote(self, node): self.out.append('\\footnote{')
chr_value, start_value = None, None
chr_value, start_value, chr_prefix = None, None, ''
def chrpos_to_n(lsplit): # Get chr, pos from line chr_value, start_value = None, None # Init in case of error try: split1 = lsplit[0].split(":") # Get chr:start-stop out of the 1st column. chr_value = split1[0].lower().strip() split2 = split1[1].split("-") start_value = split2[0].lower().strip() start_n = long(start_v...
chr_value = chr_value.replace("chrm", "chr0")
chr_value = chr_value.replace(chr_prefix+"m", chr_prefix+"0")
def chrpos_to_n(lsplit): # Get chr, pos from line chr_value, start_value = None, None # Init in case of error try: split1 = lsplit[0].split(":") # Get chr:start-stop out of the 1st column. chr_value = split1[0].lower().strip() split2 = split1[1].split("-") start_value = split2[0].lower().strip() start_n = long(start_v...
chr_value = chr_value.replace("chrm", "chr25") chr_n = a + int(chr_value.replace("chrx", "chr23").replace("chry", "chr24").replace("chr","")) + 1
chr_value = chr_value.replace(chr_prefix+"m", chr_prefix+"25") chr_n = a + int(chr_value.replace(chr_prefix+"x", chr_prefix+"23").replace(chr_prefix+"y", chr_prefix+"24").replace(chr_prefix,"")) + 1
def chrpos_to_n(lsplit): # Get chr, pos from line chr_value, start_value = None, None # Init in case of error try: split1 = lsplit[0].split(":") # Get chr:start-stop out of the 1st column. chr_value = split1[0].lower().strip() split2 = split1[1].split("-") start_value = split2[0].lower().strip() start_n = long(start_v...
if chrpos_value.count("chr"): chr_prefix = "chr" else: chr_prefix = "" if sequence_build == "UCSC" and chr_prefix == "chr": chrpos_value = "%s:%d" % ( line_fields[chr_column], start_int ) elif sequence_build == "UCSC" and chr_prefix != "chr": chrpos_value = "chr%s:%d" % ( line_fields[chr_column], start_int ) elif sequ...
def increment_by_one(comma_separated_coords): converted_coords_string = "" for coord in comma_separated_coords.split(","): if coord.strip() == "": continue if len(converted_coords_string) > 0: converted_coords_string += "," converted_coords_string += str(long(coord) + 1) return converted_coords_string
elif val.find(" ") != -1: val = "\"" + val + "\""
else: val = val.replace('"',"'") if val.find(" ") != -1: val = "\"" + val + "\""
def oneField(field): val = MISSING_VALUE if field in parsed: val = parsed[field] if val == None: if OPTIONS.verbose: print >> sys.stderr, 'field', field, 'is missing in', parsed['id'] elif val.find(" ") != -1: val = "\"" + val + "\"" return val
if counter % 1000000 == 0:
if counter % 1000000 == 0 and counter > 0:
def is_valid_chrpos(line): try: # Compute the line key line_key(line) return True except Exception, e: #print(str(e)) return False
line_fields.insert(3, haplotype_strand_value)
line_fields.insert(0, haplotype_strand_value)
def is_valid_chrpos(line): try: # Compute the line key line_key(line) return True except Exception, e: #print(str(e)) return False
line_fields.insert(2, haplotype_alternate_value)
line_fields.insert(0, haplotype_alternate_value)
def is_valid_chrpos(line): try: # Compute the line key line_key(line) return True except Exception, e: #print(str(e)) return False
line_fields.insert(1, haplotype_reference_value)
line_fields.insert(0, haplotype_reference_value)
def is_valid_chrpos(line): try: # Compute the line key line_key(line) return True except Exception, e: #print(str(e)) return False
while len( running_processes ) + 1 >= num_parallel_processes:
while len( running_processes ) >= num_parallel_processes:
def execute(command, stdout_filename=None): # Wait until a slot becomes open while len( running_processes ) + 1 >= num_parallel_processes: # Check if any have ended for process in running_processes: if process.poll() != None: print("Process [pid=" + str(process.pid) + "] finished with exit status: " + str(process.retu...
print("Executing: " + command)
def execute(command, stdout_filename=None): # Wait until a slot becomes open while len( running_processes ) + 1 >= num_parallel_processes: # Check if any have ended for process in running_processes: if process.poll() != None: print("Process [pid=" + str(process.pid) + "] finished with exit status: " + str(process.retu...
except e:
except Exception, e:
def read_header(file_obj): for line in file_obj: line = line[0:-1] # Remove trailing \n if line.strip() != "" and line[0] != "#": return line.split("\t") else: raise Exception, "Reached the end of the file without finding the header"
print s.recv(512).trim()
print cmd.strip(), '=>', s.recv(512).strip()
def sendCommand(cmd): s.send(cmd) print s.recv(512).trim()
print (anregexr.search(evalfile)) ratio[a] = repr(anregexr.search(evalfile).group(1)) print (a) print (ratio[a])
ratio[a] = repr(anregexr.search(evalfile).group(1)
def evalout(self): '''This produced the output that needs to go in the emails''' filename = "/humgen/gsa-firehose/firehose/firehose_output/trunk/Sample_Set/" + self.sampset +"/UnifiedGenotyper/"+ self.sampset+".filtered.eval" evalfile = open(filename, "r").read() annotations= ["all", "novel", "known", "snp_at_known_non...
sys.stderr.write("WARNING: The two files' headers are of different lengths: \nHeader1: " + str(header1) + "\nHeader2: " + str(header2) + "\nUsing header1.\n")
sys.stderr.write("WARNING: The two files' headers are not the same: \nHeader1: " + str(header1) + "\nHeader2: " + str(header2) + "\nUsing header1.\n")
def read_header(file_obj): for line in file_obj: line = line[0:-1] # Remove trailing \n if line.strip() != "" and line[0] != "#": return line.split("\t") else: raise Exception, "Reached the end of the file without finding the header"
fingerprint_file = fingerprint_base+spline[project_index]+"/"+fpref+"/"+spline[sample_index]+".fingerprint.geli"
fingerprint_path = fingerprint_base+spline[project_index]+"/"+fpref+"/" if ( spline[sample_index]+".fingerprint.geli" in os.listdir(fingerprint_path) ): fingerprint_file = fingerprint_path+spline[sample_index]+".fingerprint.geli" else: fingerprint_file = ""
def getNewestVersion(baseDir): versions = os.listdir(baseDir) versions.sort(versionCompare) for version in versions: if ( "finished.txt" in os.listdir(baseDir+version+"/") ): return version
data_files=[ (r'Microsoft.VC90.CRT', [
ms_visualc_runtime = ( r'Microsoft.VC90.CRT', [
def get_data_files(): data_files=[ (r'Microsoft.VC90.CRT', [ r'lib\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest', r'lib\Microsoft.VC90.CRT\msvcr90.dll', ]), (r'', [r'lib\avbin.dll']), ] data_files += all_files(r'data') return data_files