How to use the sqlobject.IntCol function in SQLObject

To help you get started, we’ve selected a few SQLObject examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wesnoth / wesnoth / website / stats.wesnoth.org / wesstats / model.py View on Github external
def lookup_visit(cls, visit_key):
        try:
            return cls.by_visit_key(visit_key)
        except SQLObjectNotFound:
            return None
    lookup_visit = classmethod(lookup_visit)


class VisitIdentity(SQLObject):
    """
    A Visit that is link to a User object
    """
    visit_key = StringCol(length=40, alternateID=True,
                          alternateMethodName='by_visit_key')
    user_id = IntCol()


class Group(SQLObject):
    """
    An ultra-simple group definition.
    """
    # names like "Group", "Order" and "User" are reserved words in SQL
    # so we set the name to something safe for SQL
    class sqlmeta:
        table = 'tg_group'

    group_name = UnicodeCol(length=16, alternateID=True,
                            alternateMethodName='by_group_name')
    display_name = UnicodeCol(length=255)
    created = DateTimeCol(default=datetime.now)
github stoq / stoq / stoqlib / domain / payment / methods.py View on Github external
class CardInstallmentSettings(Domain):
    """General settings for card payment method.

    B{Importante attributes}:
        - I{payment_day}: which day in the month is the credit provider going
                          to pay the store? Usually they pay in the same day
                          every month.
        - I{closing_day}: which day the credit provider stoq counting sales
                          to pay in the payment_day? Sales after this day
                          will be paid only in the next month.
    """
    # Note that payment_day and closing_day can not have a value greater
    # than 28.
    payment_day = IntCol()
    closing_day = IntCol()

    def calculate_payment_duedate(self, first_duedate):
        if first_duedate.day > self.closing_day:
            first_duedate += relativedelta(months=+1)
        return first_duedate.replace(day=self.payment_day)


#
# PaymentMethods
#


