当前位置: 首页>>代码示例>>Python>>正文


Python DateTime.today方法代码示例

本文整理汇总了Python中mx.DateTime.today方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.today方法的具体用法?Python DateTime.today怎么用?Python DateTime.today使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mx.DateTime的用法示例。


在下文中一共展示了DateTime.today方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Ymd

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
def Ymd(date=None):
    if date is None:
        return DateTime.today()
    elif type(date) in (str, unicode):
        return DateTime.strptime(date, '%Y-%m-%d')
    elif type(date) in (type(DateTime.today()), datetime.datetime):
        return date.strftime('%Y-%m-%d')
开发者ID:watcharapon,项目名称:exercises,代码行数:9,代码来源:wizard_obj1.py

示例2: test_list_permission

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
    def test_list_permission(self):
        """Testing permission listing."""
        person_id = self.db_tools.create_person(self.person_ds().next())
        account_id = self.db_tools.create_account(self.account_ds().next())
        ou_id = self.db_tools.create_ou(
            {'name': 'ephorte-test',
             'acronym': 'ET',
             'short_name': 'ePhorte-test',
             'display_name': 'Test OU for ePhorte'})

        self.assertFalse(self._ep.list_permission(),
                         'Listed permission, should be none')

        self._ep.add_permission(
            person_id, self._co.ephorte_perm_ar,
            ou_id, account_id)
        self._ep.add_permission(
            person_id, self._co.ephorte_perm_ua,
            ou_id, account_id)

        self.assertEqual(
            self._ep.list_permission(person_id),
            [(person_id, self._co.ephorte_perm_ar, ou_id,
              account_id, DateTime.today(), None),
             (person_id, self._co.ephorte_perm_ua, ou_id,
              account_id, DateTime.today(), None)],
            'Failed listing added roles for person')
        self.assertEqual(len(self._ep.list_permission()), 2,
                         'Number of permissions listed not equal')
开发者ID:unioslo,项目名称:cerebrum,代码行数:31,代码来源:test_ePhorte.py

示例3: set_quaran

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
def set_quaran(cer_ou_tab):
    """Set quarantine on OUs that are no longer in the data source.

    All the OUs that were in Cerebrum before an import is run are compared
    with the data files. Those OUs that are no longer present in the data
    source are marked as invalid.

    FIXME: How does it work with multiple data sources?

    :Parameters:
      cer_ou_tab : dictionary
        ou_id -> sko (basestring) mapping, containing the OUs that should be
        removed from Cerebrum (i.e. the OUs that are in Cerebrum, but not in
        the data source).
    """
    ous = OU_class(db)
    today = DateTime.today()
    acc = Factory.get("Account")(db)
    acc.find_by_name(cereconf.INITIAL_ACCOUNTNAME)
    for k in cer_ou_tab.keys():
        ous.clear()
        ous.find(k)
        if (ous.get_entity_quarantine(qtype=co.quarantine_ou_notvalid) == []):
            ous.add_entity_quarantine(co.quarantine_ou_notvalid,
                                      acc.entity_id,
                                      description='import_OU',
                                      start=today)
    db.commit()
开发者ID:unioslo,项目名称:cerebrum,代码行数:30,代码来源:import_OU.py

示例4: get_date

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
 def get_date(self, payment, line):
     """Return the right OPAE Line date"""
     if not line :
         return unicode(DateTime.today().strftime("%y%m%d"))
     to_return = DateTime.today()
     if payment.date_prefered == 'due' and line.ml_maturity_date :
         to_return = DateTime.strptime(line.ml_maturity_date, '%Y-%m-%d')
     if  payment.date_prefered == 'fixed' and payment.date_planned :
         to_return = DateTime.strptime(payment.date_planned, '%Y-%M-%d')
     if to_return < DateTime.today():
            raise wizard.except_wizard(
                                        _('Error'),
                                        _('Payment date must be at least today\n \
                                           Today used instead.')
                                       )
     return unicode(to_return.strftime("%y%m%d"))
开发者ID:MarkNorgate,项目名称:addons-EAD,代码行数:18,代码来源:opae_wizard.py

