Package coprs :: Module filters
[hide private]
[frames] | no frames]

Source Code for Module coprs.filters

 1  import time 
 2   
 3  from coprs import app 
 4  from coprs import helpers 
5 6 @app.template_filter('date_from_secs') 7 -def date_from_secs(secs):
8 return time.strftime('%m-%d-%y %H:%M:%S', time.gmtime(secs)) if secs else None
9
10 @app.template_filter('perm_type_from_num') 11 -def perm_type_from_num(num):
12 return helpers.PermissionEnum(num)
13
14 # this should probably be stored in DB with the whole mock_chroot... 15 @app.template_filter('os_name_short') 16 -def os_name_short(os_name, os_version):
17 # TODO: make it models.MockChroot method or not? 18 if os_version: 19 if os_version == 'rawhide': 20 return os_version 21 if os_name == 'fedora': 22 return 'fc.{0}'.format(os_version) 23 elif os_name == 'epel': 24 return 'el{0}'.format(os_version) 25 return os_name
26