class APaymentMethod(InheritableModel):
    """Base payment method adapter class for for Check and Bill.
github mikrosimage / OpenRenderManagement / src / octopus / dispatcher / db / pulidb.py View on Github external
archived = BoolCol()
    args = UnicodeCol()

    # REZ env management support
    runnerPackages = UnicodeCol()
    watcherPackages = UnicodeCol()

    # Adding autoretry capability on task
    maxAttempt = IntCol()


class Commands(SQLObject):
    class sqlmeta:
        lazyUpdate = True
    description = UnicodeCol()
    taskId = IntCol()
    status = IntCol()
    completion = FloatCol()
    creationTime = DateTimeCol()
    startTime = DateTimeCol()
    updateTime = DateTimeCol()
    endTime = DateTimeCol()
    assignedRNId = IntCol()
    message = UnicodeCol()
    stats = UnicodeCol()
    archived = BoolCol()
    args = UnicodeCol()

    # REZ env management support
    runnerPackages = UnicodeCol()
    watcherPackages = UnicodeCol()
github shad7 / seedbox / src / seedbox / model / schema.py View on Github external
failed = sqlobject.BoolCol(default=False)
    error_msg = sqlobject.StringCol(default=None)
    invalid = sqlobject.BoolCol(default=False)
    purged = sqlobject.BoolCol(default=False)
    media_files = sqlobject.SQLMultipleJoin('MediaFile')

class MediaFile(sqlobject.SQLObject):
    """
    A class that defines a media file contained within a torrent file
    and associatd database table using SQLObjects to handle persistence.
    """

    filename = sqlobject.StringCol()
    file_ext = sqlobject.StringCol()
    file_path = sqlobject.StringCol(default=None)
    size = sqlobject.IntCol(default=0)
    compressed = sqlobject.BoolCol(default=False)
    synced = sqlobject.BoolCol(default=False)
    missing = sqlobject.BoolCol(default=False)
    skipped = sqlobject.BoolCol(default=False)
    torrent = sqlobject.ForeignKey('Torrent', cascade=True)

class AppState(sqlobject.SQLObject):
    """
    A class that defines maintains information about the state of the application
    and internal processing. Effectively it is just a key-value pair except we
    store the values by type.
    """

    name = sqlobject.StringCol(unique=True)
    val_str = sqlobject.StringCol(default=None)
    val_int = sqlobject.IntCol(default=-99999)
github stoq / stoq / stoqlib / domain / payment / base.py View on Github external
statuses = {STATUS_PREVIEW: _(u"Preview"),
                STATUS_OPEN: _(u"Open"),
                STATUS_CLOSED: _(u"Closed"),
                STATUS_CANCELLED: _(u"Cancelled")}

    implements(IPaymentGroup, IContainer)

    status = IntCol(default=STATUS_OPEN)
    open_date = DateTimeCol(default=datetime.now)
    close_date = DateTimeCol(default=None)
    cancel_date = DateTimeCol(default=None)
    default_method = IntCol(default=METHOD_MONEY)
    installments_number = IntCol(default=1)
    interval_type = IntCol(default=None)
    intervals = IntCol(default=None)

    def _create_till_entry(self, value, description, till):
        from stoqlib.domain.till import TillEntry
        conn = self.get_connection()
        return TillEntry(connection=conn,
                         description=description, value=value, till=till,
                         payment_group=self)

    #
    # IPaymentGroup implementation
    #

    #
    # FIXME: We should to remove all these methods without implementation, so
    # we can ensure that interface are properly implemented in subclasses.
    #
github cjones / madcow / contrib / migrate_madcow_1to2.py View on Github external
clean = sqlobject.StringCol()
        author = sqlobject.ForeignKey('Author')
        channel = sqlobject.ForeignKey('Channel')
        citations = sqlobject.IntCol(default=0)
        posted = sqlobject.DateTimeCol(default = datetime.now)
        comments = sqlobject.MultipleJoin('Comments')


    class Author(sqlobject.SQLObject):

        name = sqlobject.StringCol(alternateID=True, length=50)
        urls = sqlobject.MultipleJoin('URL')
        comments = sqlobject.MultipleJoin('Comments')
        points_new = sqlobject.IntCol(default=0)
        points_old = sqlobject.IntCol(default=0)
        points_credit = sqlobject.IntCol(default=0)


    class Channel(sqlobject.SQLObject):

        name = sqlobject.StringCol(alternateID=True, length=50)
        urls = sqlobject.MultipleJoin('URL')


    class Comments(sqlobject.SQLObject):

        text = sqlobject.StringCol()
        author = sqlobject.ForeignKey('Author')
        url = sqlobject.ForeignKey('URL')

    engine = config.get('memebot', 'db_engine')
    uri = engine + '://'
github stoq / stoq / stoqlib / domain / payment / methods.py View on Github external
class CardInstallmentSettings(Domain):
    """General settings for card payment method.

    B{Importante attributes}:
        - I{payment_day}: which day in the month is the credit provider going
                          to pay the store? Usually they pay in the same day
                          every month.
        - I{closing_day}: which day the credit provider stoq counting sales
                          to pay in the payment_day? Sales after this day
                          will be paid only in the next month.
    """
    # Note that payment_day and closing_day can not have a value greater
    # than 28.
    payment_day = IntCol()
    closing_day = IntCol()

    def calculate_payment_duedate(self, first_duedate):
        if first_duedate.day > self.closing_day:
            first_duedate += relativedelta(months=+1)
        return first_duedate.replace(day=self.payment_day)


#
# PaymentMethods
#


class APaymentMethod(InheritableModel):
    """Base payment method adapter class for for Check and Bill.

    B{Importante attributes}:
github stoq / stoq / stoq / domain / receiving.py View on Github external
#
    # Accessors
    #

    def get_total(self):
        return self.quantity_received * self.cost


class ReceivingOrder(Domain):
    """Receiving order definition."""

    (STATUS_PENDING,
     STATUS_CLOSED) = range(2)
        
    status = IntCol(default=STATUS_PENDING)
    receival_date = DateTimeCol(default=datetime.datetime.now)
    confirm_date = DateTimeCol(default=None)
    invoice_number = StringCol(default='')
    invoice_total = PriceCol(default=0.0)
    notes = StringCol(default='')
    freight_total = PriceCol(default=0.0)
    charge_value = FloatCol(default=0.0)
    discount_value = FloatCol(default=0.0)

    # This is Brazil-specific information
    icms_total = PriceCol(default=0.0)
    ipi_total = PriceCol(default=0.0)

    responsible = ForeignKey('PersonAdaptToUser')
    supplier = ForeignKey('PersonAdaptToSupplier')
    branch = ForeignKey('PersonAdaptToBranch')