示例5: setTime

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
	def setTime(self, target, from_or_till):
		today = DateTime.today()
		col = self._template.getColumn((target, from_or_till))
		row = self.getRowForDate(today)
		now = DateTime.now()
		value = now.abstime / 60 / 60 / 24
		print "+ %s %s: Setting time at (%s, %s) to %s" % (from_or_till, target, row, col, now)
		self._xlSheet.setCell(row, col, value)
开发者ID:HarmonyEnterpriseSolutions,项目名称:toolib,代码行数:10,代码来源:businesstime.py

示例6: __init__

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
    def __init__(self, db, const, id=None):
        self._db = db
        self.co = const

        midnight = DateTime.today()
        now = DateTime.now()
        # if we are past 22:00 this day, schedule for tomorrow evening
        if (now - midnight) > DateTime.TimeDeltaFrom(hours=22):
            self.batch_time = midnight + DateTime.TimeDeltaFrom(days=1,
                                                                hours=22)
        # ... otherwise, schedule for this day
        else:
            self.batch_time = midnight + DateTime.TimeDeltaFrom(hours=22)

        self.now = now

        # "None" means _no_ conflicts, there can even be several of
        # that op pending.  All other ops implicitly conflict with
        # themselves, so there can only be one of each op.
        self.conflicts = {
            int(const.bofh_move_user): [const.bofh_move_student,
                                        const.bofh_move_user_now,
                                        const.bofh_move_request,
                                        const.bofh_delete_user],
            int(const.bofh_move_student): [const.bofh_move_user,
                                           const.bofh_move_user_now,
                                           const.bofh_move_request,
                                           const.bofh_delete_user],
            int(const.bofh_move_user_now): [const.bofh_move_student,
                                            const.bofh_move_user,
                                            const.bofh_move_request,
                                            const.bofh_delete_user],
            int(const.bofh_move_request): [const.bofh_move_user,
                                           const.bofh_move_user_now,
                                           const.bofh_move_student,
                                           const.bofh_delete_user],
            int(const.bofh_move_give): None,
            int(const.bofh_archive_user): [const.bofh_move_user,
                                           const.bofh_move_user_now,
                                           const.bofh_move_student,
                                           const.bofh_delete_user],
            int(const.bofh_delete_user): [const.bofh_move_user,
                                          const.bofh_move_user_now,
                                          const.bofh_move_student,
                                          const.bofh_email_create],
            int(const.bofh_email_create): [const.bofh_email_delete,
                                           const.bofh_delete_user],
            int(const.bofh_email_delete): [const.bofh_email_create],
            int(const.bofh_email_convert): [const.bofh_email_delete],
            int(const.bofh_sympa_create): [const.bofh_sympa_remove],
            int(const.bofh_sympa_remove): [const.bofh_sympa_create],
            int(const.bofh_quarantine_refresh): None,
            int(const.bofh_email_restore): [const.bofh_email_create],
            int(const.bofh_homedir_restore): [const.bofh_move_user,
                                              const.bofh_move_user_now,
                                              const.bofh_move_student,
                                              const.bofh_delete_user]
            }
开发者ID:unioslo,项目名称:cerebrum,代码行数:60,代码来源:utils.py

示例7: test_expire_permission

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
    def test_expire_permission(self):
        """Testing if expired test works."""
        person_id = self.db_tools.create_person(self.person_ds().next())
        account_id = self.db_tools.create_account(self.account_ds().next())
        ou_id = self.db_tools.create_ou(
            {'name': 'ephorte-test',
             'acronym': 'ET',
             'short_name': 'ePhorte-test',
             'display_name': 'Test OU for ePhorte'})

        self._ep.add_permission(
            person_id, self._co.ephorte_perm_ar,
            ou_id, account_id)
        self._ep.expire_permission(person_id, self._co.ephorte_perm_ar, ou_id)
        self.assertFalse(
            self._ep.list_permission(person_id,
                                     self._co.ephorte_perm_ar,
                                     ou_id,
                                     filter_expired=True),
            'Permission could not be expired w/o date')
        self._ep.expire_permission(person_id,
                                   self._co.ephorte_perm_ar,
                                   ou_id,
                                   DateTime.today() - 1)
        self.assertFalse(
            self._ep.list_permission(person_id,
                                     self._co.ephorte_perm_ar,
                                     ou_id,
                                     filter_expired=True),
            'Permission could not be expired with date')

        self._ep.expire_permission(person_id,
                                   self._co.ephorte_perm_ar,
                                   ou_id,
                                   DateTime.today() + 1)
        self.assertTrue(
            self._ep.list_permission(person_id,
                                     self._co.ephorte_perm_ar,
                                     ou_id,
                                     filter_expired=True),
            'Permission could not be expired with date in fututre')
