Did I find the right examples for you? yes no

All Samples(46)  |  Call(46)  |  Derive(0)  |  Import(0)

src/d/j/django-lfs-HEAD/lfs/customer/utils.py   django-lfs(Download)
def _get_customer(request):
    user = request.user
    if user.is_authenticated():
        try:
            return Customer.objects.get(user=user)
        session_key = request.session.session_key
        try:
            return Customer.objects.get(session=session_key)
        except ObjectDoesNotExist:
            return None
    """
    try:
        session_customer = Customer.objects.get(session=request.session.session_key)
        try:
            user_customer = Customer.objects.get(user=request.user)

src/d/j/django-lfs-0.7.7/lfs/customer/utils.py   django-lfs(Download)
def _get_customer(request):
    user = request.user
    if user.is_authenticated():
        try:
            return Customer.objects.get(user=user)
        session_key = request.session.session_key
        try:
            return Customer.objects.get(session=session_key)
        except ObjectDoesNotExist:
            return None
    """
    try:
        session_customer = Customer.objects.get(session=request.session.session_key)
        try:
            user_customer = Customer.objects.get(user=request.user)

src/l/f/lfs-HEAD/customer/utils.py   lfs(Download)
    if user.is_authenticated():
        try:
            return Customer.objects.get(user = user)
        except ObjectDoesNotExist:
            return None
    else:
        try:
            return Customer.objects.get(session = session_key)
    """
    try:
        session_customer = Customer.objects.get(session = request.session.session_key)
        try:
            user_customer = Customer.objects.get(user = request.user)

src/d/j/django-lfs-0.7.7/lfs/manage/views/carts.py   django-lfs(Download)
        try:
            if cart.user:
                customer = Customer.objects.get(user=cart.user)
            else:
                customer = Customer.objects.get(session=cart.session)
    try:
        if cart.user:
            customer = Customer.objects.get(user=cart.user)
        else:
            customer = Customer.objects.get(session=cart.session)

src/d/j/django-lfs-HEAD/lfs/manage/views/carts.py   django-lfs(Download)
        try:
            if cart.user:
                customer = Customer.objects.get(user=cart.user)
            else:
                customer = Customer.objects.get(session=cart.session)
    try:
        if cart.user:
            customer = Customer.objects.get(user=cart.user)
        else:
            customer = Customer.objects.get(session=cart.session)

src/d/j/django-lfs-HEAD/lfs/core/management/commands/lfs_migrate.py   django-lfs(Download)
            try:
                # 1st try to get customer by the stored customer_id in addresses
                customer = Customer.objects.get(pk=address["customer_id"])
            except Customer.DoesNotExist:
                # If there is no customer_id we try the other way around.
                    continue
                else:
                    customer = Customer.objects.get(pk=customer_id)
 
            # Create new address out of old
            if order["user_id"]:
                try:
                    customer = Customer.objects.get(user=order["user_id"])
                except Customer.DoesNotExist:
                    continue

src/l/f/lfs-HEAD/manage/views/carts.py   lfs(Download)
        try:
            if cart.user:
                customer = Customer.objects.get(user=cart.user)
            else:
                customer = Customer.objects.get(session=cart.session)
    try:
        if cart.user:
            customer = Customer.objects.get(user=cart.user)
        else:
            customer = Customer.objects.get(session=cart.session)

src/d/j/django-lfs-HEAD/lfs/checkout/tests/test_addresses.py   django-lfs(Download)
 
        # get our new customer
        our_customer = Customer.objects.get(user__email="test@test.com")
        self.assertNotEqual(our_customer, None)
        # four new addresses should be created for our_customer
 
        # refetch our customer
        our_customer = Customer.objects.get(user__email="test@test.com")
        self.assertNotEqual(our_customer.selected_invoice_address, None)
        self.assertNotEqual(our_customer.selected_shipping_address, None)
 
        # refetch our customer
        our_customer = Customer.objects.get(user__email="test@test.com")
        self.assertNotEqual(our_customer.selected_invoice_address, None)
        self.assertNotEqual(our_customer.selected_shipping_address, None)
 
        # get our new customer
        our_customer = Customer.objects.get(user__email="test@test.com")
        self.assertNotEqual(our_customer, None)
        # four new addresses should be created for our_customer
 
        # refetch our customer
        our_customer = Customer.objects.get(user__email="test@test.com")
        self.assertNotEqual(our_customer.selected_invoice_address, None)
        self.assertNotEqual(our_customer.selected_shipping_address, None)

src/d/j/django-lfs-0.7.7/lfs/checkout/tests/test_checkout.py   django-lfs(Download)
        self.assertContains(cart_response, self.PRODUCT1_NAME, status_code=200)
        user = User.objects.get(username=self.username)
        customer = Customer.objects.get(user=user)
        fr = Country.objects.get(code="fr")
        self.assertEquals(customer.selected_invoice_address.country.code, "fr")
        cart_response = self.c.post('/refresh-cart', {'country': de.code.lower(), "amount-cart-item_%s" % self.item1.id: 1, "amount-cart-item_%s" % self.item2.id: 1})
 
        customer = Customer.objects.get(user=user)
        self.assertEquals(customer.selected_shipping_address.country.code.lower(), "de")
        self.assertEquals(customer.selected_invoice_address.country.code.lower(), "de")

src/d/j/django-lfs-HEAD/lfs/checkout/tests/test_checkout.py   django-lfs(Download)
        self.assertContains(cart_response, self.PRODUCT1_NAME, status_code=200)
        user = User.objects.get(username=self.username)
        customer = Customer.objects.get(user=user)
        fr = Country.objects.get(code="fr")
        self.assertEquals(customer.selected_invoice_address.country.code, "fr")
        cart_response = self.client.post('/refresh-cart', {'country': de.code.lower(), "amount-cart-item_%s" % self.item1.id: 1, "amount-cart-item_%s" % self.item2.id: 1})
 
        customer = Customer.objects.get(user=user)
        self.assertEquals(customer.selected_shipping_address.country.code.lower(), "de")
        self.assertEquals(customer.selected_invoice_address.country.code.lower(), "de")

  1 | 2  Next