开发者ID:unioslo,项目名称:cerebrum,代码行数:43,代码来源:test_ePhorte.py

示例8: __init__

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
 def __init__(self, TASK=None, CATEGORY1=None, STARTDATE=None, CATEGORY3=None, CATEGORY2=None, CATEGORY5=None, CATEGORY4=None, CATEGORY7=None, CATEGORY6=None, CATEGORY9=None, CATEGORY8=None, NUMPERSON=None, PERSON2=None, PERSON3=None, COST=None, EXTERNALID=None, DEPENDS9=None, PERSON4=None, PERSON5=None, DUEDATESTRING=None, ICONINDEX=None, CREATIONDATESTRING=None, PERSON9=None, WEBCOLOR=None, PERSON8=None, LASTMOD=None, TIMEESTUNITS=None, COLOR=None, TITLE=None, LASTMODSTRING=None, PRIORITYWEBCOLOR=None, POS=None, ID=None, PRIORITY=None, CALCTIMESPENT=None, DEPENDS=None, NUMCATEGORY=None, DONEDATESTRING=None, CREATIONDATE=None, PERCENTDONE=None, TIMEESTIMATE=None, STATUS=None, DEPENDS7=None, ALLOCATEDBY=None, DONEDATE=None, RISK=None, STARTDATESTRING=None, TEXTCOLOR=None, NUMDEPENDS=None, CALCPERCENTDONE=None, FLAG=None, VERSION=None, TIMESPENT=None, TEXTWEBCOLOR=None, PRIORITYCOLOR=None, FILEREFPATH=None, DUEDATE=None, CALCTIMEESTIMATE=None, CATEGORY=None, DEPENDS6=None, DEPENDS5=None, DEPENDS4=None, DEPENDS3=None, DEPENDS2=None, DEPENDS1=None, CUSTOMCOMMENTS=None, TIMESPENTUNITS=None, COMMENTS=None, DEPENDS8=None, PERSON=None, PERSON1=None, CALCCOST=None, PERSON6=None, COMMENTSTYPE=None, PERSON7=None, valueOf_=''):
     supermod.TASK.__init__(self, CATEGORY1, STARTDATE, CATEGORY3, CATEGORY2, CATEGORY5, CATEGORY4, CATEGORY7, CATEGORY6, CATEGORY9, CATEGORY8, NUMPERSON, PERSON2, PERSON3, COST, EXTERNALID, DEPENDS9, PERSON4, PERSON5, DUEDATESTRING, ICONINDEX, CREATIONDATESTRING, PERSON9, WEBCOLOR, PERSON8, LASTMOD, TIMEESTUNITS, COLOR, TITLE, LASTMODSTRING, PRIORITYWEBCOLOR, POS, ID, PRIORITY, CALCTIMESPENT, DEPENDS, NUMCATEGORY, DONEDATESTRING, CREATIONDATE, PERCENTDONE, TIMEESTIMATE, STATUS, DEPENDS7, ALLOCATEDBY, DONEDATE, RISK, STARTDATESTRING, TEXTCOLOR, NUMDEPENDS, CALCPERCENTDONE, FLAG, VERSION, TIMESPENT, TEXTWEBCOLOR, PRIORITYCOLOR, FILEREFPATH, DUEDATE, CALCTIMEESTIMATE, CATEGORY, DEPENDS6, DEPENDS5, DEPENDS4, DEPENDS3, DEPENDS2, DEPENDS1, CUSTOMCOMMENTS, TIMESPENTUNITS, COMMENTS, DEPENDS8, PERSON, PERSON1, CALCCOST, PERSON6, COMMENTSTYPE, PERSON7, valueOf_)
     if TASK is None:
         self.TASK = []
     else:
         self.TASK = TASK
     if PRIORITYCOLOR is None or PRIORITYWEBCOLOR is None:
         self.PRIORITYCOLOR = "15732480"
         self.PRIORITYWEBCOLOR = "#000FF0"
     else:
         self.PRIORITYCOLOR = PRIORITYCOLOR
         self.PRIORITYWEBCOLOR = PRIORITYWEBCOLOR
     if COST is None:
         self.COST = '0.00000000'
     else:
         self.COST = COST
     if CREATIONDATE is None or CREATIONDATESTRING is None:
         td = DateTime.today()
         self.CREATIONDATE = td.COMDate()
         self.CREATIONDATESTRING = td.strftime('%m/%d/%Y')
     else:
         self.CREATIONDATE = CREATIONDATE
         self.CREATIONDATESTRING = CREATIONDATESTRING
     if CALCCOST is None:
         self.CALCCOST = '0.00000000'
     else:
         self.CALCCOST = CALCCOST
     if ICONINDEX is None:
         self.ICONINDEX = -1
     else:
         self.ICONINDEX = ICONINDEX
     if PERCENTDONE is None:
         self.PERCENTDONE = 0
     else:
         self.PERCENTDONE = PERCENTDONE
     if PRIORITY is None:
         self.PRIORITY = 5
     else:
         self.PRIORITY = PRIORITY
     if RISK is None:
         self.RISK = 0
     else:
         self.RISK = RISK
     if STARTDATE is None or sTARTDATESTRING is None:
         self.STARTDATE = self.CREATIONDATE
         self.STARTDATESTRING = self.CREATIONDATESTRING
     else:
         self.STARTDATE = STARTDATE
         self.STARTDATESTRING = STARTDATESTRING
开发者ID:sdo1928,项目名称:pytdl,代码行数:51,代码来源:todolist_sub.py

示例9: thread_sendDataFunction

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
def thread_sendDataFunction():
        global gotDataException,sentSimulatedData
        print 'thead_sendDataFunction started'
        while 1:
                lastTime=time.time()
                lt=time.localtime()

                # NASDAQ open?
                x=lt[3]*100+lt[4]

                if DateTime.today().day_of_week>=5 or x<930 or x>1600 or gotDataException>3 or alwaysSimulate:
                        sleepTime=NASDAQ_MINSWEEPTIME
                        sendSimulatedData()
                else:
                        sleepTime=NASDAQ_MINSWEEPTIME/2
                        sendAllChangedTickerData()
                        
                if (time.time()-lastTime)<sleepTime:
                        time.sleep(max(sleepTime-time.time()+lastTime,1))
开发者ID:kragen,项目名称:mod_pubsub,代码行数:21,代码来源:nasdaq.py

示例10: release_guest

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
    def release_guest(self, guest, operator_id):
        """Release a guest account from temporary owner.

        Make sure that the guest account specified actually exists and
        release it from owner. The guest account is now in
        release_quarantine and will be available for new allocations
        when the quarantine period is due.

        @param guest: uname of guest account
        @type guest: str

        @param operator_id: entity id of operator
        @type operator_id: int
        """
        ac = Factory.get('Account')(self.db)
        ac.find_by_name(guest)
        trait = ac.get_trait(self.co.trait_uio_guest_owner)
        if trait is None:
            raise GuestAccountException("%s is not a guest" % guest)
        elif trait['target_id'] is None:
            raise GuestAccountException("%s is already available" % guest)
        # Remove owner, i.e set owner_trait to None
        ac.populate_trait(self.co.trait_uio_guest_owner, target_id=None)
        self.logger.debug("Removed owner_id in owner_trait for %s" % guest)
        # Remove quarantine set by _alloc_guest and set a new
        # quarantine that kicks in now.
        if ac.get_entity_quarantine(self.co.quarantine_guest_release):
            ac.delete_entity_quarantine(self.co.quarantine_guest_release)
        ac.add_entity_quarantine(self.co.quarantine_guest_release, operator_id,
                                 "Guest user released", start=DateTime.today())
        self.logger.debug("%s is now in release_quarantine" % guest)
        ac.set_password(ac.make_passwd(guest))
        ac.write_db()
        self.update_group_memberships(ac.entity_id)
        self.logger.debug("Updating group memberships for %s" % guest)
        # Finally, register a request to archive the home directory.
        # A new directory will be created when archival has been done.
        br = BofhdRequests(self.db, self.co)
        br.add_request(operator_id, br.now,
                       self.co.bofh_archive_user, ac.entity_id, None,
                       state_data=int(self.co.spread_uio_nis_user))
        self.logger.debug("Added archive_user request for %s" % guest)
开发者ID:unioslo,项目名称:cerebrum,代码行数:44,代码来源:bofhd_guestaccounts_utils.py

示例11: generate_revisi_target_realisasi_bulanan

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]

#.........这里部分代码省略.........
            if target_obj.target_type_id in ('tambahan'):
                       color=5
            if target_obj.target_type_id in ('perilaku'):
                       color=6
            task.update({
                           'project_id':target_obj.id,
                           'user_id':user_id,
                           'company_id':company_id,
                           'description':description,
                           'name': target_obj.name,
                           'code': target_obj.code,
                           'target_category': target_category,
                           'sequnce': target_obj.priority,
                           'target_type_id':target_obj.target_type_id,
                           'target_period_year': target_obj.target_period_year,
                           'target_jumlah_kuantitas_output'     : target_obj.target_jumlah_kuantitas_output,
                            'target_satuan_kuantitas_output'     : target_obj.target_satuan_kuantitas_output.id or None,
                            'target_angka_kredit'     : target_obj.target_angka_kredit,
                            'target_kualitas'     : target_obj.target_kualitas,
                            'target_waktu'     : target_obj.target_waktu,
                            'target_satuan_waktu'     : 'hari',
                            'target_biaya'     : target_obj.target_biaya,
                            'target_lainlain'     : target_obj.target_lainlain,
                            'user_id_atasan': user_id_atasan or False,
                            'user_id_banding':user_id_banding or False,
                            'user_id_bkd':user_id_bkd or False,
                            'priority':'2',
                            'notes':'-',
                            'currency_id':currency_id,
                            'task_category':'skp',
                           })
            #Update Task Target Bulanan
            old_kualitas,old_biaya,old_ak = self.get_total_target_aspect_task(cr,uid,task_exist_ids,context=None)
            now=DateTime.today();
            part_jumlah_kuantitas_output=0
            part_angka_kredit=0
            part_biaya=0
            kuantitas=target_obj.target_jumlah_kuantitas_output - old_kualitas
            ang_kredit=target_obj.target_angka_kredit - old_ak
            biaya=target_obj.target_biaya - old_biaya
            part_lama_kegiatan = lama_kegiatan - len(task_exist_ids)
            x_kuantitas=kuantitas/part_lama_kegiatan
            y_kuantitas =kuantitas%part_lama_kegiatan
            x_kredit=ang_kredit/part_lama_kegiatan
            y_kredit =ang_kredit%part_lama_kegiatan
            x_biaya=biaya/part_lama_kegiatan
            y_biaya =biaya%part_lama_kegiatan
            first_task_id=None
            sum_of_balance_biaya=0
            if target_obj.date_start :
                curr_date = DateTime.strptime(target_obj.date_start,'%Y-%m-%d')
            else :
                january=DateTime.Date(now.year,1,1)
                curr_date =  DateTime.strptime(january.strftime('%Y-%m-%d'),'%Y-%m-%d')
            first_date =curr_date
            #print "THIS IS A DATE ",curr_date
            for i in range(0,lama_kegiatan):
                next_date = curr_date + DateTime.RelativeDateTime(months=i)
                target_period_month=next_date.strftime('%m')
                if self.is_exist_task_in_month(cr,uid,task_exist_ids,target_period_month,target_obj.target_period_year,context=None):
                    #print "Break In Month %s %s",target_period_month,target_obj.target_period_year,
                    continue;
                
                #Jumlah Kuantitas Output
                if kuantitas >0 :
                    if i < y_kuantitas :
开发者ID:darfat,项目名称:skp-jabar,代码行数:70,代码来源:project.py

示例12: _default_date

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
def _default_date(*args):
    res = mdt.today() + mdt.oneDay
    return res.strftime('%Y-%m-%d 09:00:00')
开发者ID:kevin-garnett,项目名称:openerp-from-oneyoung,代码行数:5,代码来源:alerts.py

示例13: generate_task_realisasi_bulanan

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
    def generate_task_realisasi_bulanan(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        task =  {}
        
        task_pool = self.pool.get('project.task')
        stage_pool = self.pool.get('project.task.type')
        for task_generate in self.browse(cr, uid, ids, context=context):
            #check Duplicate
            #Init Field
            target_category='bulanan'
            description=''
            lama_kegiatan=task_generate.lama_kegiatan
            user_id = task_generate.user_id.id
            target_period_year = task_generate.target_period_year
            target_period_month='xx'
            date_start='xx'
            date_end='xx'
            company_id=None
            currency_id=None
            user_id_bkd=None
            employee = self.get_employee_from_user_id( cr, uid, task_generate);
            if user_id!=uid:
              raise osv.except_osv(_('Invalid Action!'),
                                             _('Anda Tidak Memiliki Priviledge Untuk Proses Ini.'))
            if not employee :
                raise osv.except_osv(_('Invalid Action, Data Pegawai Tidak Lengkap'),
                                _('Proses Tidak Dapat Dilanjutkan Karena Ada Beberapa Informasi Kepegawaian Belum Diisi, Khususnya Data Pejabat Penilai Dan Atasan Banding.'))
            else :
                company = employee.company_id
                company_id = company.id
                currency_id= employee.company_id.currency_id
                
                #print "company_id : ",company_id,' - ',currency_id
                
                if not company_id :
                    raise osv.except_osv(_('Invalid Action, Data Pegawai Tidak Lengkap'),
                                _('Proses Tidak Dapat Dilanjutkan Karena Unit Dinas Pegawai Belum Dilengkapi.'))
                #print "employee parent : ",employee.parent_id
                if not task_generate.user_id_bkd:
                    if not company.user_id_bkd :
                        raise osv.except_osv(_('Invalid Action, Data Dinas Kurang Lengkap'),
                                    _('Staff Pemeriksa Dari BKD Tidak Tersedia Untuk Unit Anda, Silahkan hubungi Admin Atau isi Data Pemeriksa.'))
                    else :
                        user_id_bkd = company.user_id_bkd.id
                else :
                    user_id_bkd=task_generate.user_id_bkd.id 
                if not employee.user_id_atasan :
                    raise osv.except_osv(_('Invalid Action, Data Pegawai Tidak Lengkap'),
                                _('Proses Tidak Dapat Dilanjutkan Karena Data Pejabat Penilai Belum Terisi.'))
                if not employee.user_id_banding :
                    raise osv.except_osv(_('Invalid Action, Data Pegawai Tidak Lengkap'),
                                _('Proses Tidak Dapat Dilanjutkan Karena Data Pejabat Pengajuan Banding.'))
            
            user_id_atasan =task_generate.user_id_atasan.id
            user_id_banding=task_generate.user_id_banding.id 
            
            if not task_generate.user_id_atasan.id :
                user_id_atasan = employee.user_id_atasan.user_id.id
            if not task_generate.user_id_banding.id :
                user_id_banding = employee.user_id_banding.user_id.id
            
            task.update({
                           'project_id':None,
                           'user_id':user_id,
                           'company_id':company_id,
                           'description':description,
                           'name': task_generate.name,
                           'code': None,
                           'target_category': target_category,
                           #'sequence': target_obj.priority,
                           'target_type_id':task_generate.target_type_id,
                           'target_period_year': target_period_year,
                            'user_id_atasan': user_id_atasan or False,
                            'user_id_banding':user_id_banding or False,
                            'user_id_bkd':user_id_bkd or False,
                            'priority':'2',
                            'currency_id':currency_id,
                             'target_waktu' : 0,
                            'target_kualitas' : 0,
                            'target_jumlah_kuantitas_output' : 0,
                             'task_category':'non_skp',
                           })
            #Update Task Target Bulanan
            now=DateTime.today();
            first_task_id=None
            
            if task_generate.date_start :
                curr_date = DateTime.strptime(task_generate.date_start,'%Y-%m-%d')
            else :
                january=DateTime.Date(now.year,1,1)
                curr_date =  DateTime.strptime(january.strftime('%Y-%m-%d'),'%Y-%m-%d')
            first_date =curr_date
            #print "THIS IS A DATE ",curr_date
            for i in range(0,lama_kegiatan):
                
                next_date = curr_date + DateTime.RelativeDateTime(months=i)
                target_period_month=next_date.strftime('%m')
                task.update({
                           'target_period_month':target_period_month,
#.........这里部分代码省略.........
开发者ID:darfat,项目名称:skp-jabar,代码行数:103,代码来源:project_task_generate.py

示例14: SetYearDefault

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
# ------------------------------------------------------------------------------

import wx
import wx.lib.masked as masked
import wx.calendar
from mx import DateTime

from awc.controls import evt_DATECHANGED, EVT_DATECHANGED
from awc.controls import evt_DATEFOCUSLOST, EVT_DATEFOCUSLOST

import awc.controls.windows as aw
import awc.controls.mixin as cmix
import awc.util as awu


YEAR_DEFAULT = DateTime.today().year
def SetYearDefault(yd):
    global YEAR_DEFAULT
    YEAR_DEFAULT = yd


class DateChangedEvent(wx.PyCommandEvent):
    def __init__(self, *args, **kwargs):
        wx.PyCommandEvent.__init__(self, *args, **kwargs)
        self._date = None
    def SetValue(self, date):
        self._date = date
    def GetValue(self):
        return self._date

class DateFocusLostEvent(wx.PyCommandEvent):
开发者ID:alexsandrino,项目名称:X4GA,代码行数:33,代码来源:datectrl.py

示例15: pquota_info

# 需要导入模块: from mx import DateTime [as 别名]
# 或者: from mx.DateTime import today [as 别名]
    def pquota_info(self, operator, person):
        person_id = self.bu.find_person(person)
        try:
            ppq_info = self.bu.get_pquota_status(person_id)
        except errors.UserHasNoQuota as e:
            return "%s: %s" % (person, e)
        has_quota = ppq_info['has_quota']
        has_blocked_quota = ppq_info['has_blocked_quota']
        import math
        paid_quota = int(math.floor(1/printer_quota.PAGE_COST *
                                    float(ppq_info['kroner'])))
        total_available_quota = (paid_quota + ppq_info['free_quota'] +
                                 ppq_info['accum_quota'])
        if has_quota == 'T':
            if has_blocked_quota == 'T':
                try:
                    bdate, pnum = self.bu.get_bdate_and_pnum(person_id)
                except errors.NotFoundError:
                    # TBD: Can this happen?
                    return person + ": Quota has been blocked, person not in FS"
                try:
                    fs = database.connect(user=cereconf.FS_USER,
                                          service=cereconf.FS_DATABASE_NAME,
                                          DB_driver=cereconf.DB_DRIVER_ORACLE)
                except database.DatabaseError as e:
                    self.logger.warn("Can't connect to FS (%s)" % e)
                    raise CerebrumError("Can't connect to FS, try later")

                # Estimate when Cerebrum was updated from FS last.  We
                # assume it happens every morning at 07:00.
                #
                # We make some effort to get daylight saving and
                # timezone right since DCOracle2.Timestamp doesn't.
                this_morning = DateTime.now()
                if this_morning.hour < 7:
                    this_morning = DateTime.today() + DateTime.RelativeDateTime(hour=7)
                reason = ["%s: Printer quota has been blocked due to:" % person]

                from Cerebrum.modules.no.access_FS import Student
                student = Student(fs)
                reg = student.get_semreg(bdate, pnum)
                if not reg:
                    reason.append(' * Semester fee has not been paid, and '
                                  'semester registration is missing')
                elif reg[0]['regformkode'] == 'KUNBETALT':
                    reason.append(' * Semester fee is paid, but semester '
                                  'registration is missing')
                elif reg[0]['dato_regform_endret'] > this_morning:
                    reason.append(' * Semester registration was done today, '
                                  'please wait for nightly update')

                from Cerebrum.modules.no.uio.access_FS import UiOBetaling
                bet = UiOBetaling(fs)
                if not bet.list_kopiavgift_data(kun_fritak=False, fodselsdato=bdate, personnr=pnum):
                    reason.append(" * Copy fee has not been paid")
                if len(reason) == 1:
                    reason.append(" * Please wait for nightly update")
                return "\n".join(reason)
            if total_available_quota == 0:
                return "%s: No prints available" % person
            elif total_available_quota < 0:
                return ("%s: No prints available, overdraft is %d prints" %
                        (person, abs(total_available_quota)))
            return "%s: %d prints available" % (person, total_available_quota)
        else:
            return "%s: Printer quota is unlimited" % person
开发者ID:unioslo,项目名称:cerebrum,代码行数:68,代码来源:bofhd_pq_cmds.py


注:本文中的mx.DateTime.today方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。